-
-
Notifications
You must be signed in to change notification settings - Fork 942
Closed
Milestone
Description
Environment
- JRuby version:
jruby 9.2.5.0 (2.5.0) 2018-12-06 6d5a228 OpenJDK 64-Bit Server VM 25.181-b13 on 1.8.0_181-8u181-b13-2~deb9u1-b13 +jit [linux-x86_64]
Expected Behavior
Given the code below:
class A
def foo
puts "foo"
self
end
end
using(Module.new do
refine A do
def baz
puts "bar"
self
end
end
end)
using(Module.new do
refine A do
def bar
puts "bar"
self
end
end
end)
begin
A.new.foo.baz.bar
rescue => e
p e.message
end
begin
A.new.foo.bar.baz
rescue => e
p e.message
endI expect it to print:
"foo"
"baz"
"bar"
"foo"
"bar"
"baz"
The code below worked in 9.1.7.0 (just checked: broken since 9.2.0.0).
Actual Behavior
It prints exceptions:
"foo"
"undefined method `baz' for #<A:0x1c3a4799>"
"foo"
"bar"
"undefined method `baz' for #<A:0x3043fe0e>"
If I change the order of using, the bar method becomes undefined; hence only the last added refinement for the class is activated.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels