-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Create a new scope in collect
body
#19288
Conversation
I'm confused about |
I don't think there's a semantic difference between them (this should be documented if it hasn't already), so you can't use them to error if it doesn't return an expression. They are just reflective of the syntax the parser encounters. For example this compiles and runs fine: (if true:
echo "a"
else:
echo "b") But is parsed as:
In this case using |
The reason it was done this way is that you can easily introduce a new scope via |
it looks like a bug, and i bet no one would expect it not to open new scope. |
This pull request has been automatically marked as stale because it has not had recent activity. If you think it is still a valid PR, please rebase it on the latest devel; otherwise it will be closed. Thank you for your contributions. |
If you want to use variables from inside the |
This pull request is stale because it has been open for 1 year with no activity. Contribute more commits on the pull request and rebase it on the latest devel, or it will be closed in 30 days. Thank you for your contributions. |
This pull request has been marked as stale and closed due to inactivity after 395 days. |
Fixes a part of #19287, previously
collect
didn't create a new scope so all variables defined inside ofcollect
call were available outside.Also changed newTree(nnkStmtList) to
newStmtList
for shorter code