@@ -70,9 +70,9 @@ def g(x: AB) -> AB:
7070 return x.g() # Error
7171[out]
7272main: In function "f":
73- main, line 10: Incompatible return value type
73+ main, line 10: Incompatible return value type: expected __main__.B*, got __main__.A
7474main: In function "g":
75- main, line 12: Incompatible return value type
75+ main, line 12: Incompatible return value type: expected __main__.A*, got __main__.B
7676
7777[case testTypeInferenceAndTypeVarValues]
7878from typing import typevar
@@ -88,7 +88,7 @@ def f(x: AB) -> AB:
8888 if y:
8989 return y.f()
9090 else:
91- return y.g() # E: Incompatible return value type
91+ return y.g() # E: Incompatible return value type: expected __main__.A*, got __main__.B
9292[out]
9393main: In function "f":
9494
@@ -98,7 +98,7 @@ T = typevar('T', values=(int, str))
9898def f(x: T) -> List[T]:
9999 return List[T]()
100100def g(x: T) -> List[T]:
101- return List[int]() # E: Incompatible return value type
101+ return List[int]() # E: Incompatible return value type: expected builtins.list[builtins.str*], got builtins.list[builtins.int*]
102102[builtins fixtures/list.py]
103103[out]
104104main: In function "g":
@@ -127,7 +127,7 @@ def g(x: T) -> T:
127127 return ''
128128def h(x: T) -> T:
129129 if isinstance(x, int):
130- return '' # E: Incompatible return value type
130+ return '' # E: Incompatible return value type: expected builtins.int*, got builtins.str
131131 return x
132132[builtins fixtures/isinstance.py]
133133[out]
@@ -143,9 +143,9 @@ def f(x: T) -> T:
143143 return ''
144144def g(x: T) -> T:
145145 if isinstance(x, int):
146- return '' # E: Incompatible return value type
146+ return '' # E: Incompatible return value type: expected builtins.int*, got builtins.str
147147 else:
148- return 2 # E: Incompatible return value type
148+ return 2 # E: Incompatible return value type: expected builtins.str*, got builtins.int
149149 return x
150150[builtins fixtures/isinstance.py]
151151[out]
@@ -170,7 +170,7 @@ def f(x: T) -> T:
170170 y = 1
171171 else:
172172 y = object()
173- return y # E: Incompatible return value type
173+ return y # E: Incompatible return value type: expected builtins.str*, got builtins.object
174174[builtins fixtures/isinstance.py]
175175[out]
176176main: In function "f":
@@ -183,7 +183,7 @@ def f(x: T) -> T:
183183 y = object()
184184 else:
185185 y = ''
186- return y # E: Incompatible return value type
186+ return y # E: Incompatible return value type: expected builtins.int*, got builtins.object
187187[builtins fixtures/isinstance.py]
188188[out]
189189main: In function "f":
0 commit comments