Issue #11022 has been updated by jeremyevans0 (Jeremy Evans).

Assignee set to matz (Yukihiro Matsumoto)
Status changed from Feedback to Assigned

Class variable lookup going from singleton class to actual class appears to be intentional behavior if you look at the code.  The `class_variable_get` bug is being addressed in #8297.  Assigning to matz for confirmation that this behavior is expected.

Please do not set the status to Feedback if you have responded.  Feedback status means that committers are waiting for feedback from you.  You can reset the status to Open if you disagree with the initial closing of an issue.

----------------------------------------
Bug #11022: opening an eigenclass does not change the class variable definition context
https://bugs.ruby-lang.org/issues/11022#change-81408

* Author: bughit (bug hit)
* Status: Assigned
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
* Target version: 
* ruby -v: ruby 2.2.1p85 (2015-02-26 revision 49769) [i686-linux]
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN
----------------------------------------
```ruby
module Mod1

  class << Object.new

    C = 1
    @@cv = 1

    p Module.nesting,
      constants(false),
      class_variables(false),
      Mod1.class_variables(false)

  end

end
```
```
[#<Class:#<Object:0xb6913d98>>, Mod1]
[:C]
[]
[:@@cv]
```

Shouldn't class var resolution be relative to the current lexical class (Module.nexting.first)?





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

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>