Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions jscomp/core/js_dump.ml
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ let exp_need_paren (e : J.expression) =
| Raw_js_code (_, Exp)
| Fun _
| Raw_js_function _
| Caml_block (_,_,_, (Blk_record _ | Blk_module _))
| Object _ -> true
| Raw_js_code (_,Stmt)
| Length _
Expand Down
1 change: 1 addition & 0 deletions jscomp/test/build.ninja
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,7 @@ build test/gpr_3877_test.cmi test/gpr_3877_test.cmj : cc test/gpr_3877_test.ml |
build test/gpr_3895_test.cmi test/gpr_3895_test.cmj : cc test/gpr_3895_test.ml | $stdlib
build test/gpr_3897_test.cmi test/gpr_3897_test.cmj : cc test/gpr_3897_test.ml | $stdlib
build test/gpr_3931_test.cmi test/gpr_3931_test.cmj : cc test/gpr_3931_test.ml | $stdlib
build test/gpr_3980_test.cmi test/gpr_3980_test.cmj : cc test/gpr_3980_test.ml | $stdlib
build test/gpr_405_test.cmj : cc_cmi test/gpr_405_test.ml | test/gpr_405_test.cmi $stdlib
build test/gpr_405_test.cmi : cc test/gpr_405_test.mli | $stdlib
build test/gpr_441.cmi test/gpr_441.cmj : cc test/gpr_441.ml | $stdlib
Expand Down
48 changes: 48 additions & 0 deletions jscomp/test/gpr_3980_test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
'use strict';

var Js_math = require("../../lib/js/js_math.js");
var Caml_builtin_exceptions = require("../../lib/js/caml_builtin_exceptions.js");

var match = 1;

if (match !== undefined) {
if (match !== 1) {
throw [
Caml_builtin_exceptions.assert_failure,
/* tuple */[
"gpr_3980_test.ml",
16,
10
]
];
}
var match$1 = (1);
if (match$1 !== 1) {
if (match$1 !== 2) {
throw [
Caml_builtin_exceptions.assert_failure,
/* tuple */[
"gpr_3980_test.ml",
14,
12
]
];
}
({
name: "bye",
age: Js_math.floor(1)
});
}

} else {
throw [
Caml_builtin_exceptions.assert_failure,
/* tuple */[
"gpr_3980_test.ml",
16,
10
]
];
}

/* Not a pure module */
16 changes: 16 additions & 0 deletions jscomp/test/gpr_3980_test.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
type student = {
name: string;
age: int;
}
let _ =
match (Some 1) with
| Some 1 ->
(match [%raw "1"] with
| 1 -> {name = "hi"; age = 1}
| 2 -> {
name = "bye";
age = Js.Math.floor 1.
}
| _ -> assert false
)
| _ -> assert false
Loading