Use better TypeEvalContext.codeAnalysis() instead of codeInsightFallback() for reference expressions (PY-15558)

For PyReferenceExpressionImpl we are sure that we are a part of an AST,
not a stub, so we can use the current file as the anchor for a more
powerful codeAnalysis() type evaluation context.
This commit is contained in:
Andrey Vlasovskikh
2015-11-16 19:23:58 +03:00
parent c2ad6bce61
commit 971a9ee872
@@ -60,7 +60,10 @@ public class PyReferenceExpressionImpl extends PyElementImpl implements PyRefere
@NotNull
@Override
public PsiPolyVariantReference getReference() {
return getReference(PyResolveContext.defaultContext());
//noinspection InstanceofIncompatibleInterface
assert !(this instanceof StubBasedPsiElement);
final TypeEvalContext context = TypeEvalContext.codeAnalysis(getProject(), getContainingFile());
return getReference(PyResolveContext.defaultContext().withTypeEvalContext(context));
}
@NotNull