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:
Jeremy Evans 2019-08-13 22:44:36 -07:00
parent 7d32cb7631
commit fbcd065294
4 changed files with 19 additions and 13 deletions

View file

@ -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}"