Skip to content

Commit 5298392

Browse files
committed
add a test case for labeled const
TODO: labeled const does not really make sense, we should disable it in the syntax level ``` external on_exit_slice3 : int -> h:(_ [@bs.as 3]) -> (_ [@bs.as "xxx"]) -> int array -> unit = "xx" [@@bs.send.pipe: t] [@@bs.splice] ```
1 parent fa13694 commit 5298392

File tree

8 files changed

+113
-133
lines changed

8 files changed

+113
-133
lines changed

jscomp/main/builtin_cmi_datasets.ml

Lines changed: 6 additions & 6 deletions
Large diffs are not rendered by default.

jscomp/test/bs_splice_partial.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
var Curry = require("../../lib/js/curry.js");
44

5+
function test(g) {
6+
g.xx(22, 3, "xxx", 1, 2, 3);
7+
return /* () */0;
8+
}
9+
510
function test_hi(x) {
611
var match = x.hi(1, 2, 3);
712
if (match !== null) {
@@ -32,6 +37,7 @@ function f(x) {
3237
return /* () */0;
3338
}
3439

40+
exports.test = test;
3541
exports.test_hi = test_hi;
3642
exports.test_hi__2 = test_hi__2;
3743
exports.test_cb = test_cb;

jscomp/test/bs_splice_partial.ml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
type t
99
external on_exit_slice3 :
1010
int
11-
-> (_ [@bs.as 3])
11+
-> h:(_ [@bs.as 3])
1212
-> (_ [@bs.as "xxx"])
1313
-> int array
1414
-> unit
@@ -18,10 +18,10 @@ external on_exit_slice3 :
1818

1919

2020

21-
(* let test _g =
22-
on_exit_slice3 __LINE__ [|1;2;3|]
21+
let test g =
22+
on_exit_slice3 __LINE__ [|1;2;3|] g
23+
2324

24-
*)
2525

2626

2727
external hi : int array -> int option = "hi"

lib/4.06.1/bsdep.ml

Lines changed: 15 additions & 19 deletions
Large diffs are not rendered by default.

lib/4.06.1/unstable/js_compiler.ml

Lines changed: 26 additions & 32 deletions
Large diffs are not rendered by default.

lib/4.06.1/unstable/js_refmt_compiler.ml

Lines changed: 26 additions & 32 deletions
Large diffs are not rendered by default.

lib/4.06.1/unstable/native_ppx.ml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17238,9 +17238,7 @@ type attr =
1723817238

1723917239
type label_noname =
1724017240
| Label
17241-
| LabelCst of { cst : cst }
1724217241
| Empty
17243-
| EmptyCst of cst
1724417242
| Optional
1724517243

1724617244
type t =
@@ -17304,9 +17302,7 @@ type cst =
1730417302

1730517303
type label_noname =
1730617304
| Label
17307-
| LabelCst of { cst : cst }
1730817305
| Empty
17309-
| EmptyCst of cst
1731017306
| Optional
1731117307

1731217308
type label =
@@ -19934,16 +19930,16 @@ let handle_attributes
1993419930
param_type :: arg_types end
1993519931
| Labelled s ->
1993619932
begin match refine_arg_type ~nolabel:false ty with
19937-
| new_ty, (Arg_cst i as arg_type) ->
19938-
LabelCst {cst = i}, arg_type, arg_types
19933+
| new_ty, (Arg_cst _ as arg_type) ->
19934+
Label , arg_type, arg_types
1993919935
| new_ty, arg_type ->
1994019936
Label , arg_type,
1994119937
{param_type with ty = new_ty} :: arg_types
1994219938
end
1994319939
| Nolabel ->
1994419940
begin match refine_arg_type ~nolabel:true ty with
19945-
| new_ty , (Arg_cst i as arg_type) ->
19946-
EmptyCst i , arg_type, arg_types
19941+
| new_ty , (Arg_cst _ as arg_type) ->
19942+
Empty , arg_type, arg_types
1994719943
| new_ty , arg_type ->
1994819944
Empty, arg_type, {param_type with ty = new_ty} :: arg_types
1994919945
end

lib/4.06.1/whole_compiler.ml

Lines changed: 26 additions & 32 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)