@@ -63,7 +63,13 @@ private TResolved resolveScopeExpr(ConstantReadAccess r) {
6363 qname =
6464 min ( string qn , int p |
6565 isDefinedConstant ( qn ) and
66- qn = resolveScopeExpr ( r , p )
66+ qn = resolveScopeExpr ( r , p ) and
67+ // prevent classes/modules that contain/extend themselves
68+ not exists ( ConstantWriteAccess w | qn = constantDefinition0 ( w ) |
69+ r = w .getScopeExpr ( )
70+ or
71+ r = w .( ClassDeclaration ) .getSuperclassExpr ( )
72+ )
6773 |
6874 qn order by p
6975 )
@@ -100,18 +106,20 @@ private string resolveScopeExpr(ConstantReadAccess c, int priority) {
100106 or
101107 not exists ( c .getScopeExpr ( ) ) and
102108 not c .hasGlobalScope ( ) and
103- exists ( Namespace n |
104- result = qualifiedModuleName ( constantDefinition0 ( n ) , c .getName ( ) ) and
105- n = enclosing ( c .getEnclosingModule ( ) , priority )
109+ (
110+ exists ( Namespace n |
111+ result = qualifiedModuleName ( constantDefinition0 ( n ) , c .getName ( ) ) and
112+ n = enclosing ( c .getEnclosingModule ( ) , priority )
113+ )
114+ or
115+ result =
116+ qualifiedModuleName ( ancestors ( qualifiedModuleName ( c .getEnclosingModule ( ) ) ,
117+ priority - maxDepth ( ) ) , c .getName ( ) )
118+ or
119+ result = c .getName ( ) and
120+ priority = maxDepth ( ) + 4 and
121+ qualifiedModuleName ( c .getEnclosingModule ( ) ) != "BasicObject"
106122 )
107- or
108- result =
109- qualifiedModuleName ( ancestors ( qualifiedModuleName ( c .getEnclosingModule ( ) ) , priority - maxDepth ( ) ) ,
110- c .getName ( ) )
111- or
112- result = c .getName ( ) and
113- priority = maxDepth ( ) + 4 and
114- qualifiedModuleName ( c .getEnclosingModule ( ) ) != "BasicObject"
115123}
116124
117125bindingset [ qualifier, name]
0 commit comments