-
Notifications
You must be signed in to change notification settings - Fork 177
Reject p(p a, &block => value) and similar
#3669
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
Conversation
| bool contains_keyword_splat = false; | ||
|
|
||
| if (pm_symbol_node_label_p(argument) || accept1(parser, PM_TOKEN_EQUAL_GREATER)) { | ||
| if (argument_allowed_for_bare_hash(parser, argument)){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is very similar code here
Line 18217 in ce4abe1
| if (pm_symbol_node_label_p(element) || accept1(parser, PM_TOKEN_EQUAL_GREATER)) { |
I tried a few things to find code samples which force me to do the same change there as well but I did not find such code. Left it alone for now
| ^~ unexpected '=>', expecting end-of-input | ||
| ^~ unexpected '=>', ignoring it | ||
|
|
||
| p[p a, x: b => value] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is code which I assumed would still be accepted with this change (see previous comment). But it is correctly rejected.
|
|
||
| not !foo 1 | ||
|
|
||
| foo(bar baz, key => value) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably already tested somewhere 🤷
02c4a77 to
f189649
Compare
tenderlove
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but I wish we had a CI build that would test Prism PRs against CRuby. I'll try this PR locally just in case.
|
There is this
But I guess you mean something a bit more comprehensive? |
Ya, I'd like it if the whole suite was run. But it may make CI take too long. We've had cases where those two tests passed just fine, but merging broke upstream CI. |
|
Yeah, I thought so. I ran test-all locally with this and apart from some |
e32c909 to
587cb5c
Compare
e9b7024 to
a3127f6
Compare
They were being parsed as `p((p a, &block) => value)`. When we get to this point, we must not just have parsed a command call, always consuming the `=>` is not correct. Closes [Bug #21622]
a3127f6 to
796ab0e
Compare
|
This needs to be reverted: https://github.com/ruby/ruby/actions/runs/19615315949/job/56167057220 Seems I missed something, will revisit this later |
Redo of ruby#3669 with more tests
Redo of ruby#3669 with more tests
They were being parsed as
p((p a, &block) => value). When we get to this point, we must not just have parsed a command call, always consuming the=>is not correct.Closes [Bug #21622]