Skip to content

[DO NOT MERGE](CI-TEST)fix error msg on curried/uncurried sig mismatch #6488

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@

We've found a bug for you!
/.../fixtures/variant_spread_tag_value_mismatch1.res:3:5-5:1

1 │ module Foo: {
2 │ let addcuc: (. int, int) => int
3 │ } = {
4 │  let addcuc = (a, b) => a + b
5 │ }
6 │

Signature mismatch:
Modules do not match:
{
let addcuc: (int, int) => int
}
is not included in
{
let addcuc: (. int, int) => int
}
Values do not match:
let addcuc: (int, int) => int (curried)
is not included in
let addcuc: (. int, int) => int (uncurried)
/.../fixtures/variant_spread_tag_value_mismatch1.res:2:3-33:
Expected declaration
/.../fixtures/variant_spread_tag_value_mismatch1.res:4:7-12:
Actual declaration
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@

We've found a bug for you!
/.../fixtures/variant_spread_tag_value_mismatch2.res:5:5-8:1

3 │ module Foo: {
4 │ let addcuu: (int, int) => int
5 │ } = {
6 │  @@uncurried.swap
7 │  let addcuu = (. a, b) => a + b
8 │ }
9 │

Signature mismatch:
Modules do not match:
{
let addcuu: (int, int) => int
}
is not included in
{
let addcuu: (int, int) => int
}
Values do not match:
let addcuu: (int, int) => int (curried)
is not included in
let addcuu: (int, int) => int (uncurried)
/.../fixtures/variant_spread_tag_value_mismatch2.res:4:3-31:
Expected declaration
/.../fixtures/variant_spread_tag_value_mismatch2.res:7:7-12:
Actual declaration
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@

We've found a bug for you!
/.../fixtures/variant_spread_tag_value_mismatch3.res:3:5-5:1

1 │ module Foo: {
2 │ let adducc: (int, int) => int
3 │ } = {
4 │  let adducc = (. a, b) => a + b
5 │ }
6 │

Signature mismatch:
Modules do not match:
{
let adducc: (. int, int) => int
}
is not included in
{
let adducc: (int, int) => int
}
Values do not match:
let adducc: (. int, int) => int (uncurried)
is not included in
let adducc: (int, int) => int (curried)
/.../fixtures/variant_spread_tag_value_mismatch3.res:2:3-31:
Expected declaration
/.../fixtures/variant_spread_tag_value_mismatch3.res:4:7-12:
Actual declaration
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@

We've found a bug for you!
/.../fixtures/variant_spread_tag_value_mismatch4.res:6:5-8:1

4 │ @@uncurried.swap
5 │ let adducu: (. int, int) => int
6 │ } = {
7 │  let adducu = (a, b) => a + b
8 │ }
9 │

Signature mismatch:
Modules do not match:
{
let adducu: (int, int) => int
}
is not included in
{
let adducu: (int, int) => int
}
Values do not match:
let adducu: (int, int) => int (uncurried)
is not included in
let adducu: (int, int) => int (curried)
/.../fixtures/variant_spread_tag_value_mismatch4.res:5:3-33:
Expected declaration
/.../fixtures/variant_spread_tag_value_mismatch4.res:7:7-12:
Actual declaration
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module Foo: {
let addcuc: (. int, int) => int
} = {
let addcuc = (a, b) => a + b
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
@@uncurried

module Foo: {
let addcuu: (int, int) => int
} = {
@@uncurried.swap
let addcuu = (. a, b) => a + b
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module Foo: {
let adducc: (int, int) => int
} = {
let adducc = (. a, b) => a + b
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
@@uncurried

module Foo: {
@@uncurried.swap
let adducu: (. int, int) => int
} = {
let adducu = (a, b) => a + b
}
16 changes: 12 additions & 4 deletions jscomp/ml/includemod.ml
Original file line number Diff line number Diff line change
Expand Up @@ -533,14 +533,22 @@ let show_locs ppf (loc1, loc2) =
show_loc "Expected declaration" ppf loc2;
show_loc "Actual declaration" ppf loc1

let include_err ppf = function
let include_err ~env 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, d1, d2) ->
let curry_kind_1, curry_kind_2 =
match (Ctype.expand_head env d1.val_type, Ctype.expand_head env d2.val_type ) with
| { desc = Tarrow _ },
{ desc = Tconstr (Pident {name = "function$"},_,_)} -> (" (curried)", " (uncurried)")
| { desc = Tconstr (Pident {name = "function$"},_,_)},
{ desc = Tarrow _ } -> (" (uncurried)", " (curried)")
| _ -> ("", "")
in
fprintf ppf
"@[<hv 2>Values do not match:@ %a@;<1 -2>is not included in@ %a@]"
(value_description id) d1 (value_description id) d2;
"@[<hv 2>Values do not match:@ %a%s@;<1 -2>is not included in@ %a%s@]"
(value_description id) d1 curry_kind_1 (value_description id) d2 curry_kind_2;
show_locs ppf (d1.val_loc, d2.val_loc);
| Type_declarations(id, d1, d2, errs) ->
fprintf ppf "@[<v>@[<hv>%s:@;<1 2>%a@ %s@;<1 2>%a@]%a%a@]"
Expand Down Expand Up @@ -633,7 +641,7 @@ let context ppf cxt =

let include_err ppf (cxt, env, err) =
Printtyp.wrap_printing_env env (fun () ->
fprintf ppf "@[<v>%a%a@]" context (List.rev cxt) include_err err)
fprintf ppf "@[<v>%a%a@]" context (List.rev cxt) (include_err ~env) err)

let buffer = ref Bytes.empty
let is_big obj =
Expand Down