Skip to content

Commit

Permalink
mark function curry kind in value mismatch
Browse files Browse the repository at this point in the history
  • Loading branch information
tsnobip committed Sep 29, 2023
1 parent 66a0601 commit 70cd60b
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,11 @@
6 │

Signature mismatch:
Modules do not match:
{
let add: (int, int) => int
}
is not included in
{
let add: (. int, int) => int
}
...
Values do not match:
let add: (int, int) => int
let add: (int, int) => int (curried)
is not included in
let add: (. int, int) => int
let add: (. int, int) => int (uncurried)
/.../fixtures/curried_value_instead_of_uncurried_in_curried_mode.res:2:3-30:
Expected declaration
/.../fixtures/curried_value_instead_of_uncurried_in_curried_mode.res:4:7-9:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,11 @@
9 │

Signature mismatch:
Modules do not match:
{
let add: (. int, int) => int
}
is not included in
{
let add: (int, int) => int
}
...
Values do not match:
let add: (. int, int) => int
let add: (int, int) => int (curried)
is not included in
let add: (int, int) => int
let add: (int, int) => int (uncurried)
/.../fixtures/curried_value_instead_of_uncurried_in_uncurried_mode.res:4:3-28:
Expected declaration
/.../fixtures/curried_value_instead_of_uncurried_in_uncurried_mode.res:7:7-9:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,11 @@
6 │

Signature mismatch:
Modules do not match:
{
let add: (. int, int) => int
}
is not included in
{
let add: (int, int) => int
}
...
Values do not match:
let add: (. int, int) => int
let add: (. int, int) => int (uncurried)
is not included in
let add: (int, int) => int
let add: (int, int) => int (curried)
/.../fixtures/uncurried_value_instead_of_curried_in_curried_mode.res:2:3-28:
Expected declaration
/.../fixtures/uncurried_value_instead_of_curried_in_curried_mode.res:4:7-9:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,11 @@
9 │

Signature mismatch:
Modules do not match:
{
let add: (int, int) => int
}
is not included in
{
let add: (. int, int) => int
}
...
Values do not match:
let add: (int, int) => int
let add: (int, int) => int (uncurried)
is not included in
let add: (. int, int) => int
let add: (int, int) => int (curried)
/.../fixtures/uncurried_value_instead_of_curried_in_uncurried_mode.res:5:3-30:
Expected declaration
/.../fixtures/uncurried_value_instead_of_curried_in_uncurried_mode.res:7:7-9:
Expand Down
14 changes: 14 additions & 0 deletions jscomp/ml/includemod.ml
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,20 @@ let include_err ppf = function
| Missing_field (id, loc, kind) ->
fprintf ppf "The %s `%a' is required but not provided" kind ident id;
show_loc "Expected declaration" ppf loc
| Value_descriptions(id,
({ val_type = { desc = Tlink { desc = Tconstr (Pident {name = "function$"},_,_) }}} as d1),
({ val_type = { desc = Tarrow _ }} as d2)) ->
fprintf ppf
"@[<hv 2>Values do not match:@ %a (uncurried)@;<1 -2>is not included in@ %a (curried)@]"
(value_description id) d1 (value_description id) d2;
show_locs ppf (d1.val_loc, d2.val_loc)
| Value_descriptions(id,
({ val_type = { desc = Tlink { desc = Tarrow _ }}} as d1),
({ val_type = { desc = Tconstr (Pident {name = "function$"},_,_)}} as d2)) ->
fprintf ppf
"@[<hv 2>Values do not match:@ %a (curried)@;<1 -2>is not included in@ %a (uncurried)@]"
(value_description id) d1 (value_description id) d2;
show_locs ppf (d1.val_loc, d2.val_loc)
| Value_descriptions(id, d1, d2) ->
fprintf ppf
"@[<hv 2>Values do not match:@ %a@;<1 -2>is not included in@ %a@]"
Expand Down
2 changes: 1 addition & 1 deletion jscomp/syntax/src/res_uncurried.ml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ let fromDotted ~dotted = function
let getDotted ~uncurried = function
| Config.Legacy -> uncurried
| Swap -> not uncurried
| Uncurried -> not uncurried
| Uncurried -> false

0 comments on commit 70cd60b

Please sign in to comment.