-
Notifications
You must be signed in to change notification settings - Fork 471
Closed
Description
type t =
| A
| B
| C
| D of int
| E of int
let f x = match x with
| A -> 0
| B -> 1
| C -> 2
| D x -> x
| E x -> x + 1
Current output:
function f(x) {
if (typeof x !== "number") {
if (x.TAG) {
return x._0 + 1 | 0;
} else {
return x._0;
}
}
switch (x) {
case /* A */0 :
return 0;
case /* B */1 :
return 1;
case /* C */2 :
return 2;
}
}
Expected output:
function f(x) {
if (typeof x !== "number") {
if (x.TAG === 0 /* E */ ) {
return x._0 + 1 | 0;
} else {
return x._0;
}
}
switch (x) {
case /* A */0 :
return 0;
case /* B */1 :
return 1;
case /* C */2 :
return 2;
}
}
Metadata
Metadata
Assignees
Labels
No labels