-
Notifications
You must be signed in to change notification settings - Fork 469
Improve function apply error messages #7496
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
|
||
[1;31mWe've found a bug for you![0m | ||
[36m/.../fixtures/arity_mismatch4.res[0m:[2m2:21-27[0m | ||
|
||
1 [2m│[0m let makeVar = (~f) => 34 | ||
[1;31m2[0m [2m│[0m let makeVariables = [1;31mmakeVar[0m(1, ~f=f => f) | ||
3 [2m│[0m | ||
|
||
This function call is incorrect. | ||
The function has type: | ||
(~f: 'a) => int | ||
|
||
- The function takes [1;33mno[0m unlabelled arguments, but is called with [1;31m1[0m |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,5 +8,8 @@ | |
4 [2m│[0m } | ||
5 [2m│[0m | ||
|
||
This function has type (int, int) => unit | ||
It is applied with [1;31m1[0m argument but it requires [1;33m2[0m. | ||
This function call is incorrect. | ||
The function has type: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here the function type is shown at the top, and the explanation of what is wrong is shown below. In the example further above it is the other way around. I actually prefer the style here, can we standardize on it? I.e., always start with
and then the explanation below? Or maybe even on one line:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I adjusted. Please have another look. |
||
(int, int) => unit | ||
|
||
It is called with [1;31m1[0m argument but requires [1;33m2[0m. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We still have different styles here. Other messages have
This one has
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, technically I'd say we have this structure:
For this particular error message I think it makes more sense to have it like this. You're going to see the highlighted position first, then the message that the arg should be labelled, and then the function type. I think that makes sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, fine with me, too.