Project

General

Profile

Actions

Feature #8239

closed

Inline rescue bug

Added by dunric (David Unric) over 11 years ago. Updated over 5 years ago.

Status:
Closed
Target version:
-
[ruby-core:54120]

Description

There is a possible bug in parsing of inline rescue.
When an inline rescue is a part of multiple assignment and exception is raised, the assignment is silently ignored.

def foo
raise "error"
end

bar, baz = 1,2 # bar == 1, baz == 2
bar, baz = foo rescue [3,4] # no assignment performed: bar == 1, baz == 2
# expected after the expression: bar == 3, baz == 4

Already discussed at stackoverflow.com:
http://stackoverflow.com/questions/15880136/exceptions-why-does-adding-parenthesis-change-anything


Related issues 1 (0 open1 closed)

Has duplicate Ruby master - Bug #8279: Single-line rescue parsingClosedmatz (Yukihiro Matsumoto)Actions
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0