[ruby-dev:50417] [Ruby trunk Bug#14232] Unused refinement still breaks method search
From:
nagachika00@...
Date:
2018-01-18 04:42:52 UTC
List:
ruby-dev #50417
Issue #14232 has been updated by nagachika (Tomoyuki Chikanaga).
Backport changed from 2.3: REQUIRED, 2.4: REQUIRED, 2.5: REQUIRED to 2.3: DONTNEED, 2.4: REQUIRED, 2.5: REQUIRED
You cannot refine Module on 2.3.x.
I set DONTNEED for 2.3.
----------------------------------------
Bug #14232: Unused refinement still breaks method search
https://bugs.ruby-lang.org/issues/14232#change-69623
* Author: shugo (Shugo Maeda)
* Status: Closed
* Priority: Normal
* Assignee: shugo (Shugo Maeda)
* Target version:
* ruby -v:
* Backport: 2.3: DONTNEED, 2.4: REQUIRED, 2.5: REQUIRED
----------------------------------------
Given the following t.rb:
```
module A
def foo
puts "A#foo"
super
end
end
class B
def foo
puts "B#foo"
end
end
class C < B
include A
def foo
puts "C#foo"
super
end
end
module D
refine A do
def foo
end
end
end
C.new.foo
```
Even if D is not used, B#foo cannot be called by super in A#foo:
```
$ ruby t.rb
C#foo
A#foo
Traceback (most recent call last):
2: from t.rb:30:in `<main>'
1: from t.rb:19:in `foo'
t.rb:4:in `foo': super: no superclass method `foo' for #<C:0x00005623950b74f8> (NoMethodError)
```
--
https://bugs.ruby-lang.org/