Project

General

Profile

Bug #15720

Updated by chocolateboy (Chocolate Boy) over 1 year ago

```ruby 
 module M1 
   refine Kernel do 
     def foo 
       'foo called!' 
     end 
   end 
 end 

 module M2 
   refine Kernel do 
     def bar 
       'bar called!' 
     end 
   end 
 end 

 using M1 

 puts foo 
 puts bar 
 ``` 

 Expected: 

 ``` 
 foo called! 
 Traceback (most recent call last): 
 bug.rb:20:in bug.rb:22:in `<main>': undefined local variable or method `bar' for main:Object (NameError) 
 ``` 

 Actual: 

 ``` 
 foo called! 
 Traceback (most recent call last): 
 bug.rb:20:in bug.rb:22:in `<main>': stack level too deep (SystemStackError) 
 ``` 

 Same result on: 

 - ruby 2.6.2p47 (2019-03-13 revision 67232) [x86_64-linux] 
 - ruby 2.7.0dev (2019-03-21 trunk 67332) [x86_64-linux]

Back