Project

General

Profile

Actions

Bug #11615

closed

Forwardable fails to adjust backtrace when Exception is defined in the target class

Added by shugo (Shugo Maeda) over 8 years ago. Updated over 8 years ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:71175]

Description

Forwardable fails to adjust backtrace when Exception is defined in the target class as follows:

$ cat t.rb
require "forwardable"

class Foo
  extend Forwardable

  def_delegator :bar, :baz

  class Exception
  end
end

Foo.new.baz
$ ruby t.rb
/home/shugo/local/lib/ruby/2.3.0/forwardable.rb:183:in `baz': undefined local variable or method `bar' for #<Foo:0x007fe48a6e65b0> (NameError)
Did you mean?  baz
	from t.rb:12:in `<main>'

Without the definition of Foo::Exception, backtrace is shown as follows:

$ ruby t.rb
t.rb:12:in `<main>': undefined local variable or method `bar' for #<Foo:0x007f455d9d1c38> (NameError)
Did you mean?  baz
Actions

Also available in: Atom PDF

Like0
Like0