Skip to content

Commit 1e4cc35

Browse files
committed
Fix build and snapshot
1 parent f35bc2f commit 1e4cc35

File tree

12 files changed

+301
-119
lines changed

12 files changed

+301
-119
lines changed

jscomp/stdlib-402/obj.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ external obj : t -> 'a = "%identity"
2020
external magic : 'a -> 'b = "%identity"
2121

2222
external is_int : t -> bool = "%obj_is_int"
23-
let [@inline always] is_block a = not (is_int a)
23+
let is_block a = not (is_int a)
2424
external tag : t -> int = "caml_obj_tag"
2525
external set_tag : t -> int -> unit = "caml_obj_set_tag"
2626
external size : t -> int = "%obj_size"

jscomp/test/.depend

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,7 @@ for_side_effect_test.cmj : mt.cmj
223223
format_regression.cmj :
224224
format_test.cmj : mt.cmj
225225
fs_test.cmj : ../others/node.cmj mt.cmj ../runtime/js.cmj
226+
fun_pattern_match.cmj : ../runtime/js.cmj
226227
functor_app_test.cmj : mt.cmj functor_inst.cmj functor_def.cmj
227228
functor_def.cmj : ../runtime/js.cmj
228229
functor_ffi.cmj : ../runtime/js.cmj

jscomp/test/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,7 @@ OTHERS := test_literals a test_ari test_export2 test_internalOO test_obj_simple_
266266
large_record_duplication_test\
267267
unboxed_attribute_test\
268268
406_primitive_test\
269+
fun_pattern_match\
269270
ocaml_typedtree_test
270271
# ocaml_typedtree_test is not cross version due to camlinternalFormat
271272
# bs_uncurry_test

jscomp/test/fun_pattern_match.js

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
'use strict';
2+
3+
var Curry = require("../../lib/js/curry.js");
4+
var Caml_primitive = require("../../lib/js/caml_primitive.js");
5+
var Caml_builtin_exceptions = require("../../lib/js/caml_builtin_exceptions.js");
6+
7+
function f(param, v) {
8+
return ((((param[/* x0 */0] + param[/* x1 */1] | 0) + param[/* x2 */2] | 0) + param[/* x3 */3] | 0) + param[/* x4 */4] | 0) + v | 0;
9+
}
10+
11+
function f2(param, param$1) {
12+
return (((((param[/* x0 */0] + param[/* x1 */1] | 0) + param[/* x2 */2] | 0) + param[/* x3 */3] | 0) + param[/* x4 */4] | 0) + param$1[/* a */0] | 0) + param$1[/* b */1] | 0;
13+
}
14+
15+
function f3(param, param$1) {
16+
var lhs = param[/* rank */0];
17+
var rhs = param$1[/* rank */0];
18+
if (typeof lhs === "number") {
19+
throw [
20+
Caml_builtin_exceptions.assert_failure,
21+
/* tuple */[
22+
"fun_pattern_match.ml",
23+
43,
24+
9
25+
]
26+
];
27+
} else if (typeof rhs === "number") {
28+
throw [
29+
Caml_builtin_exceptions.assert_failure,
30+
/* tuple */[
31+
"fun_pattern_match.ml",
32+
43,
33+
9
34+
]
35+
];
36+
} else {
37+
return Caml_primitive.caml_int_compare(lhs[0], rhs[0]);
38+
}
39+
}
40+
41+
function f4(param, param$1) {
42+
var lhs = param[/* rank */0];
43+
var rhs = param$1[/* rank */0];
44+
if (typeof lhs === "number") {
45+
throw [
46+
Caml_builtin_exceptions.assert_failure,
47+
/* tuple */[
48+
"fun_pattern_match.ml",
49+
51,
50+
9
51+
]
52+
];
53+
} else if (typeof rhs === "number") {
54+
throw [
55+
Caml_builtin_exceptions.assert_failure,
56+
/* tuple */[
57+
"fun_pattern_match.ml",
58+
51,
59+
9
60+
]
61+
];
62+
} else {
63+
return Caml_primitive.caml_int_compare(lhs[0], rhs[0]);
64+
}
65+
}
66+
67+
var x = /* `A */[
68+
65,
69+
r
70+
];
71+
72+
function r(param) {
73+
return x;
74+
}
75+
76+
var match = r(/* () */0);
77+
78+
var v = Curry._1(match[1], /* () */0);
79+
80+
console.log(v);
81+
82+
exports.f = f;
83+
exports.f2 = f2;
84+
exports.f3 = f3;
85+
exports.f4 = f4;
86+
exports.r = r;
87+
exports.v = v;
88+
/* match Not a pure module */

jscomp/test/fun_pattern_match.ml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
2+
3+
4+
type u = {x0 : int ; x1 : int ; x2 : int; x3 : int ; x4: int}
5+
6+
7+
let f {x0;x1;x2;x3;x4} v =
8+
x0 + x1 + x2 + x3 + x4 + v
9+
10+
11+
type b = {a : int; b: int }
12+
let f2 {x0;x1;x2;x3;x4} {a; b}=
13+
x0 + x1 + x2 + x3 + x4 + a + b
14+
15+
type binary_op =
16+
| PLUS
17+
| MINUS
18+
19+
type rank =
20+
| Uninitialized
21+
| Visited
22+
| Ranked of int
23+
24+
25+
type binary_op_ticker = {
26+
op : binary_op;
27+
rhs: ticker;
28+
lhs: ticker;
29+
}
30+
31+
and ticker_type =
32+
| Market
33+
| Binary_op of binary_op_ticker
34+
35+
and ticker = {
36+
mutable rank: rank;
37+
}
38+
39+
let f3 =
40+
(fun {rank = lhs; _} {rank = rhs} ->
41+
match lhs, rhs with
42+
| Ranked x , Ranked y -> Pervasives.compare x y
43+
| _ -> assert false
44+
)
45+
46+
47+
let f4
48+
{rank = lhs; _} {rank = rhs} =
49+
match lhs, rhs with
50+
| Ranked x , Ranked y -> Pervasives.compare x y
51+
| _ -> assert false
52+
53+
(* #995 test case *)
54+
let rec r = (let rec x = `A r and y = fun () -> x in y);;
55+
56+
let v = let (`A x) = r () in x ();;
57+
58+
Js.log v
59+

jscomp/test/obj_magic_test.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ var Block = require("../../lib/js/block.js");
77
var empty_backtrace = Block.__(Obj.abstract_tag, []);
88

99
function is_block(x) {
10-
return x.length !== undefined;
10+
return typeof x !== "number";
1111
}
1212

1313
var suites_000 = /* tuple */[
1414
"is_block_test1",
1515
(function (param) {
1616
return /* Eq */Block.__(0, [
1717
false,
18-
(3).length !== undefined
18+
false
1919
]);
2020
})
2121
];
@@ -26,10 +26,10 @@ var suites_001 = /* :: */[
2626
(function (param) {
2727
return /* Eq */Block.__(0, [
2828
true,
29-
/* :: */[
29+
typeof /* :: */[
3030
3,
3131
/* [] */0
32-
].length !== undefined
32+
] !== "number"
3333
]);
3434
})
3535
],
@@ -39,7 +39,7 @@ var suites_001 = /* :: */[
3939
(function (param) {
4040
return /* Eq */Block.__(0, [
4141
true,
42-
"x".length !== undefined
42+
true
4343
]);
4444
})
4545
],
@@ -49,7 +49,7 @@ var suites_001 = /* :: */[
4949
(function (param) {
5050
return /* Eq */Block.__(0, [
5151
false,
52-
(3.0).length !== undefined
52+
false
5353
]);
5454
})
5555
],

0 commit comments

Comments
 (0)