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

Fix 3112 - disallow commas after block arg #3119

Merged
merged 2 commits into from
Oct 1, 2024
Merged

Conversation

eileencodes
Copy link
Member

Prism was already disallowing arguments after block args, but in parse.y, any comma after a block arg is a syntax error. This moves the error handling into PM_TOKEN_UAMPERSAND where we can check if the current type is PM_TOKEN_COMMAthen raise an error. I've also updated the tests to include the examplesfrom #3112.

Fixes: #3112

Prism was already disallowing arguments after block args, but in
parse.y, any comma after a block arg is a syntax error. This moves the
error handling into `PM_TOKEN_UAMPERSAND` where we can check if the
current type is `PM_TOKEN_COMMA`then raise an error. I've also updated
the tests to include the examplesfrom ruby#3112.

Fixes: ruby#3112
src/prism.c Outdated Show resolved Hide resolved
@kddnewton kddnewton merged commit 3eacea4 into ruby:main Oct 1, 2024
54 of 55 checks passed
@eileencodes eileencodes deleted the fix-3112 branch October 2, 2024 15:59
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.

Comma allowed just after block arguments
2 participants