Project

General

Profile

Bug #15877

Updated by danielwaterworth (Daniel Waterworth) almost 5 years ago

This behavior seems wrong to me: 

 ``` ruby 
 class Foo 
   def test 
     TEST 
   end 
 end 

 Bar1 = Foo.clone 
 Bar2 = Foo.clone 

 class Bar1 
   TEST = 'bar-1' 
 end 

 class Bar2 
   TEST = 'bar-2' 
 end 

 # If these two lines are reordered, 'bar-2' is produced each time 
 p [:bar1_method, Bar1.new.test] # outputs 'bar-1' (correct) 
 p [:bar2_method, Bar2.new.test] # outputs 'bar-1' (incorrect) 

 p [:bar1_const, Bar1::TEST] # outputs 'bar-1' (correct) 
 p [:bar2_const, Bar2::TEST] # outputs 'bar-2' (correct) 
 ``` 

 Possibly related to #9603, #7107 #9603

Back