Actions
Bug #21674
closedPossible regression in return case in statement
Bug #21674:
Possible regression in return case in statement
Description
Suddenly my code started failing in Ruby 3.4.6 and 3.4.7. Shortest code example:
args = [:increased]
context = Data.define(:event).new(:decreased)
case args
in [event]
context.event in ^event
end
In Ruby prior to 3.4.6 it returns false (as expected) but in 3.4.6 and 3.4.7 it returns :decreased. context.event in ^event still returns false.
Updated by jandudulski (Jan Dudulski) 4 months ago
- Description updated (diff)
Typo
Updated by kddnewton (Kevin Newton) 4 months ago
- Assignee set to prism
Updated by kddnewton (Kevin Newton) 3 days ago
- Status changed from Open to Closed
Applied in changeset git|c7ed328cd569a258aa949f78f721195e2be15e9e.
[ruby/prism] Fix in handling
in is a unique keyword because it can be the start of a clause or
an infix keyword. We need to be explicitly sure that even though in
could close an expression context (the body of another in clause)
that we are not also parsing an inline in. The exception is the
case of a command call, which can never be the LHS of an expression,
and so we must immediately exit.
Actions