Rescript-compiler: Fatal error: exception Failure("File \"lam_dce.ml\", line 46, characters 40-47intValue/1014 not found")

Created on 16 Jun 2019  路  2Comments  路  Source: rescript-lang/rescript-compiler

The following program:

type state =
  | Empty
  | Int1(int)
  | Int2(int);

let func = (state: state): int => {
  switch (state) {
  | Empty => 0
  | Int2(intValue) | Int1(intValue) =>
    let intFunc = intParam => intParam + intValue;
    intFunc(0)
  };
};

Produces this unexpected error:

Fatal error: exception Failure("File \"lam_dce.ml\", line 46, characters 40-47intValue/1014 not found")

I'm using bs-platform 5.0.4 on MacOS v 10.14.4.
Here is a git repository I prepared for the purposes of demonstrating the problem.

I'm think this is the correct place to report this problem, because of this similar
(but different) bug report from 2017.

I'm able to work around the problem when I change the code like this:

type state =
  | Empty
  | Int1(int)
  | Int2(int);

let func = (state: state): int => {
  switch (state) {
  | Empty => 0
  | Int1(intValue) =>
    let intFunc = intParam => intParam + intValue;
    intFunc(0)
  | Int2(intValue) =>
    let intFunc = intParam => intParam + intValue;
    intFunc(0)
  };
};
HIGH bug

Most helpful comment

fixed in #3614 sorry for the embarrassing bug

All 2 comments

fixed in #3614 sorry for the embarrassing bug

Thanks for rapid response. I'm enjoying my first experiences with Reason and this definitely counts as the positive ones :)

Was this page helpful?
0 / 5 - 0 ratings