Skip to content

Commit 8f3c563

Browse files
authored
Merge pull request #4946 from chenglou/more-arity
[Super errors] Fixes another uncurried arity mismatch report
2 parents be0355d + 451f557 commit 8f3c563

File tree

4 files changed

+43
-2
lines changed

4 files changed

+43
-2
lines changed

jscomp/build_tests/super_errors/expected/arity_mismatch3.re.expected

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,4 @@
44

55
1 │ Belt.Array.mapU([||], (. a, b) => 1);
66

7-
The field Js.Fn.I2 belongs to the record type Js.Fn.arity2
8-
but a field was expected belonging to the record type Js.Fn.arity1
7+
This function expected 1 argument, but got 2

jscomp/super_errors/super_typecore.ml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,20 @@ let report_error env ppf = function
292292
name (*kind*) Printtyp.path p;
293293
end;
294294
spellcheck ppf name valid_names;
295+
| Name_type_mismatch (
296+
"record",
297+
Ldot (Ldot ((Lident "Js"), "Fn"), _arityFieldName),
298+
(
299+
_,
300+
(Pdot (Pdot ((Pident {name = "Js"}), "Fn", _), arityA, _))
301+
),
302+
[(
303+
_,
304+
(Pdot (Pdot ((Pident {name = "Js"}), "Fn", _), arityB, _))
305+
)]
306+
) ->
307+
(* modified *)
308+
reportJsFnArityMismatch ~arityA ~arityB ppf
295309
| anythingElse ->
296310
Typecore.super_report_error_no_wrap_printing_env env ppf anythingElse
297311

lib/4.06.1/unstable/js_compiler.ml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410011,6 +410011,20 @@ let report_error env ppf = function
410011410011
name (*kind*) Printtyp.path p;
410012410012
end;
410013410013
spellcheck ppf name valid_names;
410014+
| Name_type_mismatch (
410015+
"record",
410016+
Ldot (Ldot ((Lident "Js"), "Fn"), _arityFieldName),
410017+
(
410018+
_,
410019+
(Pdot (Pdot ((Pident {name = "Js"}), "Fn", _), arityA, _))
410020+
),
410021+
[(
410022+
_,
410023+
(Pdot (Pdot ((Pident {name = "Js"}), "Fn", _), arityB, _))
410024+
)]
410025+
) ->
410026+
(* modified *)
410027+
reportJsFnArityMismatch ~arityA ~arityB ppf
410014410028
| anythingElse ->
410015410029
Typecore.super_report_error_no_wrap_printing_env env ppf anythingElse
410016410030

lib/4.06.1/whole_compiler.ml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -435894,6 +435894,20 @@ let report_error env ppf = function
435894435894
name (*kind*) Printtyp.path p;
435895435895
end;
435896435896
spellcheck ppf name valid_names;
435897+
| Name_type_mismatch (
435898+
"record",
435899+
Ldot (Ldot ((Lident "Js"), "Fn"), _arityFieldName),
435900+
(
435901+
_,
435902+
(Pdot (Pdot ((Pident {name = "Js"}), "Fn", _), arityA, _))
435903+
),
435904+
[(
435905+
_,
435906+
(Pdot (Pdot ((Pident {name = "Js"}), "Fn", _), arityB, _))
435907+
)]
435908+
) ->
435909+
(* modified *)
435910+
reportJsFnArityMismatch ~arityA ~arityB ppf
435897435911
| anythingElse ->
435898435912
Typecore.super_report_error_no_wrap_printing_env env ppf anythingElse
435899435913

0 commit comments

Comments
 (0)