mirror of
https://github.com/ruby/ruby.git
synced 2025-09-21 03:24:00 +02:00
Remove support for nil::Constant
This was an intentional bug added in 1.9. The approach taken here is to add a second operand to the getconstant instruction for whether nil should be allowed and treated as current scope. Fixes [Bug #11718]
This commit is contained in:
parent
7d32cb7631
commit
fbcd065294
4 changed files with 19 additions and 13 deletions
|
@ -48,6 +48,12 @@ class TestConst < Test::Unit::TestCase
|
|||
assert_equal 8, TEST4
|
||||
end
|
||||
|
||||
def test_const_access_from_nil
|
||||
assert_raise(TypeError) { eval("nil::Object") }
|
||||
assert_raise(TypeError) { eval("c = nil; c::Object") }
|
||||
assert_raise(TypeError) { eval("sc = Class.new; sc::C = nil; sc::C::Object") }
|
||||
end
|
||||
|
||||
def test_redefinition
|
||||
c = Class.new
|
||||
name = "X\u{5b9a 6570}"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue