Skip to content
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

Improve error message when unpacking in loop misses parentheses #54326

Open
Tortar opened this issue May 1, 2024 · 0 comments
Open

Improve error message when unpacking in loop misses parentheses #54326

Tortar opened this issue May 1, 2024 · 0 comments
Labels
domain:error messages Better, more actionable error messages

Comments

@Tortar
Copy link
Contributor

Tortar commented May 1, 2024

Now:

julia> [x for x, y in [[1,2], [2,3]]]
ERROR: ParseError:
# Error @ REPL[10]:1:9
[x for x, y in [[1,2], [2,3]]]
#       └ ── invalid iteration spec: expected one of `=` `in` or `∈`
Stacktrace:
 [1] top-level scope
   @ none:1

the suggestion seems off because the in is already there, it should somehow hint you to the right direction e.g. putting (x, y).

Actually, but maybe this is controversial, a syntax like this seems good to me, and maybe it could be allowed, in Python it works both with and without parenthesis and also in Julia x, y = [2, 3] already works so it seems good for consistency.

@Tortar Tortar changed the title Improve error message when unpacking in loop is built without paranthesis Improve error message when unpacking in loop misses parentheses May 1, 2024
@Seelengrab Seelengrab added the domain:error messages Better, more actionable error messages label May 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain:error messages Better, more actionable error messages
Projects
None yet
Development

No branches or pull requests

2 participants