rescript-compiler
rescript-compiler copied to clipboard
js_dump.ml build error when using `String(string)` variant in untagged union with other tag
Version: 11.0.0-rc.6
Create a file Foo.res with the following content:
@unboxed
type href = String(string) | Number(int)
// This works
let href = Number(1);
/**
This doesn't compile.
Fatal error: exception File "jscomp/core/js_dump.ml", line 828, characters 29-35: Assertion failed
FAILED: cannot make progress due to previous errors.
*/
let href2 = String("test");
Some observations:
- The issue doesn't appear to be coupled to
String(). If I define a typeNumber(int) | Object({foo: string}), the same issue is observed - The example above will actually compile correctly in the playground.
I can't seem to reproduce this, trying with both rc6 and current master.
I noticed this issue only occurs when the following configuration is set in rescript.json:
{
"bsc-flags": ["-bs-g"],
}
For what I know, the bs-g flag has been superfluous for quite some time now... is there still any reason we need that one?
UPDATE: After internal discussions, it is indeed a flag that's worth deprecating, so created #6496 to keep track of this.