You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 14, 2022. It is now read-only.
class ContainerClass():
class BaseClass(object):
def __init__(self, name):
self.name = name
class SubClass(BaseClass):
def __init__(self):
super().__init__('')
The PLS analyzer logic incorrectly reports that BaseClass is referenced before being defined. In looking at the PLS code, AnalysisUnit.AnalyzeWorker is calling EvaluateBaseClass from within the scope of the subclass rather than its outer (containing) class.
I think this can be fixed by modifying AnalysisUnit.AnalyzeWorker to temporarily set the scope of the ddg to the outer scope before calling EvaluateBaseClass. Something like this:
// Evaluate base classes in the outer scope.
if (_outerUnit.Scope is InterpreterScope) {
ddg.Scope = _outerUnit.Scope as InterpreterScope;
}
bases.Add(EvaluateBaseClass(ddg, classInfo, i, baseClassArg.Expression));
ddg.Scope = InterpreterScope;
The text was updated successfully, but these errors were encountered:
erictraut
changed the title
PLS does not resolve base class expressions in correct scope resulting in incorrect errors
PLS does not resolve base class expressions in correct scope
Dec 26, 2018
New code does not report definition order... And there is no language server that uses new code yet. The only thing that exists for the new code is unit tests... I checked this snipped in a unit test to make sure there are no parse errors, there are none.
Consider the following Python code:
The PLS analyzer logic incorrectly reports that
BaseClass
is referenced before being defined. In looking at the PLS code,AnalysisUnit.AnalyzeWorker
is callingEvaluateBaseClass
from within the scope of the subclass rather than its outer (containing) class.I think this can be fixed by modifying
AnalysisUnit.AnalyzeWorker
to temporarily set the scope of the ddg to the outer scope before callingEvaluateBaseClass
. Something like this:The text was updated successfully, but these errors were encountered: