Skip to content

Commit 0858113

Browse files
authored
Merge pull request #3991 from BuckleScript/fix_3980
fix #3980
2 parents c500cfe + 07eb788 commit 0858113

File tree

10 files changed

+288
-202
lines changed

10 files changed

+288
-202
lines changed

jscomp/core/js_dump.ml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ let exp_need_paren (e : J.expression) =
171171
| Raw_js_code (_, Exp)
172172
| Fun _
173173
| Raw_js_function _
174+
| Caml_block (_,_,_, (Blk_record _ | Blk_module _))
174175
| Object _ -> true
175176
| Raw_js_code (_,Stmt)
176177
| Length _

jscomp/test/build.ninja

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,7 @@ build test/gpr_3877_test.cmi test/gpr_3877_test.cmj : cc test/gpr_3877_test.ml |
312312
build test/gpr_3895_test.cmi test/gpr_3895_test.cmj : cc test/gpr_3895_test.ml | $stdlib
313313
build test/gpr_3897_test.cmi test/gpr_3897_test.cmj : cc test/gpr_3897_test.ml | $stdlib
314314
build test/gpr_3931_test.cmi test/gpr_3931_test.cmj : cc test/gpr_3931_test.ml | $stdlib
315+
build test/gpr_3980_test.cmi test/gpr_3980_test.cmj : cc test/gpr_3980_test.ml | $stdlib
315316
build test/gpr_405_test.cmj : cc_cmi test/gpr_405_test.ml | test/gpr_405_test.cmi $stdlib
316317
build test/gpr_405_test.cmi : cc test/gpr_405_test.mli | $stdlib
317318
build test/gpr_441.cmi test/gpr_441.cmj : cc test/gpr_441.ml | $stdlib

jscomp/test/gpr_3980_test.js

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
'use strict';
2+
3+
var Js_math = require("../../lib/js/js_math.js");
4+
var Caml_builtin_exceptions = require("../../lib/js/caml_builtin_exceptions.js");
5+
6+
var match = 1;
7+
8+
if (match !== undefined) {
9+
if (match !== 1) {
10+
throw [
11+
Caml_builtin_exceptions.assert_failure,
12+
/* tuple */[
13+
"gpr_3980_test.ml",
14+
16,
15+
10
16+
]
17+
];
18+
}
19+
var match$1 = (1);
20+
if (match$1 !== 1) {
21+
if (match$1 !== 2) {
22+
throw [
23+
Caml_builtin_exceptions.assert_failure,
24+
/* tuple */[
25+
"gpr_3980_test.ml",
26+
14,
27+
12
28+
]
29+
];
30+
}
31+
({
32+
name: "bye",
33+
age: Js_math.floor(1)
34+
});
35+
}
36+
37+
} else {
38+
throw [
39+
Caml_builtin_exceptions.assert_failure,
40+
/* tuple */[
41+
"gpr_3980_test.ml",
42+
16,
43+
10
44+
]
45+
];
46+
}
47+
48+
/* Not a pure module */

jscomp/test/gpr_3980_test.ml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
type student = {
2+
name: string;
3+
age: int;
4+
}
5+
let _ =
6+
match (Some 1) with
7+
| Some 1 ->
8+
(match [%raw "1"] with
9+
| 1 -> {name = "hi"; age = 1}
10+
| 2 -> {
11+
name = "bye";
12+
age = Js.Math.floor 1.
13+
}
14+
| _ -> assert false
15+
)
16+
| _ -> assert false

0 commit comments

Comments
 (0)