Issue #3080 has been updated by ko1 (Koichi Sasada).

Assignee changed from ko1 (Koichi Sasada) to nobu (Nobuyoshi Nakada)

nobu, could you check it?

----------------------------------------
Bug #3080: class_variable_set issue with duped Module
https://bugs.ruby-lang.org/issues/3080#change-33898

Author: dolzenko (Evgeniy Dolzhenko)
Status: Assigned
Priority: Normal
Assignee: nobu (Nobuyoshi Nakada)
Category: 
Target version: 2.0.0
ruby -v: ruby 1.9.2dev (2010-04-02 trunk 27162) [i686-linux]


=begin
 Below is the test case which is failing for me on ruby 1.9.2dev (2010-04-02 trunk 27162) [i686-linux] but works on ruby 1.8.7 (2009-12-24 patchlevel 248) [i686-linux]:
 
 ---
 module Original
   @@cvar = nil
 
   def self.module_get_cvar
     @@cvar
   end
 
   def function_get_cvar
     @@cvar
   end
 end
 
 Duped = Original.dup
 
 Original.send(:class_variable_set, :@@cvar, "cvar in Original")
 Duped.send(:class_variable_set, :@@cvar, "cvar in Duped")
 
 class IncludesOriginal
   include Original
 end
 
 class IncludesDuped
   include Duped
 end
 
 puts IncludesOriginal.new.function_get_cvar # => cvar in Original
 puts IncludesDuped.new.function_get_cvar # => cvar in Duped
 
 puts Original.module_get_cvar # => cvar in Original
 
 puts Duped.module_get_cvar # => 19_duped_module_class_variable_set_bug.rb:3: warning: class variable access from toplevel
                            #    19_duped_module_class_variable_set_bug.rb:3:in `get_cvar': uninitialized class variable @@cvar in Object (NameError)
                            #            from 19_duped_module_class_variable_set_bug.rb:13:in `<main>'
 ---
=end



-- 
http://bugs.ruby-lang.org/