Project

General

Profile

Actions

Bug #11672

closed

refinement

Added by akr (Akira Tanaka) about 9 years ago. Updated about 9 years ago.

Status:
Closed
Target version:
-
ruby -v:
ruby 2.3.0dev (2015-11-10 trunk 52511) [x86_64-linux]
[ruby-core:71423]

Description

I found following script behaves different between ruby 2.2.3 and trunk.
Is this difference intentional?

% cat tst.rb   
class C
end

module R
  refine C do
    def m
      puts :foo
    end
  end
end

using R
C.new.m

module R
  refine C do
    def m
      puts :bar
    end
  end
end

C.new.m
% ./ruby -wv tst.rb  
ruby 2.3.0dev (2015-11-10 trunk 52511) [x86_64-linux]
foo
foo
% ruby-2.2.3 -wv tst.rb
ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-linux]
foo
tst.rb:17: warning: method redefined; discarding old m
tst.rb:6: warning: previous definition of m was here
bar

Related issues 1 (0 open1 closed)

Related to Ruby master - Bug #20285: Stale inline method caches when refinement modules are reopenedClosedjhawthorn (John Hawthorn)Actions
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0