Actions
Bug #21622
closedPrism wrongly accepts command call to be a key of keyword argument
Bug #21622:
Prism wrongly accepts command call to be a key of keyword argument
ruby -v:
ruby 3.5.0dev (2025-10-02T03:48:32Z master 88222caaa9) +PRISM [x86_64-linux]
Description
These are syntax error in parse.y but accepted in Prism
p(p a, x: b => value)
p(p a, x: => value)
p(p a, &block => value)
p(p a, *args => value)
p(p a, **kwargs => value)
Maybe as a result, Prism accepts command call within command call
p p 1, &block => 2, &block
p p p 1 => 2 => 3 => 4
Updated by Earlopain (Earlopain _) 2 months ago
The first code examples are parsed like p((p a, &block) => value). https://github.com/ruby/prism/pull/3669 should fix this (and the other two as well)
Updated by alanwu (Alan Wu) 2 months ago
- Assignee set to prism
Updated by Earlopain (Earlopain _) 14 days ago
- Status changed from Open to Closed
Applied in changeset git|2870b7d7df30bc227f40a4c04c97050b90f1f25b.
[ruby/prism] Reject p(p a, &block => value) and similar
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]
Actions