-
Notifications
You must be signed in to change notification settings - Fork 471
Closed
Description
Thank you for filing! Check list:
- Is it a bug? Usage questions should often be asked in the forum instead.
- Concise, focused, friendly issue title & description.
- A minimal, reproducible example.
- Ideally in OCaml syntax for now. To isolate the problem caused by either Reason or the New Syntax.
- OS and browser versions, if relevant.
- Is it already fixed in master?
Take an ADT with a mix of cases with and without arguments.
type test =
| NoArg
| AnotherNoArg
| OtherArg(int)
let test = x =>
switch x {
| NoArg => true
| _ => false
}
The JS output is,
function test(x) {
if (typeof x === "number") {
return x === 0;
} else {
return false;
}
}
For this, the output could easily be input === 0
.
This wouldn't be an issue if a minifier could optimise this - but even GCC advanced cannot do this.
Metadata
Metadata
Assignees
Labels
No labels