diff options
Diffstat (limited to 'python/src/com/jetbrains/python/psi/types/PyTypeChecker.java')
-rw-r--r-- | python/src/com/jetbrains/python/psi/types/PyTypeChecker.java | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/python/src/com/jetbrains/python/psi/types/PyTypeChecker.java b/python/src/com/jetbrains/python/psi/types/PyTypeChecker.java index cbdeb163e923..f4a52368a047 100644 --- a/python/src/com/jetbrains/python/psi/types/PyTypeChecker.java +++ b/python/src/com/jetbrains/python/psi/types/PyTypeChecker.java @@ -215,6 +215,17 @@ public class PyTypeChecker { return false; } + @Nullable + public static PyType toNonWeakType(@Nullable PyType type, @NotNull TypeEvalContext context) { + if (type instanceof PyUnionType) { + final PyUnionType unionType = (PyUnionType)type; + if (unionType.isWeak()) { + return unionType.excludeNull(context); + } + } + return type; + } + public static boolean hasGenerics(@Nullable PyType type, @NotNull TypeEvalContext context) { final Set<PyGenericType> collected = new HashSet<PyGenericType>(); collectGenerics(type, context, collected, new HashSet<PyType>()); |