diff --git a/python/src/com/jetbrains/python/psi/types/PyGenericType.java b/python/src/com/jetbrains/python/psi/types/PyGenericType.java index 20e1986872dc..bf0c5565a14c 100644 --- a/python/src/com/jetbrains/python/psi/types/PyGenericType.java +++ b/python/src/com/jetbrains/python/psi/types/PyGenericType.java @@ -39,7 +39,7 @@ public class PyGenericType implements PyType { @NotNull @Override public String getName() { - return myBound != null ? myName + " (" + myBound.getName() + ")" : myName; + return myBound != null ? myName + " <= " + myBound.getName() : myName; } @Override diff --git a/python/src/com/jetbrains/python/psi/types/PyUnionType.java b/python/src/com/jetbrains/python/psi/types/PyUnionType.java index 2d56e8f291b2..c69beca25529 100644 --- a/python/src/com/jetbrains/python/psi/types/PyUnionType.java +++ b/python/src/com/jetbrains/python/psi/types/PyUnionType.java @@ -53,11 +53,11 @@ public class PyUnionType implements PyType { } public String getName() { - return "one of (" + StringUtil.join(myMembers, new NullableFunction() { - public String fun(PyType pyType) { - return pyType == null ? "unknown" : pyType.getName(); + return StringUtil.join(myMembers, new NullableFunction() { + public String fun(PyType type) { + return type != null ? type.getName() : null; } - }, ", ") + ")"; + }, " | "); } /** diff --git a/python/testData/inspections/PyTypeCheckerInspection/BoundedGeneric.py b/python/testData/inspections/PyTypeCheckerInspection/BoundedGeneric.py index 3d79685273a2..a89e7816ea87 100644 --- a/python/testData/inspections/PyTypeCheckerInspection/BoundedGeneric.py +++ b/python/testData/inspections/PyTypeCheckerInspection/BoundedGeneric.py @@ -1,12 +1,12 @@ def test(): def f(x): """ - :type x: T <= int or str + :type x: T <= int | str :rtype: T """ pass x = f(10) y = f('foo') - z = f([]) + z = f([]) return x + y