Skip to content

Commit 603bf66

Browse files
committed
add one example
1 parent 4a89ca3 commit 603bf66

File tree

5 files changed

+102
-64
lines changed

5 files changed

+102
-64
lines changed

jscomp/test/gpr_2614_test.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,14 @@ function hh2(x) {
5555
}
5656
}
5757

58-
exports.v = v;
58+
var u = {
59+
"xx-yy": 3
60+
};
61+
62+
var match = u["xx-yy"];
63+
64+
var v$1 = match !== undefined ? match : 0;
65+
5966
exports.b = b;
6067
exports.c = c;
6168
exports.ff = ff;
@@ -64,4 +71,6 @@ exports.h1 = h1;
6471
exports.h2 = h2;
6572
exports.hh = hh;
6673
exports.hh2 = hh2;
74+
exports.u = u;
75+
exports.v = v$1;
6776
/* Not a pure module */

jscomp/test/gpr_2614_test.ml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,32 @@ let hh2 x =
6161
match x |. low with
6262
| None -> 0
6363
| Some _ -> 1
64+
65+
type css =
66+
{
67+
a0 : int option ;
68+
a1 : int option ;
69+
a2 : int option ;
70+
a3 : int option ;
71+
a4 : int option ;
72+
a5 : int option ;
73+
a6 : int option ;
74+
a7 : int option ;
75+
a8 : int option ;
76+
a9 : int option
77+
[@bs.as "xx-yy"];
78+
a10 : int option ;
79+
a11 : int option ;
80+
a12 : int option ;
81+
a13 : int option ;
82+
a14 : int option ;
83+
a15 : int option ;
84+
}
85+
[@@bs.deriving abstract]
86+
87+
88+
let u = css ~a9:3 ()
89+
let v =
90+
match u |. a9 with
91+
| None -> 0
92+
| Some x -> x

lib/bsdep.ml

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -33443,27 +33443,27 @@ let pval_prim_of_option_labels
3344333443
(labels : (bool * string Asttypes.loc) list)
3344433444
(ends_with_unit : bool)
3344533445
=
33446-
let arg_kinds =
33447-
Ext_list.fold_right
33448-
(fun (is_option,{Asttypes.loc ; txt }) arg_kinds
33449-
->
33450-
let label_name = (Lam_methname.translate ~loc txt) in
33451-
let arg_label =
33452-
if is_option then
33453-
External_arg_spec.optional label_name
33454-
else External_arg_spec.label label_name None
33455-
in
33456-
{External_arg_spec.arg_type = Nothing ;
33457-
arg_label } :: arg_kinds
33458-
)
33459-
labels
33460-
(if ends_with_unit then
33461-
[External_arg_spec.empty_kind Extern_unit]
33462-
else [])
33463-
in
33464-
let encoding =
33465-
External_ffi_types.to_string (Ffi_obj_create arg_kinds) in
33466-
[""; encoding]
33446+
let arg_kinds =
33447+
Ext_list.fold_right
33448+
(fun (is_option,{Asttypes.loc ; txt }) arg_kinds
33449+
->
33450+
let label_name = (Lam_methname.translate ~loc txt) in
33451+
let arg_label =
33452+
if is_option then
33453+
External_arg_spec.optional label_name
33454+
else External_arg_spec.label label_name None
33455+
in
33456+
{External_arg_spec.arg_type = Nothing ;
33457+
arg_label } :: arg_kinds
33458+
)
33459+
labels
33460+
(if ends_with_unit then
33461+
[External_arg_spec.empty_kind Extern_unit]
33462+
else [])
33463+
in
33464+
let encoding =
33465+
External_ffi_types.to_string (Ffi_obj_create arg_kinds) in
33466+
[""; encoding]
3346733467

3346833468

3346933469
end

lib/bsppx.ml

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15449,27 +15449,27 @@ let pval_prim_of_option_labels
1544915449
(labels : (bool * string Asttypes.loc) list)
1545015450
(ends_with_unit : bool)
1545115451
=
15452-
let arg_kinds =
15453-
Ext_list.fold_right
15454-
(fun (is_option,{Asttypes.loc ; txt }) arg_kinds
15455-
->
15456-
let label_name = (Lam_methname.translate ~loc txt) in
15457-
let arg_label =
15458-
if is_option then
15459-
External_arg_spec.optional label_name
15460-
else External_arg_spec.label label_name None
15461-
in
15462-
{External_arg_spec.arg_type = Nothing ;
15463-
arg_label } :: arg_kinds
15464-
)
15465-
labels
15466-
(if ends_with_unit then
15467-
[External_arg_spec.empty_kind Extern_unit]
15468-
else [])
15469-
in
15470-
let encoding =
15471-
External_ffi_types.to_string (Ffi_obj_create arg_kinds) in
15472-
[""; encoding]
15452+
let arg_kinds =
15453+
Ext_list.fold_right
15454+
(fun (is_option,{Asttypes.loc ; txt }) arg_kinds
15455+
->
15456+
let label_name = (Lam_methname.translate ~loc txt) in
15457+
let arg_label =
15458+
if is_option then
15459+
External_arg_spec.optional label_name
15460+
else External_arg_spec.label label_name None
15461+
in
15462+
{External_arg_spec.arg_type = Nothing ;
15463+
arg_label } :: arg_kinds
15464+
)
15465+
labels
15466+
(if ends_with_unit then
15467+
[External_arg_spec.empty_kind Extern_unit]
15468+
else [])
15469+
in
15470+
let encoding =
15471+
External_ffi_types.to_string (Ffi_obj_create arg_kinds) in
15472+
[""; encoding]
1547315473

1547415474

1547515475
end

lib/whole_compiler.ml

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -107916,27 +107916,27 @@ let pval_prim_of_option_labels
107916107916
(labels : (bool * string Asttypes.loc) list)
107917107917
(ends_with_unit : bool)
107918107918
=
107919-
let arg_kinds =
107920-
Ext_list.fold_right
107921-
(fun (is_option,{Asttypes.loc ; txt }) arg_kinds
107922-
->
107923-
let label_name = (Lam_methname.translate ~loc txt) in
107924-
let arg_label =
107925-
if is_option then
107926-
External_arg_spec.optional label_name
107927-
else External_arg_spec.label label_name None
107928-
in
107929-
{External_arg_spec.arg_type = Nothing ;
107930-
arg_label } :: arg_kinds
107931-
)
107932-
labels
107933-
(if ends_with_unit then
107934-
[External_arg_spec.empty_kind Extern_unit]
107935-
else [])
107936-
in
107937-
let encoding =
107938-
External_ffi_types.to_string (Ffi_obj_create arg_kinds) in
107939-
[""; encoding]
107919+
let arg_kinds =
107920+
Ext_list.fold_right
107921+
(fun (is_option,{Asttypes.loc ; txt }) arg_kinds
107922+
->
107923+
let label_name = (Lam_methname.translate ~loc txt) in
107924+
let arg_label =
107925+
if is_option then
107926+
External_arg_spec.optional label_name
107927+
else External_arg_spec.label label_name None
107928+
in
107929+
{External_arg_spec.arg_type = Nothing ;
107930+
arg_label } :: arg_kinds
107931+
)
107932+
labels
107933+
(if ends_with_unit then
107934+
[External_arg_spec.empty_kind Extern_unit]
107935+
else [])
107936+
in
107937+
let encoding =
107938+
External_ffi_types.to_string (Ffi_obj_create arg_kinds) in
107939+
[""; encoding]
107940107940

107941107941

107942107942
end

0 commit comments

Comments
 (0)