Skip to content

Conversation

Earlopain
Copy link
Contributor

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]

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)){
Copy link
Contributor Author

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

prism/src/prism.c

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]
Copy link
Contributor Author

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)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably already tested somewhere 🤷

@Earlopain Earlopain force-pushed the bare-hash-command-call branch from 02c4a77 to f189649 Compare October 3, 2025 12:30
Copy link
Member

@tenderlove tenderlove left a 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.

@Earlopain
Copy link
Contributor Author

There is this

run: make -j2 -s test-all TESTS="prism ruby/test_syntax.rb ruby/test_compile_prism.rb --no-retry"

But I guess you mean something a bit more comprehensive?

@tenderlove
Copy link
Member

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.

@Earlopain
Copy link
Contributor Author

Yeah, I thought so. I ran test-all locally with this and apart from some LoadError: cannot load such file -- .../ruby/lib/prism/node (I seem to have messed up my repo somehow) it doesn't fail anything else for me.

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]
@Earlopain Earlopain force-pushed the bare-hash-command-call branch from f189649 to ff5c988 Compare October 17, 2025 07:49
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.

2 participants