1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* class.c (rewrite_cref_stack, clone_method): rewrite a method's cref

stack when cloning into a new class to allow lexical const lookup to
  work as expected [ruby-core:47834] [Bug #7107]
* test/ruby/test_class.rb (class TestClass): related test

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38423 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
charliesome 2012-12-17 09:49:00 +00:00
parent 6d8ad6c489
commit a70bb8889b
3 changed files with 39 additions and 0 deletions

View file

@ -285,4 +285,18 @@ class TestClass < Test::Unit::TestCase
p A.superclass
RUBY
end
module M
C = 1
def self.m
C
end
end
def test_constant_access_from_method_in_cloned_module # [ruby-core:47834]
m = M.dup
assert_equal 1, m::C
assert_equal 1, m.m
end
end