PyiTypeProvider doesn't escalate TypeEvalContext rights to access type hints

It's no longer necessary since PY-18816 has been implemented
This commit is contained in:
Mikhail Golubev
2017-11-24 22:42:44 +03:00
parent 0e58d34d76
commit 3b1e124936
2 changed files with 2 additions and 4 deletions
@@ -134,10 +134,7 @@ public class PyiTypeProvider extends PyTypeProviderBase {
if (target instanceof PyTargetExpression) {
final PsiElement pythonStub = PyiUtil.getPythonStub((PyTargetExpression)target);
if (pythonStub instanceof PyTypedElement) {
// XXX: Force the switch to AST for getting the type out of the hint in the comment
final TypeEvalContext effectiveContext = context.maySwitchToAST(pythonStub) ?
context : TypeEvalContext.deepCodeInsight(target.getProject());
return effectiveContext.getType((PyTypedElement)pythonStub);
return context.getType((PyTypedElement)pythonStub);
}
}
return null;
@@ -91,6 +91,7 @@ public class PyiTypeTest extends PyTestCase {
final Project project = element.getProject();
final PsiFile containingFile = element.getContainingFile();
assertType(expectedType, typedElement, TypeEvalContext.codeAnalysis(project, containingFile));
assertProjectFilesNotParsed(myFixture.getFile());
assertType(expectedType, typedElement, TypeEvalContext.userInitiated(project, containingFile));
}