reach-sh/reach-lang

Compiler internal error when forgot api name

MetaB0y opened this issue · 1 comments

I forgot to provide Api name in parallelReduce and wrote:

  const [a] = parallelReduce([0])
    .while(keepGoing())
    .invariant(true)
    .api(
      (amount) => {
        assume(thisConsensusTime() >= startBlock, "subscription period has not started yet");
      },
      (amount) => amount,
      (amount, callback) => {
        assume(thisConsensusTime() >= startBlock, "subscription period has not started yet");
        
        mintTokens(this, amount);

        return [a];
      }
    ).timeRemaining(timeRemaining())
});

It caused

reachc: The compiler has encountered an internal error:

  expected Participant

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:65:3 in reach-0.1.11-CbDshw3EQf7JLMU6TWlPrY:Reach.Util
  impossible, called at src/Reach/Eval/Core.hs:2023:10 in reach-0.1.11-CbDshw3EQf7JLMU6TWlPrY:Reach.Eval.Core

Thanks! I just pushed a fix and will merge after CI