diff --git a/python/python-psi-api/src/com/jetbrains/python/psi/types/PyTypeVisitor.java b/python/python-psi-api/src/com/jetbrains/python/psi/types/PyTypeVisitor.java index 0526c4292fed..0a74502a3a78 100644 --- a/python/python-psi-api/src/com/jetbrains/python/psi/types/PyTypeVisitor.java +++ b/python/python-psi-api/src/com/jetbrains/python/psi/types/PyTypeVisitor.java @@ -43,7 +43,8 @@ public abstract class PyTypeVisitor { } public T visitPyClassLikeType(@NotNull PyClassLikeType classLikeType) { - return visitPyCallableType(classLikeType); + // Don't treat PyClassLikeType as PyCallableType. It's usually not what a visitor's user expects. + return visitPyType(classLikeType); } public T visitPyFunctionType(@NotNull PyFunctionType functionType) { diff --git a/python/python-psi-impl/src/com/jetbrains/python/psi/types/PyRecursiveTypeVisitor.java b/python/python-psi-impl/src/com/jetbrains/python/psi/types/PyRecursiveTypeVisitor.java index f8f1091d694c..3270560b87ee 100644 --- a/python/python-psi-impl/src/com/jetbrains/python/psi/types/PyRecursiveTypeVisitor.java +++ b/python/python-psi-impl/src/com/jetbrains/python/psi/types/PyRecursiveTypeVisitor.java @@ -140,15 +140,6 @@ public final class PyRecursiveTypeVisitor extends PyTypeVisitorExt visitPyClassLikeType(@NotNull PyClassLikeType classLikeType) { - // Don't inherit the default implementation from PyCallableType. - // Even though PyClassLikeType can behave like a callable if the corresponding class - // has __init__ or __call__, most likely the respective parameter types and - // return type are not part of its notation. - return Collections.emptyList(); - } - @Override public @NotNull List<@Nullable PyType> visitPyGenericType(@NotNull PyCollectionType genericType) { return genericType.getElementTypes();