-
-
Notifications
You must be signed in to change notification settings - Fork 942
Closed
Milestone
Description
Environment
- JRuby version
jruby 9.1.15.0 (2.3.3) 2017-12-07 929fde8 OpenJDK 64-Bit Server VM 25.151-b12 on 1.8.0_151-8u151-b12-1~deb9u1-b12 +jit [linux-x86_64]
Expected Behavior
Given a simple script:
module DeepDup
refine ::Hash do
def deep_dup
each_with_object(dup) do |(key, value), hash|
hash[key] = if value.is_a?(::Hash) || value.is_a?(::Array)
value.deep_dup
else
value
end
end
end
end
end
module TestRefinement
using DeepDup
def self.run
source = {
a: 1,
b: 'hello',
c: {
id: 1,
data: { name: 'John' }
}
}
source.deep_dup
end
end
TestRefinement.run
puts "All OK"I expect it to print "All OK" (that's MRI behaviour).
Actual Behavior
NoMethodError: undefined method `deep_dup' for {:id=>1, :data=>{:name=>"John"}}:Hash
block in deep_dup at refinement_bug.rb:6
each at org/jruby/RubyHash.java:1343
each_with_object at org/jruby/RubyEnumerable.java:1077
deep_dup at refinement_bug.rb:4
run at refinement_bug.rb:28
<main> at refinement_bug.rb:32
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels