Skip to content

Commit 81be60a

Browse files
authored
Merge pull request #4454 from BuckleScript/fix_4451
fix #4451
2 parents 54d80ed + 643f360 commit 81be60a

File tree

8 files changed

+29
-21
lines changed

8 files changed

+29
-21
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11

22
We've found a bug for you!
3-
/.../fixtures/method_arity_mismatch.re 3:8-9
3+
/.../fixtures/method_arity_mismatch.re 3:5-11
44

55
1 │ let f = ( obj ) => {
66
2 │ obj##hi (1,2);
7-
3 │ obj##hi (1)
7+
3 │ obj##hi (1)
88
4 │ }
99

1010
This method has arity2 but was expected arity1

jscomp/syntax/ast_exp_apply.ml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ let check_and_discard (args : Ast_compatible.args) =
5151

5252
type app_pattern = {
5353
op : string;
54-
loc : Location.t;
54+
loc : Location.t; (* locatoin is the location of whole expression #4451 *)
5555
args : Parsetree.expression list
5656
}
5757

@@ -62,10 +62,10 @@ let sane_property_name_check loc s =
6262
(* match fn as *)
6363
let view_as_app (fn : exp) s : app_pattern option =
6464
match fn.pexp_desc with
65-
| Pexp_apply ({pexp_desc = Pexp_ident {txt = Lident op; loc}}, args )
65+
| Pexp_apply ({pexp_desc = Pexp_ident {txt = Lident op; _}}, args )
6666
when Ext_list.has_string s op
6767
->
68-
Some {op; loc; args = check_and_discard args}
68+
Some {op; loc = fn.pexp_loc; args = check_and_discard args}
6969
| _ -> None
7070

7171

lib/4.06.1/bsb.ml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10955,9 +10955,13 @@ let clean_re_js root =
1095510955
| None -> Set_string.empty
1095610956
in
1095710957
let gentype_language =
10958-
match Map_string.find_opt map Bsb_build_schemas.language with
10958+
match Map_string.find_opt map Bsb_build_schemas.gentypeconfig with
1095910959
| None -> ""
10960-
| Some (Str {str}) -> str
10960+
| Some (Obj { map }) ->
10961+
(match Map_string.find_opt map Bsb_build_schemas.language with
10962+
| None -> ""
10963+
| Some (Str {str}) -> str
10964+
| Some _ -> "")
1096110965
| Some _ -> ""
1096210966
in
1096310967
Ext_option.iter (Map_string.find_opt map Bsb_build_schemas.sources) begin fun config ->

lib/4.06.1/unstable/bsb_native.ml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10987,9 +10987,13 @@ let clean_re_js root =
1098710987
| None -> Set_string.empty
1098810988
in
1098910989
let gentype_language =
10990-
match Map_string.find_opt map Bsb_build_schemas.language with
10990+
match Map_string.find_opt map Bsb_build_schemas.gentypeconfig with
1099110991
| None -> ""
10992-
| Some (Str {str}) -> str
10992+
| Some (Obj { map }) ->
10993+
(match Map_string.find_opt map Bsb_build_schemas.language with
10994+
| None -> ""
10995+
| Some (Str {str}) -> str
10996+
| Some _ -> "")
1099310997
| Some _ -> ""
1099410998
in
1099510999
Ext_option.iter (Map_string.find_opt map Bsb_build_schemas.sources) begin fun config ->

lib/4.06.1/unstable/js_compiler.ml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -407641,7 +407641,7 @@ let check_and_discard (args : Ast_compatible.args) =
407641407641

407642407642
type app_pattern = {
407643407643
op : string;
407644-
loc : Location.t;
407644+
loc : Location.t; (* locatoin is the location of whole expression #4451 *)
407645407645
args : Parsetree.expression list
407646407646
}
407647407647

@@ -407652,10 +407652,10 @@ let sane_property_name_check loc s =
407652407652
(* match fn as *)
407653407653
let view_as_app (fn : exp) s : app_pattern option =
407654407654
match fn.pexp_desc with
407655-
| Pexp_apply ({pexp_desc = Pexp_ident {txt = Lident op; loc}}, args )
407655+
| Pexp_apply ({pexp_desc = Pexp_ident {txt = Lident op; _}}, args )
407656407656
when Ext_list.has_string s op
407657407657
->
407658-
Some {op; loc; args = check_and_discard args}
407658+
Some {op; loc = fn.pexp_loc; args = check_and_discard args}
407659407659
| _ -> None
407660407660

407661407661

lib/4.06.1/unstable/js_refmt_compiler.ml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -407641,7 +407641,7 @@ let check_and_discard (args : Ast_compatible.args) =
407641407641

407642407642
type app_pattern = {
407643407643
op : string;
407644-
loc : Location.t;
407644+
loc : Location.t; (* locatoin is the location of whole expression #4451 *)
407645407645
args : Parsetree.expression list
407646407646
}
407647407647

@@ -407652,10 +407652,10 @@ let sane_property_name_check loc s =
407652407652
(* match fn as *)
407653407653
let view_as_app (fn : exp) s : app_pattern option =
407654407654
match fn.pexp_desc with
407655-
| Pexp_apply ({pexp_desc = Pexp_ident {txt = Lident op; loc}}, args )
407655+
| Pexp_apply ({pexp_desc = Pexp_ident {txt = Lident op; _}}, args )
407656407656
when Ext_list.has_string s op
407657407657
->
407658-
Some {op; loc; args = check_and_discard args}
407658+
Some {op; loc = fn.pexp_loc; args = check_and_discard args}
407659407659
| _ -> None
407660407660

407661407661

lib/4.06.1/unstable/native_ppx.ml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22153,7 +22153,7 @@ let check_and_discard (args : Ast_compatible.args) =
2215322153

2215422154
type app_pattern = {
2215522155
op : string;
22156-
loc : Location.t;
22156+
loc : Location.t; (* locatoin is the location of whole expression #4451 *)
2215722157
args : Parsetree.expression list
2215822158
}
2215922159

@@ -22164,10 +22164,10 @@ let sane_property_name_check loc s =
2216422164
(* match fn as *)
2216522165
let view_as_app (fn : exp) s : app_pattern option =
2216622166
match fn.pexp_desc with
22167-
| Pexp_apply ({pexp_desc = Pexp_ident {txt = Lident op; loc}}, args )
22167+
| Pexp_apply ({pexp_desc = Pexp_ident {txt = Lident op; _}}, args )
2216822168
when Ext_list.has_string s op
2216922169
->
22170-
Some {op; loc; args = check_and_discard args}
22170+
Some {op; loc = fn.pexp_loc; args = check_and_discard args}
2217122171
| _ -> None
2217222172

2217322173

lib/4.06.1/whole_compiler.ml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -411380,7 +411380,7 @@ let check_and_discard (args : Ast_compatible.args) =
411380411380

411381411381
type app_pattern = {
411382411382
op : string;
411383-
loc : Location.t;
411383+
loc : Location.t; (* locatoin is the location of whole expression #4451 *)
411384411384
args : Parsetree.expression list
411385411385
}
411386411386

@@ -411391,10 +411391,10 @@ let sane_property_name_check loc s =
411391411391
(* match fn as *)
411392411392
let view_as_app (fn : exp) s : app_pattern option =
411393411393
match fn.pexp_desc with
411394-
| Pexp_apply ({pexp_desc = Pexp_ident {txt = Lident op; loc}}, args )
411394+
| Pexp_apply ({pexp_desc = Pexp_ident {txt = Lident op; _}}, args )
411395411395
when Ext_list.has_string s op
411396411396
->
411397-
Some {op; loc; args = check_and_discard args}
411397+
Some {op; loc = fn.pexp_loc; args = check_and_discard args}
411398411398
| _ -> None
411399411399

411400411400

0 commit comments

Comments
 (0)