Project

General

Profile

Actions

Bug #17386

closed

Refinements break prepend

Added by shugo (Shugo Maeda) about 4 years ago. Updated almost 4 years ago.

Status:
Closed
Target version:
-
ruby -v:
ruby 3.0.0dev (2020-12-10T22:40:29Z master 6b1d2de6cc) [x86_64-darwin19]
[ruby-core:101406]

Description

Reported in https://bugs.ruby-lang.org/issues/17379#note-5, but it seems a different issue from #17379 because Ruby 2.7.2 or earlier is not affected.

excelsior:/tmp$ cat t.rb
class Foo
  def foo
    p :hello
  end
end

module Code
  def foo
    p :A
  end
end

module Extension
  refine Foo do
    prepend Code
  end
end

Foo.new.foo unless ENV['SKIP'] # => :hello (ok)
Foo.prepend Code
Foo.new.foo     # => depends (not ok)
excelsior:/tmp$ ruby -v t.rb
ruby 3.0.0dev (2020-12-10T22:40:29Z master 6b1d2de6cc) [x86_64-darwin19]
:hello
:hello
excelsior:/tmp$ SKIP=t ruby -v t.rb
ruby 3.0.0dev (2020-12-10T22:40:29Z master 6b1d2de6cc) [x86_64-darwin19]
:A
excelsior:/tmp$ RBENV_VERSION=2.7.2 ruby -v t.rb
ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-darwin19]
:hello
:A
excelsior:/tmp$ SKIP=t RBENV_VERSION=2.7.2 ruby -v t.rb
ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-darwin19]
:A
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0