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

type annotations for variable tuple unpacking, better error messages #22611

Merged
merged 3 commits into from
Sep 1, 2023

Conversation

metagn
Copy link
Collaborator

@metagn metagn commented Aug 31, 2023

closes #17989, closes nim-lang/RFCs#339

Everything for it to work was already there, just the parser needed to support it.

This is opposed to the let (a: int, b: int) = ... variant, since this way is more compatible with existing AST, supports the new type inference, and is how some other languages do it which is what convinced me (though Scala supports both).

While we're at it also give type and differing length information in the error messages for non-tuples and differing length tuples.

No documentation or changelog yet, probably should have been in 2.0 since it's a grammar addition

@Araq Araq merged commit ba158d7 into nim-lang:devel Sep 1, 2023
16 checks passed
@github-actions
Copy link
Contributor

github-actions bot commented Sep 1, 2023

Thanks for your hard work on this PR!
The lines below are statistics of the Nim compiler built from ba158d7

Hint: mm: orc; opt: speed; options: -d:release
169401 lines; 10.673s; 611.168MiB peakmem

metagn added a commit to metagn/Nim that referenced this pull request Dec 18, 2023
Araq pushed a commit that referenced this pull request Dec 18, 2023
closes #23042

Adds changes from #22537 and #22611 to changelog (I believe both are set
for 2.2).
narimiran pushed a commit that referenced this pull request Apr 17, 2024
…22611)

* type annotations for variable tuple unpacking, better error messages

closes #17989, closes nim-lang/RFCs#339

* update grammar

* fix test

(cherry picked from commit ba158d7)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow typing for destructive assignment Allow to specify type for unpacking assignment
2 participants