-
Notifications
You must be signed in to change notification settings - Fork 40
Nicer error messages on argument list / tuple mismatch #1225
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
Merged
+159
−43
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
ef141bd
WIP
jiribenes 73da81e
WIP
jiribenes 094380f
More hacks
jiribenes 485c6fa
Forgotten 'name'
jiribenes 6e2d84e
Add neg tests for newly added hints
jiribenes 3275c67
Drive-by: fix lambda case position info
jiribenes 666cffd
Small tweaks: reduce nesting, remove debug code
jiribenes File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| [error] examples/neg/typer/expected_args_got_lambdacase.effekt:3:20: Wrong number of arguments to function: expected 2 value arguments, but got 1 value argument | ||
| def main() = foo { case (n, s) => | ||
| ^ | ||
| [info] examples/neg/typer/expected_args_got_lambdacase.effekt:3:20: Did you mean to use `(x, y) => ...` instead of `case (x, y) => ...`? | ||
| def main() = foo { case (n, s) => | ||
| ^ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| def foo { f: (Int, String) => Unit }: Unit = f(42, "hello") | ||
|
|
||
| def main() = foo { case (n, s) => | ||
| println(n) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| [error] examples/neg/typer/expected_args_got_tuple.effekt:4:11: Wrong number of arguments to foo: expected 2 value arguments, but got 1 value argument | ||
| val _ = foo((42, "hello")) | ||
| ^^^^^^^^^^^^^^^^^^ | ||
| [info] examples/neg/typer/expected_args_got_tuple.effekt:4:11: Did you mean to call foo with 2 separate arguments instead of a tuple? | ||
| val _ = foo((42, "hello")) | ||
| ^^^^^^^^^^^^^^^^^^ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| def foo(x: Int, s: String): Int = 42 | ||
|
|
||
| def main() = { | ||
| val _ = foo((42, "hello")) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| [error] examples/neg/typer/expected_lambdacase_got_args.effekt:3:20: Wrong number of arguments to function: expected 1 value argument, but got 2 value arguments | ||
| def main() = foo { (n, s) => | ||
| ^ | ||
| [info] examples/neg/typer/expected_lambdacase_got_args.effekt:3:20: Did you mean to use `case (x, y) => ...` to pattern match on the tuple Tuple2[Int, String]? | ||
| def main() = foo { (n, s) => | ||
| ^ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| def foo { f: ((Int, String)) => Unit }: Unit = f((42, "hello")) | ||
|
|
||
| def main() = foo { (n, s) => | ||
| println(n) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| [error] examples/neg/typer/expected_tuple_got_args.effekt:4:11: Wrong number of arguments to foo: expected 1 value argument, but got 2 value arguments | ||
| val _ = foo(42, "hello") | ||
| ^^^^^^^^^^^^^^^^ | ||
| [info] examples/neg/typer/expected_tuple_got_args.effekt:4:11: Did you mean to call foo with a single tuple argument instead of separate arguments? | ||
| val _ = foo(42, "hello") | ||
| ^^^^^^^^^^^^^^^^ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| def foo(x: (Int, String)): Int = 42 | ||
|
|
||
| def main() = { | ||
| val _ = foo(42, "hello") | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Polymorphism boxing used to use
findPreludeto find these more precisely.