diff --git a/python/src/com/jetbrains/python/codeInsight/typing/PyTypingTypeProvider.java b/python/src/com/jetbrains/python/codeInsight/typing/PyTypingTypeProvider.java index a79afacfac04..fffbb5f84fce 100644 --- a/python/src/com/jetbrains/python/codeInsight/typing/PyTypingTypeProvider.java +++ b/python/src/com/jetbrains/python/codeInsight/typing/PyTypingTypeProvider.java @@ -98,6 +98,11 @@ public class PyTypingTypeProvider extends PyTypeProviderBase { .add("typing.Protocol") .build(); + /** + * For the following names we shouldn't go further to the RHS of assignments, + * since they are not type aliases already and in typing.pyi are assigned to + * some synthetic values. + */ private static final ImmutableSet OPAQUE_NAMES = ImmutableSet.builder() .add("typing.overload") .add("typing.Any") @@ -441,7 +446,6 @@ public class PyTypingTypeProvider extends PyTypeProviderBase { return Collections.emptyList(); } final TypeEvalContext typeEvalContext = context.getTypeContext(); - // XXX: Requires switching from stub to AST return StreamEx.of(PyClassElementType.getSubscriptedSuperClassesStubLike(cls)) .map(PySubscriptionExpression::getIndexExpression) .flatMap(e -> { @@ -656,7 +660,6 @@ public class PyTypingTypeProvider extends PyTypeProviderBase { @Nullable private static PyType getStringLiteralType(@NotNull PsiElement element, @NotNull Context context) { if (element instanceof PyStringLiteralExpression) { - // XXX: Requires switching from stub to AST final String contents = ((PyStringLiteralExpression)element).getStringValue(); return Ref.deref(getStringBasedType(contents, element, context)); } @@ -841,9 +844,6 @@ public class PyTypingTypeProvider extends PyTypeProviderBase { } } final String name = element != null ? getQualifiedName(element) : null; - // For the following names we shouldn't go to the RHS of assignments, - // since in typing.py they are not type aliases already and assigned to - // something not so useful. if (name != null && OPAQUE_NAMES.contains(name)) { elements.add(element); continue;