diff --git a/python/src/com/jetbrains/python/documentation/PyTypeModelBuilder.java b/python/src/com/jetbrains/python/documentation/PyTypeModelBuilder.java index c92dfc33bb92..663951be6809 100644 --- a/python/src/com/jetbrains/python/documentation/PyTypeModelBuilder.java +++ b/python/src/com/jetbrains/python/documentation/PyTypeModelBuilder.java @@ -260,17 +260,15 @@ public class PyTypeModelBuilder { add("..."); return; } - add("one of ("); - processListCommaSeparated(oneOf.oneOfTypes); - add(")"); + processListCommaSeparated(oneOf.oneOfTypes, " | "); myDepth--; } - private void processListCommaSeparated(Collection list) { + private void processListCommaSeparated(Collection list, String separator) { boolean first = true; for (TypeModel t : list) { if (!first) { - add(", "); + add(separator); } else { first = false; @@ -310,7 +308,7 @@ public class PyTypeModelBuilder { return; } add("("); - processListCommaSeparated(function.parameters); + processListCommaSeparated(function.parameters, ", "); add(") -> "); function.returnType.accept(this); add("\n"); diff --git a/python/testData/inspections/PyTypeCheckerInspection/BoundedGeneric.py b/python/testData/inspections/PyTypeCheckerInspection/BoundedGeneric.py index a89e7816ea87..7fe25baa2b2a 100644 --- a/python/testData/inspections/PyTypeCheckerInspection/BoundedGeneric.py +++ b/python/testData/inspections/PyTypeCheckerInspection/BoundedGeneric.py @@ -9,4 +9,4 @@ def test(): x = f(10) y = f('foo') z = f([]) - return x + y + return x + y diff --git a/python/testData/inspections/PyTypeCheckerInspection/BuiltinNumeric.py b/python/testData/inspections/PyTypeCheckerInspection/BuiltinNumeric.py index 27b7db5cf6e8..41a6d03b9ae9 100644 --- a/python/testData/inspections/PyTypeCheckerInspection/BuiltinNumeric.py +++ b/python/testData/inspections/PyTypeCheckerInspection/BuiltinNumeric.py @@ -9,4 +9,4 @@ def test(): u'bar') pow(False, True) round(False, - 'foo') + 'foo') diff --git a/python/testData/inspections/PyTypeCheckerInspection/DictGenerics.py b/python/testData/inspections/PyTypeCheckerInspection/DictGenerics.py index 46f6ff06ac25..028614f594ff 100644 --- a/python/testData/inspections/PyTypeCheckerInspection/DictGenerics.py +++ b/python/testData/inspections/PyTypeCheckerInspection/DictGenerics.py @@ -5,4 +5,4 @@ def test_dict_generics(d): xs = d.items() d2 = dict(xs) for k, v in d2.items(): - print k + v + print k + v diff --git a/python/testData/inspections/PyTypeCheckerInspection/DictLiterals.py b/python/testData/inspections/PyTypeCheckerInspection/DictLiterals.py index f6d79460c4e4..533bccc2235f 100644 --- a/python/testData/inspections/PyTypeCheckerInspection/DictLiterals.py +++ b/python/testData/inspections/PyTypeCheckerInspection/DictLiterals.py @@ -1,8 +1,8 @@ def test(): xs = {'foo': 1, 'bar': 2} for v in xs.values(): - print(v + None) + print(v + None) for k in xs.keys(): - print(k + None) + print(k + None) for k in xs: - print(k + None) + print(k + None) diff --git a/python/testData/inspections/PyTypeCheckerInspection/Generator.py b/python/testData/inspections/PyTypeCheckerInspection/Generator.py index b14de72cb06d..8bd8b28f2780 100644 --- a/python/testData/inspections/PyTypeCheckerInspection/Generator.py +++ b/python/testData/inspections/PyTypeCheckerInspection/Generator.py @@ -89,9 +89,9 @@ def test(): f_8(gen(11)), f_9(gen(11)), f_10(gen(11)), - f_11(gen(11)), - f_12(gen(11)), - f_13(gen(11)), + f_11(gen(11)), + f_12(gen(11)), + f_13(gen(11)), f_14(gen(11)), f_15(gen(11)), f_15('foo'.split('o')), diff --git a/python/testData/inspections/PyTypeCheckerInspection/GenericUserClasses.py b/python/testData/inspections/PyTypeCheckerInspection/GenericUserClasses.py index d8a5472a0408..c114d411997a 100644 --- a/python/testData/inspections/PyTypeCheckerInspection/GenericUserClasses.py +++ b/python/testData/inspections/PyTypeCheckerInspection/GenericUserClasses.py @@ -20,7 +20,7 @@ def test_generic_user_class(): self.x = value c = User1(10) - print(c.get() + 'foo') + print(c.get() + 'foo') c.put(14) c.put('foo') diff --git a/python/testData/inspections/PyTypeCheckerInspection/GenericUserFunctions.py b/python/testData/inspections/PyTypeCheckerInspection/GenericUserFunctions.py index f2a882768c90..46368e5c7a7c 100644 --- a/python/testData/inspections/PyTypeCheckerInspection/GenericUserFunctions.py +++ b/python/testData/inspections/PyTypeCheckerInspection/GenericUserFunctions.py @@ -38,7 +38,7 @@ def test(): result = f1([1, 2, 3]) print(result) - print(result + 'foo') + print(result + 'foo') f2(1, ['foo'], 'bar') diff --git a/python/testData/inspections/PyTypeCheckerInspection/ListTuple.py b/python/testData/inspections/PyTypeCheckerInspection/ListTuple.py index 95306f40c8eb..01ffe6f0d442 100644 --- a/python/testData/inspections/PyTypeCheckerInspection/ListTuple.py +++ b/python/testData/inspections/PyTypeCheckerInspection/ListTuple.py @@ -7,5 +7,5 @@ def f(spam, eggs): def test(): - f([1, 2, 3], + f([1, 2, 3], (False, 2, '')) diff --git a/python/testData/inspections/PyTypeCheckerInspection/LocalTypeResolve.py b/python/testData/inspections/PyTypeCheckerInspection/LocalTypeResolve.py index 9d86b619c827..01bf260199ce 100644 --- a/python/testData/inspections/PyTypeCheckerInspection/LocalTypeResolve.py +++ b/python/testData/inspections/PyTypeCheckerInspection/LocalTypeResolve.py @@ -5,4 +5,4 @@ def test(): c = C() x = c.f() y = x - return y + 'foo' + return y + 'foo' diff --git a/python/testData/inspections/PyTypeCheckerInspection/MapReturnElementType.py b/python/testData/inspections/PyTypeCheckerInspection/MapReturnElementType.py index 39ea03805b54..85f08d6dfc18 100644 --- a/python/testData/inspections/PyTypeCheckerInspection/MapReturnElementType.py +++ b/python/testData/inspections/PyTypeCheckerInspection/MapReturnElementType.py @@ -1,5 +1,5 @@ def test(): xs = map(lambda x: x + 1, [1, 2, 3]) - print('foo' + xs[0]) + print('foo' + xs[0]) ys = map(str, iter([1, 2, 3])) - print(1 + ys[0], 'bar' + ys[1]) + print(1 + ys[0], 'bar' + ys[1]) diff --git a/python/testData/inspections/PyTypeCheckerInspection/PropertyAndFactoryFunction.py b/python/testData/inspections/PyTypeCheckerInspection/PropertyAndFactoryFunction.py index 008864cede03..8cf0bfcce4a9 100644 --- a/python/testData/inspections/PyTypeCheckerInspection/PropertyAndFactoryFunction.py +++ b/python/testData/inspections/PyTypeCheckerInspection/PropertyAndFactoryFunction.py @@ -7,4 +7,4 @@ def f(): return C() def test(): - f().foo + 1 + f().foo + 1 diff --git a/python/testData/inspections/PyTypeCheckerInspection/RightOperators.py b/python/testData/inspections/PyTypeCheckerInspection/RightOperators.py index 5a90ed0890ce..3e58c273927c 100644 --- a/python/testData/inspections/PyTypeCheckerInspection/RightOperators.py +++ b/python/testData/inspections/PyTypeCheckerInspection/RightOperators.py @@ -5,5 +5,5 @@ class C(object): def test_right_operators(): o = C() xs = [ - o * [], + o * [], ] diff --git a/python/testData/inspections/PyTypeCheckerInspection/StringInteger.py b/python/testData/inspections/PyTypeCheckerInspection/StringInteger.py index a551543eddec..ce379047b8ed 100644 --- a/python/testData/inspections/PyTypeCheckerInspection/StringInteger.py +++ b/python/testData/inspections/PyTypeCheckerInspection/StringInteger.py @@ -1,8 +1,8 @@ def test(): print('foo' + 'bar') print(2 + 3) - print('foo' + 3) - print(3 + 'foo') + print('foo' + 3) + print(3 + 'foo') print('foo' + 'bar' * 3) print('foo' + 3 * 'bar') - print('foo' + 2 * 3) + print('foo' + 2 * 3) diff --git a/python/testData/inspections/PyTypeCheckerInspection/UnionReturnTypes.py b/python/testData/inspections/PyTypeCheckerInspection/UnionReturnTypes.py index 76888e9a902f..ba8ec2d9f536 100644 --- a/python/testData/inspections/PyTypeCheckerInspection/UnionReturnTypes.py +++ b/python/testData/inspections/PyTypeCheckerInspection/UnionReturnTypes.py @@ -17,7 +17,7 @@ def test(): """ x1 = f1(42) f2(x1) # Weaker union types - f3(x1) + f3(x1) f2(x1.count('')) f3(x1.count('')) diff --git a/python/testData/quickdoc/HoverOverControlFlowUnion.html b/python/testData/quickdoc/HoverOverControlFlowUnion.html index 056d6ba8ce3c..5b9ce6b5ca02 100644 --- a/python/testData/quickdoc/HoverOverControlFlowUnion.html +++ b/python/testData/quickdoc/HoverOverControlFlowUnion.html @@ -1,2 +1,2 @@ variable "x" -Inferred type: one of (str, int) +Inferred type: str | int diff --git a/python/testData/quickdoc/Variable.html b/python/testData/quickdoc/Variable.html index 62d6e80474b1..eac55f8d9c13 100644 --- a/python/testData/quickdoc/Variable.html +++ b/python/testData/quickdoc/Variable.html @@ -1 +1 @@ -Assigned to y

Inferred type: one of (int, str)
\ No newline at end of file +Assigned to y

Inferred type: int | str