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

Disallow assignments to calls with parentheses #14527

Merged

Conversation

HertzDevil
Copy link
Contributor

Resolves part of #14482 (comment). The other part about named arguments is unaffected.

foo = 1
foo() = 2     # Error: unexpected token: "="
foo.[]() = 3  # Error: unexpected token: "="
foo() += 4    # Error: unexpected token: "+="
foo.[]() += 5 # Error: unexpected token: "+="

By the way, foo = 1; foo() += 2 used to raise an internal NilAssertionError in the normalizer.

@HertzDevil HertzDevil added kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:compiler:parser labels Apr 22, 2024
@straight-shoota straight-shoota added this to the 1.13.0 milestone Apr 22, 2024
@straight-shoota straight-shoota merged commit 2eed385 into crystal-lang:master Apr 23, 2024
60 checks passed
@HertzDevil HertzDevil deleted the bug/assignment-parentheses branch April 24, 2024 08:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:compiler:parser
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants