-
Notifications
You must be signed in to change notification settings - Fork 171
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
base: main
Are you sure you want to change the base?
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
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 |
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]
f189649
to
ff5c988
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]