Project

General

Profile

Actions

Backport #5234

closed

`unexpected return' occurs when a proc is called in ensure

Added by ko1 (Koichi Sasada) about 13 years ago. Updated over 8 years ago.

Status:
Rejected
[ruby-core:39125]

Description

Similar as Bug #2729, `unexpected return' occurs when a proc is called in ensure. I'm not sure why it doesn't fix with Bug #2729.

test code

class C
def each
begin
yield :foo
ensure
Proc.new
end
end

def detect
each{|e|
r = yield(e)
return true if r
}
false
end
end

p C.new.detect{|e|
true
}

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0