Skip to content

Commit be05c58

Browse files
authored
Merge pull request #5067 from rescript-lang/fix_5064
fix #5064
2 parents 1711a6a + a8a4bb0 commit be05c58

File tree

6 files changed

+36
-3
lines changed

6 files changed

+36
-3
lines changed

jscomp/frontend/bs_ast_invariant.ml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
(* Copyright (C) 2015-2016 Bloomberg Finance L.P.
2-
*
2+
* Copyright (C) 2017- Hongbo Zhang, Authors of ReScript
33
* This program is free software: you can redistribute it and/or modify
44
* it under the terms of the GNU Lesser General Public License as published by
55
* the Free Software Foundation, either version 3 of the License, or
@@ -185,6 +185,8 @@ let emit_external_warnings : iterator=
185185
match pat.ppat_desc with
186186
| Ppat_constant(constant) ->
187187
check_constant pat.ppat_loc `pat constant
188+
| Ppat_record ([],_) ->
189+
Location.raise_errorf ~loc:pat.ppat_loc "Empty record pattern is not supported"
188190
| _ -> super.pat self pat
189191
end
190192
}

jscomp/test/build.ninja

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -548,6 +548,7 @@ o test/recursive_records_test.cmi test/recursive_records_test.cmj : cc test/recu
548548
o test/recursive_unbound_module_test.cmi test/recursive_unbound_module_test.cmj : cc test/recursive_unbound_module_test.ml | $stdlib
549549
o test/regression_print.cmi test/regression_print.cmj : cc test/regression_print.ml | $stdlib
550550
o test/relative_path.cmi test/relative_path.cmj : cc test/relative_path.ml | $stdlib
551+
o test/res_debug.cmi test/res_debug.cmj : cc test/res_debug.res | $stdlib
551552
o test/return_check.cmi test/return_check.cmj : cc test/return_check.ml | $stdlib
552553
o test/runtime_encoding_test.cmi test/runtime_encoding_test.cmj : cc test/runtime_encoding_test.ml | $stdlib
553554
o test/scanf_io.cmi test/scanf_io.cmj : cc test/scanf_io.ml | test/testing.cmj $stdlib

jscomp/test/res_debug.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
'use strict';
2+
3+
4+
var u = 0;
5+
6+
exports.u = u;
7+
/* No side effect */

jscomp/test/res_debug.res

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
@@config({
2+
flags: [
3+
/* "-w";
4+
"@A" */
5+
/* "-drawlambda"; */
6+
/* "-dtypedtree"; */
7+
/* "-bs-diagnose"; */
8+
"-dparsetree",
9+
/* "-dsource"; */
10+
],
11+
})
12+
type t = { x : int, y : int}
13+
14+
// let f = (x,y) => {
15+
// let {} = {x,y}
16+
// x + y
17+
// }
18+
19+
let u = #0

lib/4.06.1/unstable/js_compiler.ml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398359,7 +398359,7 @@ val emit_external_warnings_on_signature:
398359398359
end = struct
398360398360
#1 "bs_ast_invariant.ml"
398361398361
(* Copyright (C) 2015-2016 Bloomberg Finance L.P.
398362-
*
398362+
* Copyright (C) 2017- Hongbo Zhang, Authors of ReScript
398363398363
* This program is free software: you can redistribute it and/or modify
398364398364
* it under the terms of the GNU Lesser General Public License as published by
398365398365
* the Free Software Foundation, either version 3 of the License, or
@@ -398533,6 +398533,8 @@ let emit_external_warnings : iterator=
398533398533
match pat.ppat_desc with
398534398534
| Ppat_constant(constant) ->
398535398535
check_constant pat.ppat_loc `pat constant
398536+
| Ppat_record ([],_) ->
398537+
Location.raise_errorf ~loc:pat.ppat_loc "Empty record pattern is not supported"
398536398538
| _ -> super.pat self pat
398537398539
end
398538398540
}

lib/4.06.1/whole_compiler.ml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293901,7 +293901,7 @@ val emit_external_warnings_on_signature:
293901293901
end = struct
293902293902
#1 "bs_ast_invariant.ml"
293903293903
(* Copyright (C) 2015-2016 Bloomberg Finance L.P.
293904-
*
293904+
* Copyright (C) 2017- Hongbo Zhang, Authors of ReScript
293905293905
* This program is free software: you can redistribute it and/or modify
293906293906
* it under the terms of the GNU Lesser General Public License as published by
293907293907
* the Free Software Foundation, either version 3 of the License, or
@@ -294075,6 +294075,8 @@ let emit_external_warnings : iterator=
294075294075
match pat.ppat_desc with
294076294076
| Ppat_constant(constant) ->
294077294077
check_constant pat.ppat_loc `pat constant
294078+
| Ppat_record ([],_) ->
294079+
Location.raise_errorf ~loc:pat.ppat_loc "Empty record pattern is not supported"
294078294080
| _ -> super.pat self pat
294079294081
end
294080294082
}

0 commit comments

Comments
 (0)