diff options
author | Jeremy Evans <code@jeremyevans.net> | 2022-06-20 15:51:05 -0700 |
---|---|---|
committer | Jeremy Evans <code@jeremyevans.net> | 2022-07-21 08:28:05 -0700 |
commit | 12ac8971a394118a57640299f654e46e763093fa (patch) | |
tree | 9496a60714ae5b67c525e895998d11db105169b7 /test/ruby/test_syntax.rb | |
parent | 04f86ad0b5d2fe4711ff300d855228a6aed55f33 (diff) |
Do not have class/module keywords look up ancestors of Object
Fixes case where Object includes a module that defines a constant,
then using class/module keyword to define the same constant on
Object itself.
Implements [Feature #18832]
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/6048
Diffstat (limited to 'test/ruby/test_syntax.rb')
-rw-r--r-- | test/ruby/test_syntax.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/test/ruby/test_syntax.rb b/test/ruby/test_syntax.rb index 1d7b89de57..b0ad012131 100644 --- a/test/ruby/test_syntax.rb +++ b/test/ruby/test_syntax.rb @@ -1907,6 +1907,21 @@ eom assert_equal 0...1, exp.call(a: 0) end + def test_class_module_Object_ancestors + assert_separately([], <<-RUBY) + m = Module.new + m::Bug18832 = 1 + include m + class Bug18832; end + RUBY + assert_separately([], <<-RUBY) + m = Module.new + m::Bug18832 = 1 + include m + module Bug18832; end + RUBY + end + def test_cdhash assert_separately([], <<-RUBY) n = case 1 when 2r then false else true end |