Skip to content

Conversation

@Earlopain
Copy link
Collaborator

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
Collaborator 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
Collaborator 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
Collaborator 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
Collaborator 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
Collaborator 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.

@Earlopain Earlopain force-pushed the bare-hash-command-call branch 3 times, most recently from e32c909 to 587cb5c Compare October 23, 2025 06:40
@Earlopain Earlopain force-pushed the bare-hash-command-call branch 2 times, most recently from e9b7024 to a3127f6 Compare November 7, 2025 12:26
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 a3127f6 to 796ab0e Compare November 18, 2025 08:34
@kddnewton kddnewton merged commit 2260da9 into ruby:main Nov 23, 2025
64 checks passed
@Earlopain
Copy link
Collaborator Author

This needs to be reverted: https://github.com/ruby/ruby/actions/runs/19615315949/job/56167057220

/home/runner/work/ruby/ruby/build/install/lib/ruby/4.0.0+0/bundled_gems.rb:60:in 'Kernel.require': --> /home/runner/work/ruby/ruby/build/install/lib/ruby/gems/4.0.0+0/gems/shipit-engine-0.40.1/app/models/shipit/task.rb

unexpected '=>', expecting end-of-input
unexpected '=>', ignoring it

    3  module Shipit
    4    class Task < Record
  100      state_machine :status, initial: :pending do
  157        event :aborting do
> 158          transition all - %i[aborted] => :aborting
  159        end
  180      end
  497    end
  498  end

Seems I missed something, will revisit this later

Earlopain added a commit to Earlopain/prism that referenced this pull request Nov 24, 2025
Earlopain added a commit to Earlopain/prism that referenced this pull request Dec 1, 2025
@Earlopain Earlopain deleted the bare-hash-command-call branch December 3, 2025 07:36
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.

3 participants