Skip to content

Commit 570b96b

Browse files
committed
more tests
1 parent 377e408 commit 570b96b

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed

jscomp/test/more_poly_variant_test.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,31 @@ function f1(param) {
6161
}
6262
}
6363

64+
function f2(x) {
65+
if (typeof x === "number") {
66+
if (x >= 616641298) {
67+
if (x >= 936370362) {
68+
console.log(x);
69+
return 2;
70+
} else {
71+
return 3;
72+
}
73+
} else if (x >= 104) {
74+
return 2;
75+
} else {
76+
return 333;
77+
}
78+
} else {
79+
console.log(x);
80+
return 2;
81+
}
82+
}
83+
6484
exports.map = map;
6585
exports.split_cases = split_cases;
6686
exports.f = f;
6787
exports.g1 = g1;
6888
exports.g = g;
6989
exports.f1 = f1;
90+
exports.f2 = f2;
7091
/* No side effect */

jscomp/test/more_poly_variant_test.ml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,13 @@ let rec map f : 'a vlist -> 'b vlist = function
3030

3131
let f1 = function
3232
| `As -> "A"
33-
| #abc -> "other" ;;
33+
| #abc -> "other" ;;
34+
35+
type myvariant2 = [`Tag3 of int | `Tag4 | myvariant]
36+
type x = [`a | `b | `c ]
37+
let f2 x =
38+
match x with
39+
| #myvariant2 as x -> Js.log x ; 2
40+
| `hello -> 3
41+
| `h -> 2
42+
| #x -> 333

0 commit comments

Comments
 (0)