reach-sh/reach-lang

Compiler error when using .fromObject

Closed this issue · 1 comments

Describe the error

The error is from the compiler and says it is not from my program and should contact Reach team immediately.

To Reproduce

I have included the program that produce the unexpected behavior from Reach. Please see the GitHub gist link below.

https://gist.github.com/asolpshinning/a1ee1c774b7d811826647575c2b5d85a

Expected behavior

I expected no error

Extra information

I am using the latest version of reach

reachc: The compiler has encountered an internal error:

  should be obj

This error indicates a problem with the Reach compiler, not your program. Please report this error, along with the pertinent program, to the Reach team as soon as possible so we can fix it.

Open an issue at: https://github.com/reach-sh/reach-lang/issues

CallStack (from HasCallStack):
  error, called at src/Reach/Util.hs:66:3 in reach-0-LdHw0GeE28uGIGymOwLJil:Reach.Util
  impossible, called at src/Reach/AST/DLBase.hs:123:8 in reach-0-LdHw0GeE28uGIGymOwLJil:Reach.AST.DLBase

I'm sorry for taking so long to fix this. Your program actually is wrong. I'm going to improve the Reach's compiler error message in the next release, but the problem is that on line 119...

https://gist.github.com/asolpshinning/a1ee1c774b7d811826647575c2b5d85a#file-index-rsh-js-L119

You are trying to set a currSwap object, but it is actually a Maybe(currSwap), because map dereferencing always returns a Maybe