-
Notifications
You must be signed in to change notification settings - Fork 469
Improve various error messages #7500
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
8b1ca40
6a28ea9
a8378e6
fa7e483
991dfb6
9f03508
4f30225
aa1856a
2f2dcb7
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,14 @@ | ||
|
||
[1;31mWe've found a bug for you![0m | ||
[36m/.../fixtures/array_literal_passed_to_tuple.res[0m:[2m5:17-34[0m | ||
|
||
3 [2m│[0m } | ||
4 [2m│[0m | ||
[1;31m5[0m [2m│[0m let x = doStuff([1;31m["hello", "world"][0m) | ||
6 [2m│[0m | ||
|
||
This has type: [1;31marray<'a>[0m | ||
But it's expected to have type: [1;33m(string, string)[0m | ||
|
||
- Fix this by passing a tuple instead of an array, like: [1;33m("hello", "world") | ||
[0m | ||
Comment on lines
+2
to
+14
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. When the user wrote an actual array literal, we can suggest the exact code for turning it into a tuple. 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. awesome! |
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/array_var_passed_to_tuple.res[0m:[2m7:17-18[0m | ||
|
||
5 [2m│[0m let xx = ["hello", "world"] | ||
6 [2m│[0m | ||
[1;31m7[0m [2m│[0m let x = doStuff([1;31mxx[0m) | ||
8 [2m│[0m | ||
|
||
This has type: [1;31marray<string>[0m | ||
But this function argument is expecting: [1;33m(string, string)[0m | ||
|
||
- Fix this by passing a tuple instead of an array[1;33m[0m | ||
Comment on lines
+2
to
+13
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. When it's not an actual array literal, we just say that you need to pass a tuple instead. |
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/dict_helper.res[0m:[2m3:11-23[0m | ||
|
||
1 [2m│[0m external takesDict: dict<string> => unit = "takesDict" | ||
2 [2m│[0m | ||
[1;31m3[0m [2m│[0m takesDict([1;31m{"test": "1"}[0m) | ||
4 [2m│[0m | ||
|
||
This has type: [1;31m{"test": string}[0m | ||
But it's expected to have type: [1;33mdict<string>[0m | ||
|
||
Dicts are written like: [1;33mdict{"a": 1, "b": 2}[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.
I think
process_file
is the appropriate place to run this, but maybe there's a better place, idk.