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

Codegen: don't assign yield exp to underscore block arguments #5138

Merged
merged 1 commit into from Oct 17, 2017

Conversation

asterite
Copy link
Member

Fixes #4711

@asterite asterite self-assigned this Oct 17, 2017
@RX14
Copy link
Contributor

RX14 commented Oct 17, 2017

I guess using _ variables was valid before, so this is a feature and a breaking change, instead of a bugfix?

@asterite
Copy link
Member Author

No, they weren't valid before. We were just missing not assigning to them in the codegen.

@RX14
Copy link
Contributor

RX14 commented Oct 17, 2017

So it's a bugfix? I see.

@asterite
Copy link
Member Author

asterite commented Oct 17, 2017

Indeed :-)

At some point "_" was a valid variable and block argument name. Eventually we made "_" be a variable that can be assigned to but never read. This is represented with the Underscore AST node. But then "_" was still allowed as block argument name. Changing that to use an Underscore AST node was very hard, so I just check against a "_" name. I implemented this but forgot to add the line above. It worked with just one "_" block argument though: that variable was assigned but could never be read. With two "_" that variable could be assigned twice with different types and that's where the bug happens. This PR changes the codegen so that "_" is never assigned a value.

@asterite asterite merged commit a6ddeb3 into master Oct 17, 2017
@asterite asterite deleted the bug/block-arg-underscore branch October 17, 2017 18:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants