Project

General

Profile

Actions

Bug #22095

open

Prism rejects a multiple assignment in a rescue modifier value that parse.y accepts

Bug #22095: Prism rejects a multiple assignment in a rescue modifier value that parse.y accepts

Added by Kai (kai matsudate) about 16 hours ago. Updated about 2 hours ago.

Status:
Assigned
Assignee:
Target version:
-
ruby -v:
ruby 4.0.0 (2025-12-25 revision 553f1675f3) +PRISM [arm64-darwin25]
[ruby-core:125643]

Description

Problem

parse.y and Prism parse the following differently:

a rescue b, c = 1

parse.y accepts it, but Prism rejects it.

Cause

In the grammar, the value of a rescue modifier is a statement, so it may itself be a multiple assignment.

In Prism, multiple-assignment detection is only enabled at the statement level (PM_BINDING_POWER_STATEMENT). But Prism parses the rescue value with the rescue modifier's right binding power (PM_BINDING_POWER_COMPOSITION), so it does not recognize the multiple assignment and fails at the comma.

I opened a draft PR with a proposed fix: https://github.com/ruby/prism/pull/4128

Updated by mame (Yusuke Endoh) about 2 hours ago Actions #1

  • Status changed from Open to Assigned
  • Assignee set to kddnewton (Kevin Newton)

Updated by mame (Yusuke Endoh) about 2 hours ago Actions #2

  • Assignee changed from kddnewton (Kevin Newton) to prism
Actions

Also available in: PDF Atom