Skip to content

Commit 54fc0b5

Browse files
committed
extend example
1 parent eca611d commit 54fc0b5

File tree

2 files changed

+36
-6
lines changed

2 files changed

+36
-6
lines changed

tests/tests/src/and_or_simplify.mjs

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,42 @@
11
// Generated by ReScript, PLEASE EDIT WITH CARE
22

33

4-
function check_null_typeof(x) {
4+
function check_null_eq_typeof(x) {
55
if (typeof x !== "boolean" || x !== null) {
66
return 4;
77
} else {
88
return 3;
99
}
1010
}
1111

12-
function check_undefined_typeof(x) {
12+
function check_null_neq_typeof(x) {
13+
if (typeof x !== "boolean" || x === null) {
14+
return 4;
15+
} else {
16+
return 3;
17+
}
18+
}
19+
20+
function check_undefined_eq_typeof(x) {
1321
if (typeof x !== "boolean" || x !== undefined) {
1422
return 4;
1523
} else {
1624
return 3;
1725
}
1826
}
1927

28+
function check_undefined_neq_typeof(x) {
29+
if (typeof x !== "boolean" || x === undefined) {
30+
return 4;
31+
} else {
32+
return 3;
33+
}
34+
}
35+
2036
export {
21-
check_null_typeof,
22-
check_undefined_typeof,
37+
check_null_eq_typeof,
38+
check_null_neq_typeof,
39+
check_undefined_eq_typeof,
40+
check_undefined_neq_typeof,
2341
}
2442
/* No side effect */

tests/tests/src/and_or_simplify.res

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,26 @@
11
@unboxed
22
type t = | @as(null) Null | @as(undefined) Undefined | B(bool) //| S(string)
33

4-
let check_null_typeof = x =>
4+
let check_null_eq_typeof = x =>
55
switch x {
66
| B(_) if x == Null => 3
77
| _ => 4
88
}
99

10-
let check_undefined_typeof = x =>
10+
let check_null_neq_typeof = x =>
11+
switch x {
12+
| B(_) if x != Null => 3
13+
| _ => 4
14+
}
15+
16+
let check_undefined_eq_typeof = x =>
1117
switch x {
1218
| B(_) if x == Undefined => 3
1319
| _ => 4
1420
}
21+
22+
let check_undefined_neq_typeof = x =>
23+
switch x {
24+
| B(_) if x != Undefined => 3
25+
| _ => 4
26+
}

0 commit comments

Comments
 (0)