Constant lookup falls off top scope in new compiler scoping logic #440

Closed
headius opened this Issue Dec 12, 2012 · 0 comments

Projects

None yet

1 participant

@headius
Member
headius commented Dec 12, 2012

The top-level scope isn't handled right, so we fall through during lexical search and never get to hierarchical search below.

system ~/projects/jruby $ jruby -X+C -e "module Foo; Symbol = 1; end; class Bar; include Foo; def sym; Symbol; end; end; p Bar.new.sym"
Symbol

system ~/projects/jruby $ jruby -X-C -e "module Foo; Symbol = 1; end; class Bar; include Foo; def sym; Symbol; end; end; p Bar.new.sym"
1
@headius headius added a commit that closed this issue Dec 13, 2012
@headius headius Properly set up the toplevel scope under new logic. Fixes #440.
The toplevel scope for a precompiled script was getting set up
with the toplevel scope for the runtime as parent, rather than
no parent. This caused constant lookup to search Object too soon,
at the top of the lexical search. This in turn led to constants
in the hierarchy with names the same as constants in Object to be
inaccessible.
40d9dab
@headius headius closed this in 40d9dab Dec 13, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment