From 3b1e124936ec20660297e30fa05cbac5492a8b97 Mon Sep 17 00:00:00 2001 From: Mikhail Golubev Date: Thu, 23 Nov 2017 15:13:20 +0300 Subject: [PATCH] PyiTypeProvider doesn't escalate TypeEvalContext rights to access type hints It's no longer necessary since PY-18816 has been implemented --- python/src/com/jetbrains/python/pyi/PyiTypeProvider.java | 5 +---- python/testSrc/com/jetbrains/python/pyi/PyiTypeTest.java | 1 + 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/python/src/com/jetbrains/python/pyi/PyiTypeProvider.java b/python/src/com/jetbrains/python/pyi/PyiTypeProvider.java index f3af243aa423..9280394a4eeb 100644 --- a/python/src/com/jetbrains/python/pyi/PyiTypeProvider.java +++ b/python/src/com/jetbrains/python/pyi/PyiTypeProvider.java @@ -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; diff --git a/python/testSrc/com/jetbrains/python/pyi/PyiTypeTest.java b/python/testSrc/com/jetbrains/python/pyi/PyiTypeTest.java index 6a8b81cc6dc7..bc99c8b6af5e 100644 --- a/python/testSrc/com/jetbrains/python/pyi/PyiTypeTest.java +++ b/python/testSrc/com/jetbrains/python/pyi/PyiTypeTest.java @@ -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)); }