diff --git a/python/psi-api/src/com/jetbrains/python/psi/types/TypeEvalContext.java b/python/psi-api/src/com/jetbrains/python/psi/types/TypeEvalContext.java index 313bebe81ac6..1301b7e655b4 100644 --- a/python/psi-api/src/com/jetbrains/python/psi/types/TypeEvalContext.java +++ b/python/psi-api/src/com/jetbrains/python/psi/types/TypeEvalContext.java @@ -58,7 +58,7 @@ public class TypeEvalContext { * * Should be used for code completion, go to definition, find usages, refactorings, documentation. */ - public static TypeEvalContext slow() { + public static TypeEvalContext userInitiated() { return new TypeEvalContext(true, true, null); } @@ -67,7 +67,7 @@ public class TypeEvalContext { * * Should be used only when normal analysis context is not enough for getting good results. */ - public static TypeEvalContext fast() { + public static TypeEvalContext deepCodeAnalysis() { return new TypeEvalContext(false, true, null); } @@ -75,7 +75,7 @@ public class TypeEvalContext { * Create a type evaluation context for performing analysis operations on the specified file which is currently open in the editor, * without accessing stubs. For such a file, additional slow operations are allowed. */ - public static TypeEvalContext fastStubOnly(@Nullable PsiFile origin) { + public static TypeEvalContext codeAnalysis(@Nullable PsiFile origin) { return new TypeEvalContext(false, false, origin); } diff --git a/python/src/com/jetbrains/python/codeInsight/completion/PyDictKeyNamesCompletionContributor.java b/python/src/com/jetbrains/python/codeInsight/completion/PyDictKeyNamesCompletionContributor.java index ca6e440cb922..5bf6b125049a 100644 --- a/python/src/com/jetbrains/python/codeInsight/completion/PyDictKeyNamesCompletionContributor.java +++ b/python/src/com/jetbrains/python/codeInsight/completion/PyDictKeyNamesCompletionContributor.java @@ -114,7 +114,7 @@ public class PyDictKeyNamesCompletionContributor extends CompletionContributor { if (callee == null) return; final String name = callee.getText(); if ("dict".equals(name)) { - final TypeEvalContext context = TypeEvalContext.slow(); + final TypeEvalContext context = TypeEvalContext.userInitiated(); final PyType type = context.getType(dictConstructor); if (type != null && type.isBuiltin(context)) { final PyArgumentList list = dictConstructor.getArgumentList(); diff --git a/python/src/com/jetbrains/python/codeInsight/intentions/ImportFromToImportIntention.java b/python/src/com/jetbrains/python/codeInsight/intentions/ImportFromToImportIntention.java index b8de041f6085..ca959fbec8d1 100644 --- a/python/src/com/jetbrains/python/codeInsight/intentions/ImportFromToImportIntention.java +++ b/python/src/com/jetbrains/python/codeInsight/intentions/ImportFromToImportIntention.java @@ -145,7 +145,7 @@ public class ImportFromToImportIntention implements IntentionAction { PyReferenceExpression ref = import_element.getImportReferenceExpression(); if (ref != null && ref.isValid()) { PsiElement target = ref.getReference().resolve(); - final TypeEvalContext context = TypeEvalContext.fastStubOnly(file); + final TypeEvalContext context = TypeEvalContext.codeAnalysis(file); if (target instanceof PyExpression && context.getType((PyExpression)target) instanceof PyModuleType) { return false; } diff --git a/python/src/com/jetbrains/python/codeInsight/intentions/PyDictConstructorToLiteralFormIntention.java b/python/src/com/jetbrains/python/codeInsight/intentions/PyDictConstructorToLiteralFormIntention.java index 4b6f460b179c..ab5ab8b1e592 100644 --- a/python/src/com/jetbrains/python/codeInsight/intentions/PyDictConstructorToLiteralFormIntention.java +++ b/python/src/com/jetbrains/python/codeInsight/intentions/PyDictConstructorToLiteralFormIntention.java @@ -41,7 +41,7 @@ public class PyDictConstructorToLiteralFormIntention extends BaseIntentionAction PsiTreeUtil.getParentOfType(file.findElementAt(editor.getCaretModel().getOffset()), PyCallExpression.class); if (expression != null && expression.isCalleeText("dict")) { - final TypeEvalContext context = TypeEvalContext.fastStubOnly(file); + final TypeEvalContext context = TypeEvalContext.codeAnalysis(file); PyType type = context.getType(expression); if (type != null && type.isBuiltin(context)) { PyExpression[] argumentList = expression.getArguments(); diff --git a/python/src/com/jetbrains/python/codeInsight/intentions/PyStringConcatenationToFormatIntention.java b/python/src/com/jetbrains/python/codeInsight/intentions/PyStringConcatenationToFormatIntention.java index aadbaa1897ef..174f15dd148c 100644 --- a/python/src/com/jetbrains/python/codeInsight/intentions/PyStringConcatenationToFormatIntention.java +++ b/python/src/com/jetbrains/python/codeInsight/intentions/PyStringConcatenationToFormatIntention.java @@ -66,9 +66,9 @@ public class PyStringConcatenationToFormatIntention extends BaseIntentionAction } if (expression instanceof PyStringLiteralExpression) continue; - final PyType type = TypeEvalContext.fastStubOnly(file).getType(expression); + final PyType type = TypeEvalContext.codeAnalysis(file).getType(expression); final boolean isStringReference = PyTypeChecker.match(cache.getStringType(LanguageLevel.forElement(expression)), - type, TypeEvalContext.fastStubOnly(file)) && type != null; + type, TypeEvalContext.codeAnalysis(file)) && type != null; if (!isStringReference) { return false; } diff --git a/python/src/com/jetbrains/python/codeInsight/intentions/TypeAssertionIntention.java b/python/src/com/jetbrains/python/codeInsight/intentions/TypeAssertionIntention.java index e3cea61295bd..d006d4d17831 100644 --- a/python/src/com/jetbrains/python/codeInsight/intentions/TypeAssertionIntention.java +++ b/python/src/com/jetbrains/python/codeInsight/intentions/TypeAssertionIntention.java @@ -63,7 +63,7 @@ public class TypeAssertionIntention implements IntentionAction { (reference != null && reference.resolve() == null)) { return false; } - final PyType type = TypeEvalContext.fastStubOnly(file).getType(problemElement); + final PyType type = TypeEvalContext.codeAnalysis(file).getType(problemElement); return (type == null || type instanceof PyReturnTypeReference); } diff --git a/python/src/com/jetbrains/python/codeInsight/intentions/TypeIntention.java b/python/src/com/jetbrains/python/codeInsight/intentions/TypeIntention.java index 37c309997b4d..9f855fc38ef8 100644 --- a/python/src/com/jetbrains/python/codeInsight/intentions/TypeIntention.java +++ b/python/src/com/jetbrains/python/codeInsight/intentions/TypeIntention.java @@ -162,7 +162,7 @@ public abstract class TypeIntention implements IntentionAction { } protected PyResolveContext getResolveContext(@NotNull PsiElement origin) { - return PyResolveContext.defaultContext().withTypeEvalContext(TypeEvalContext.fastStubOnly(origin.getContainingFile())); + return PyResolveContext.defaultContext().withTypeEvalContext(TypeEvalContext.codeAnalysis(origin.getContainingFile())); } public boolean startInWriteAction() { diff --git a/python/src/com/jetbrains/python/codeInsight/override/PyOverrideImplementUtil.java b/python/src/com/jetbrains/python/codeInsight/override/PyOverrideImplementUtil.java index 29b20be5bab5..a244b69a795b 100644 --- a/python/src/com/jetbrains/python/codeInsight/override/PyOverrideImplementUtil.java +++ b/python/src/com/jetbrains/python/codeInsight/override/PyOverrideImplementUtil.java @@ -196,7 +196,7 @@ public class PyOverrideImplementUtil { statementBody.append(PyNames.PASS); } else { - if (!PyNames.INIT.equals(baseFunction.getName()) && baseFunction.getReturnType(TypeEvalContext.slow(), null) != PyNoneType.INSTANCE) { + if (!PyNames.INIT.equals(baseFunction.getName()) && baseFunction.getReturnType(TypeEvalContext.userInitiated(), null) != PyNoneType.INSTANCE) { statementBody.append("return "); } if (baseClass.isNewStyleClass()) { diff --git a/python/src/com/jetbrains/python/documentation/DocStringTypeReference.java b/python/src/com/jetbrains/python/documentation/DocStringTypeReference.java index 6c3b1c8dfb01..8966ed176271 100644 --- a/python/src/com/jetbrains/python/documentation/DocStringTypeReference.java +++ b/python/src/com/jetbrains/python/documentation/DocStringTypeReference.java @@ -113,7 +113,7 @@ public class DocStringTypeReference extends PsiPolyVariantReferenceBase body) { - final TypeEvalContext context = TypeEvalContext.slow(); + final TypeEvalContext context = TypeEvalContext.userInitiated(); PyTypeModelBuilder builder = new PyTypeModelBuilder(context); builder.build(fun).toBodyWithLinks(body, fun); } @@ -481,7 +481,7 @@ public class PythonDocumentationProvider extends AbstractDocumentationProvider i @Nullable private static PyClass inferClassOfParameter(PsiElement context) { if (context instanceof PyNamedParameter) { - final PyType type = TypeEvalContext.slow().getType((PyNamedParameter)context); + final PyType type = TypeEvalContext.userInitiated().getType((PyNamedParameter)context); if (type instanceof PyClassType) { return ((PyClassType)type).getPyClass(); } diff --git a/python/src/com/jetbrains/python/findUsages/PyUsageTypeProvider.java b/python/src/com/jetbrains/python/findUsages/PyUsageTypeProvider.java index 71e3a437acf6..b4a9de818885 100644 --- a/python/src/com/jetbrains/python/findUsages/PyUsageTypeProvider.java +++ b/python/src/com/jetbrains/python/findUsages/PyUsageTypeProvider.java @@ -39,7 +39,7 @@ public class PyUsageTypeProvider implements UsageTypeProviderEx { if (element instanceof PyQualifiedExpression) { final PyExpression qualifier = ((PyQualifiedExpression)element).getQualifier(); if (qualifier != null) { - final PyType type = TypeEvalContext.slow().getType(qualifier); + final PyType type = TypeEvalContext.userInitiated().getType(qualifier); if (type == null || type instanceof PyTypeReference) { final PyCallExpression call = PsiTreeUtil.getParentOfType(element, PyCallExpression.class); if (call != null && element == call.getCallee()) { diff --git a/python/src/com/jetbrains/python/inspections/PyInspectionVisitor.java b/python/src/com/jetbrains/python/inspections/PyInspectionVisitor.java index 6658017cb4d5..6cba4dc2d589 100644 --- a/python/src/com/jetbrains/python/inspections/PyInspectionVisitor.java +++ b/python/src/com/jetbrains/python/inspections/PyInspectionVisitor.java @@ -30,7 +30,7 @@ public abstract class PyInspectionVisitor extends PyElementVisitor { synchronized (INSPECTION_TYPE_EVAL_CONTEXT) { context = session.getUserData(INSPECTION_TYPE_EVAL_CONTEXT); if (context == null) { - context = TypeEvalContext.fastStubOnly(session.getFile()); + context = TypeEvalContext.codeAnalysis(session.getFile()); session.putUserData(INSPECTION_TYPE_EVAL_CONTEXT, context); } } diff --git a/python/src/com/jetbrains/python/inspections/quickfix/AddMethodQuickFix.java b/python/src/com/jetbrains/python/inspections/quickfix/AddMethodQuickFix.java index 20aee092d2a6..26ffaeed5030 100644 --- a/python/src/com/jetbrains/python/inspections/quickfix/AddMethodQuickFix.java +++ b/python/src/com/jetbrains/python/inspections/quickfix/AddMethodQuickFix.java @@ -75,7 +75,7 @@ public class AddMethodQuickFix implements LocalQuickFix { boolean made_instance = false; if (call_by_class) { if (args.length > 0) { - PyType first_arg_type = TypeEvalContext.slow().getType(args[0]); + PyType first_arg_type = TypeEvalContext.userInitiated().getType(args[0]); if (first_arg_type instanceof PyClassType && ((PyClassType)first_arg_type).getPyClass().isSubclass(cls)) { // class, first arg ok: instance method builder.parameter("self"); // NOTE: might use a name other than 'self', according to code style. diff --git a/python/src/com/jetbrains/python/psi/impl/PyBaseElementImpl.java b/python/src/com/jetbrains/python/psi/impl/PyBaseElementImpl.java index 8af023bc8b18..1d4b7dc5e9ee 100644 --- a/python/src/com/jetbrains/python/psi/impl/PyBaseElementImpl.java +++ b/python/src/com/jetbrains/python/psi/impl/PyBaseElementImpl.java @@ -133,7 +133,7 @@ public class PyBaseElementImpl extends StubBasedPsiElemen List referencesList = new ArrayList(); final PsiFile file = element.getContainingFile(); final PyResolveContext resolveContext = file != null ? - PyResolveContext.defaultContext().withTypeEvalContext(TypeEvalContext.fastStubOnly(file)) : + PyResolveContext.defaultContext().withTypeEvalContext(TypeEvalContext.codeAnalysis(file)) : PyResolveContext.defaultContext(); while (element != null) { addReferences(offset, element, referencesList, resolveContext); diff --git a/python/src/com/jetbrains/python/psi/impl/references/PyImportReference.java b/python/src/com/jetbrains/python/psi/impl/references/PyImportReference.java index a83df0b203e1..2629dc62a926 100644 --- a/python/src/com/jetbrains/python/psi/impl/references/PyImportReference.java +++ b/python/src/com/jetbrains/python/psi/impl/references/PyImportReference.java @@ -81,7 +81,7 @@ public class PyImportReference extends PyReferenceImpl { } PyExpression qualifier = myElement.getQualifier(); - final TypeEvalContext context = TypeEvalContext.slow(); + final TypeEvalContext context = TypeEvalContext.userInitiated(); if (qualifier != null) { // qualifier's type must be module, it should know how to complete PyType type = context.getType(qualifier); diff --git a/python/src/com/jetbrains/python/psi/impl/references/PyQualifiedReference.java b/python/src/com/jetbrains/python/psi/impl/references/PyQualifiedReference.java index 090b1e012580..b3ce5a3b3cd4 100644 --- a/python/src/com/jetbrains/python/psi/impl/references/PyQualifiedReference.java +++ b/python/src/com/jetbrains/python/psi/impl/references/PyQualifiedReference.java @@ -247,7 +247,7 @@ public class PyQualifiedReference extends PyReferenceImpl { } final PyQualifiedExpression element = CompletionUtil.getOriginalOrSelf(myElement); - PyType qualifierType = TypeEvalContext.slow().getType(qualifier); + PyType qualifierType = TypeEvalContext.userInitiated().getType(qualifier); ProcessingContext ctx = new ProcessingContext(); final Set namesAlready = new HashSet(); ctx.put(PyType.CTX_NAMES, namesAlready); @@ -389,7 +389,7 @@ public class PyQualifiedReference extends PyReferenceImpl { if (containingFile instanceof StubBasedPsiElement) { assert ((StubBasedPsiElement)containingFile).getStub() == null : "Stub origin for type eval context in isReferenceTo()"; } - final TypeEvalContext context = TypeEvalContext.fastStubOnly(containingFile); + final TypeEvalContext context = TypeEvalContext.codeAnalysis(containingFile); resolveContext = resolveContext.withTypeEvalContext(context); } if (element instanceof PyFunction && Comparing.equal(referencedName, ((PyFunction)element).getName()) && diff --git a/python/src/com/jetbrains/python/psi/types/PyClassTypeImpl.java b/python/src/com/jetbrains/python/psi/types/PyClassTypeImpl.java index dcf2a2877f06..a78f9e7c2d51 100644 --- a/python/src/com/jetbrains/python/psi/types/PyClassTypeImpl.java +++ b/python/src/com/jetbrains/python/psi/types/PyClassTypeImpl.java @@ -348,7 +348,7 @@ public class PyClassTypeImpl extends UserDataHolderBase implements PyClassType { boolean suppressParentheses = context.get(CTX_SUPPRESS_PARENTHESES) != null; addOwnClassMembers(location, namesAlready, suppressParentheses, ret); - final TypeEvalContext typeEvalContext = TypeEvalContext.slow(); + final TypeEvalContext typeEvalContext = TypeEvalContext.userInitiated(); addInheritedMembers(prefix, location, namesAlready, context, ret, typeEvalContext); // from providers diff --git a/python/src/com/jetbrains/python/refactoring/PyReplaceExpressionUtil.java b/python/src/com/jetbrains/python/refactoring/PyReplaceExpressionUtil.java index abd91f32fc58..1013ac3a6038 100644 --- a/python/src/com/jetbrains/python/refactoring/PyReplaceExpressionUtil.java +++ b/python/src/com/jetbrains/python/refactoring/PyReplaceExpressionUtil.java @@ -110,7 +110,7 @@ public class PyReplaceExpressionUtil implements PyElementTypes { return replaceSubstringWithDictFormatting(oldExpression, quotes, prefix, suffix, formatValue, newText); } else { - final TypeEvalContext context = TypeEvalContext.slow(); + final TypeEvalContext context = TypeEvalContext.userInitiated(); final PyType valueType = context.getType(formatValue); final PyBuiltinCache builtinCache = PyBuiltinCache.getInstance(oldExpression); final PyType tupleType = builtinCache.getTupleType(); diff --git a/python/src/com/jetbrains/python/refactoring/introduce/IntroduceHandler.java b/python/src/com/jetbrains/python/refactoring/introduce/IntroduceHandler.java index 6f6bed984a18..65c831ee94fe 100644 --- a/python/src/com/jetbrains/python/refactoring/introduce/IntroduceHandler.java +++ b/python/src/com/jetbrains/python/refactoring/introduce/IntroduceHandler.java @@ -188,7 +188,7 @@ abstract public class IntroduceHandler implements RefactoringActionHandler { if (text != null) { candidates.addAll(NameSuggesterUtil.generateNames(text)); } - final TypeEvalContext context = TypeEvalContext.slow(); + final TypeEvalContext context = TypeEvalContext.userInitiated(); PyType type = context.getType(expression); if (type != null && type != PyNoneType.INSTANCE) { String typeName = type.getName(); diff --git a/python/testSrc/com/jetbrains/python/PyTypeParserTest.java b/python/testSrc/com/jetbrains/python/PyTypeParserTest.java index 601878d77c06..35997f16b957 100644 --- a/python/testSrc/com/jetbrains/python/PyTypeParserTest.java +++ b/python/testSrc/com/jetbrains/python/PyTypeParserTest.java @@ -33,7 +33,7 @@ public class PyTypeParserTest extends PyTestCase { myFixture.configureByFile("typeParser/typeParser.py"); final PyCollectionType type = (PyCollectionType) PyTypeParser.getTypeByName(myFixture.getFile(), "list of MyObject"); assertClassType(type, "list"); - assertClassType(type.getElementType(TypeEvalContext.slow()), "MyObject"); + assertClassType(type.getElementType(TypeEvalContext.userInitiated()), "MyObject"); } public void testDictType() { @@ -41,7 +41,7 @@ public class PyTypeParserTest extends PyTestCase { final PyCollectionType type = (PyCollectionType) PyTypeParser.getTypeByName(myFixture.getFile(), "dict from str to MyObject"); assertNotNull(type); assertClassType(type, "dict"); - final PyType elementType = type.getElementType(TypeEvalContext.slow()); + final PyType elementType = type.getElementType(TypeEvalContext.userInitiated()); assertInstanceOf(elementType, PyTupleType.class); final PyTupleType tupleType = (PyTupleType)elementType; assertEquals(2, tupleType.getElementCount()); diff --git a/python/testSrc/com/jetbrains/python/PyTypeTest.java b/python/testSrc/com/jetbrains/python/PyTypeTest.java index b1d5a66e95ec..f8cc1f9398d4 100644 --- a/python/testSrc/com/jetbrains/python/PyTypeTest.java +++ b/python/testSrc/com/jetbrains/python/PyTypeTest.java @@ -220,7 +220,7 @@ public class PyTypeTest extends PyTestCase { " return x\n" + "expr = f(1, 2)\n"; PyExpression expr = parseExpr(text); - PyType t = TypeEvalContext.slow().getType(expr); + PyType t = TypeEvalContext.userInitiated().getType(expr); assertTrue(PyTypeChecker.isUnknown(t)); doTest("int", text); } @@ -234,7 +234,7 @@ public class PyTypeTest extends PyTestCase { " return foo(x)\n" + "expr = xyzzy(a, b)"; PyExpression expr = parseExpr(text); - PyType t = TypeEvalContext.slow().getType(expr); + PyType t = TypeEvalContext.userInitiated().getType(expr); assertInstanceOf(t, PyTypeReference.class); } @@ -296,7 +296,7 @@ public class PyTypeTest extends PyTestCase { public void testSOEOnRecursiveCall() { PyExpression expr = parseExpr("def foo(x): return foo(x)\n" + "expr = foo(1)"); - TypeEvalContext context = TypeEvalContext.slow().withTracing(); + TypeEvalContext context = TypeEvalContext.userInitiated().withTracing(); PyType actual = context.getType(expr); assertFalse(actual.isBuiltin(context)); } @@ -310,7 +310,7 @@ public class PyTypeTest extends PyTestCase { " return x\n" + "\n" + "expr = f(1)\n"); - TypeEvalContext context = TypeEvalContext.slow().withTracing(); + TypeEvalContext context = TypeEvalContext.userInitiated().withTracing(); PyType actual = context.getType(expr); assertNotNull(actual); assertEquals("int", actual.getName()); @@ -325,7 +325,7 @@ public class PyTypeTest extends PyTestCase { " return x\n" + "\n" + "expr = f(1)\n"); - TypeEvalContext context = TypeEvalContext.slow().withTracing(); + TypeEvalContext context = TypeEvalContext.userInitiated().withTracing(); PyType actual = context.getType(expr); assertNotNull(actual); assertEquals("int", actual.getName()); @@ -335,7 +335,7 @@ public class PyTypeTest extends PyTestCase { public void testYieldType() { PyExpression expr = parseExpr("def f():\n" + " expr = yield 2\n"); - TypeEvalContext context = TypeEvalContext.slow().withTracing(); + TypeEvalContext context = TypeEvalContext.userInitiated().withTracing(); PyType actual = context.getType(expr); assertNull(actual); } @@ -344,7 +344,7 @@ public class PyTypeTest extends PyTestCase { public void testYieldParensType() { PyExpression expr = parseExpr("def f():\n" + " expr = (yield 2)\n"); - TypeEvalContext context = TypeEvalContext.slow().withTracing(); + TypeEvalContext context = TypeEvalContext.userInitiated().withTracing(); PyType actual = context.getType(expr); assertNull(actual); } @@ -389,7 +389,7 @@ public class PyTypeTest extends PyTestCase { "\n" + "x = f()\n" + "expr = x.start\n"); - TypeEvalContext context = TypeEvalContext.slow().withTracing(); + TypeEvalContext context = TypeEvalContext.userInitiated().withTracing(); PyType actual = context.getType(expr); assertNull(actual); } @@ -401,7 +401,7 @@ public class PyTypeTest extends PyTestCase { "\n" + "x = C()\n" + "expr = type(x)\n"); - TypeEvalContext context = TypeEvalContext.slow().withTracing(); + TypeEvalContext context = TypeEvalContext.userInitiated().withTracing(); PyType type = context.getType(expr); assertInstanceOf(type, PyClassType.class); assertTrue("Got instance type instead of class type", ((PyClassType)type).isDefinition()); @@ -413,7 +413,7 @@ public class PyTypeTest extends PyTestCase { " pass\n" + "\n" + "expr = type(C)\n"); - TypeEvalContext context = TypeEvalContext.slow().withTracing(); + TypeEvalContext context = TypeEvalContext.userInitiated().withTracing(); PyType type = context.getType(expr); assertInstanceOf(type, PyClassType.class); assertEquals(type.getName(), "type"); @@ -423,7 +423,7 @@ public class PyTypeTest extends PyTestCase { public void testReturnTypeOfTypeForUnknown() { PyExpression expr = parseExpr("def f(x):\n" + " expr = type(x)\n"); - TypeEvalContext context = TypeEvalContext.slow().withTracing(); + TypeEvalContext context = TypeEvalContext.userInitiated().withTracing(); PyType type = context.getType(expr); assertNull(type); } @@ -453,7 +453,7 @@ public class PyTypeTest extends PyTestCase { // PY-7020 public void testListComprehensionType() { final PyExpression expr = parseExpr("expr = [str(x) for x in range(10)]\n"); - final TypeEvalContext context = TypeEvalContext.slow().withTracing(); + final TypeEvalContext context = TypeEvalContext.userInitiated().withTracing(); final PyType type = context.getType(expr); assertNotNull(type); assertInstanceOf(type, PyCollectionType.class); @@ -467,7 +467,7 @@ public class PyTypeTest extends PyTestCase { // PY-7021 public void testGeneratorComprehensionType() { final PyExpression expr = parseExpr("expr = (str(x) for x in range(10))\n"); - final TypeEvalContext context = TypeEvalContext.slow().withTracing(); + final TypeEvalContext context = TypeEvalContext.userInitiated().withTracing(); final PyType type = context.getType(expr); assertNotNull(type); assertInstanceOf(type, PyCollectionType.class); @@ -558,7 +558,7 @@ public class PyTypeTest extends PyTestCase { public void testDefaultParameterIgnoreNone() { final PyExpression expr = parseExpr("def f(x=None):\n" + " expr = x\n"); - final TypeEvalContext context = TypeEvalContext.slow().withTracing(); + final TypeEvalContext context = TypeEvalContext.userInitiated().withTracing(); final PyType type = context.getType(expr); assertNull(type); } @@ -576,7 +576,7 @@ public class PyTypeTest extends PyTestCase { private void doTest(final String expectedType, final String text) { PyExpression expr = parseExpr(text); - TypeEvalContext context = TypeEvalContext.slow().withTracing(); + TypeEvalContext context = TypeEvalContext.userInitiated().withTracing(); PyType actual = context.getType(expr); PyType expected = PyTypeParser.getTypeByName(expr, expectedType); if (expected != null) {