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 🤷

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 02c4a77 to f189649 Compare October 3, 2025 12:30
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.

1 participant