diff --git a/python/src/com/jetbrains/python/psi/types/PyDynamicallyEvaluatedType.java b/python/src/com/jetbrains/python/psi/types/PyDynamicallyEvaluatedType.java index 01b535c92222..837a861be096 100644 --- a/python/src/com/jetbrains/python/psi/types/PyDynamicallyEvaluatedType.java +++ b/python/src/com/jetbrains/python/psi/types/PyDynamicallyEvaluatedType.java @@ -30,4 +30,10 @@ public class PyDynamicallyEvaluatedType extends PyUnionType { } return new PyDynamicallyEvaluatedType(members); } + + @Override + public String getName() { + PyType res = excludeNull(); + return res != null ? res.getName() : "unknown"; + } } diff --git a/python/src/com/jetbrains/python/psi/types/PyUnionType.java b/python/src/com/jetbrains/python/psi/types/PyUnionType.java index 0e1e62873eb0..466733d97b4f 100644 --- a/python/src/com/jetbrains/python/psi/types/PyUnionType.java +++ b/python/src/com/jetbrains/python/psi/types/PyUnionType.java @@ -163,8 +163,8 @@ public class PyUnionType implements PyType { /** * Excludes all subtypes of type from the union * - * @param type type to exclude. If type is a union all subtypes of union members will be excluded from the union - * If type is null only null will be excluded from the union. + * @param type type to exclude. If type is a union all subtypes of union members will be excluded from the union + * If type is null only null will be excluded from the union. * @param context * @return union with excluded types */ @@ -186,6 +186,11 @@ public class PyUnionType implements PyType { return union(members); } + @Nullable + public PyType excludeNull() { + return exclude(null, null); + } + private static PyType unit(@Nullable PyType type) { if (type instanceof PyUnionType) { Set members = new LinkedHashSet();