@@ -143,7 +143,7 @@ t3 = None # type: Tuple[A, B]
143143a, b, c = None, None, None # type: (A, B, C)
144144
145145if int():
146- t2 = () # E: Incompatible types in assignment (expression has type "Tuple[]", variable has type "Tuple[A]")
146+ t2 = () # E: Incompatible types in assignment (expression has type "Tuple[() ]", variable has type "Tuple[A]")
147147if int():
148148 t2 = (a, a) # E: Incompatible types in assignment (expression has type "Tuple[A, A]", variable has type "Tuple[A]")
149149if int():
@@ -1244,9 +1244,9 @@ f(0) # E: Argument 1 to "f" has incompatible type "int"; expected "Tuple[Any, .
12441244from typing import Tuple
12451245def f(a: Tuple[()]) -> None: pass
12461246f(())
1247- f((1,)) # E: Argument 1 to "f" has incompatible type "Tuple[int]"; expected "Tuple[]"
1248- f(('', '')) # E: Argument 1 to "f" has incompatible type "Tuple[str, str]"; expected "Tuple[]"
1249- f(0) # E: Argument 1 to "f" has incompatible type "int"; expected "Tuple[]"
1247+ f((1,)) # E: Argument 1 to "f" has incompatible type "Tuple[int]"; expected "Tuple[() ]"
1248+ f(('', '')) # E: Argument 1 to "f" has incompatible type "Tuple[str, str]"; expected "Tuple[() ]"
1249+ f(0) # E: Argument 1 to "f" has incompatible type "int"; expected "Tuple[() ]"
12501250[builtins fixtures/tuple.pyi]
12511251
12521252[case testNonliteralTupleIndex]
@@ -1467,20 +1467,29 @@ from typing import Tuple
14671467t = ('',) * 2
14681468reveal_type(t) # N: Revealed type is "Tuple[builtins.str, builtins.str]"
14691469t2 = ('',) * -1
1470- reveal_type(t2) # N: Revealed type is "Tuple[]"
1470+ reveal_type(t2) # N: Revealed type is "Tuple[() ]"
14711471t3 = ('', 1) * 2
14721472reveal_type(t3) # N: Revealed type is "Tuple[builtins.str, builtins.int, builtins.str, builtins.int]"
14731473def f() -> Tuple[str, ...]:
14741474 return ('', )
14751475reveal_type(f() * 2) # N: Revealed type is "builtins.tuple[builtins.str, ...]"
14761476[builtins fixtures/tuple.pyi]
14771477
1478+ [case testEmptyTupleTypeRepr]
1479+ from typing import Tuple
1480+
1481+ def f() -> Tuple[()]: ...
1482+
1483+ reveal_type(f) # N: Revealed type is "def () -> Tuple[()]"
1484+ reveal_type(f()) # N: Revealed type is "Tuple[()]"
1485+ [builtins fixtures/tuple.pyi]
1486+
14781487[case testMultiplyTupleByIntegerLiteralReverse]
14791488from typing import Tuple
14801489t = 2 * ('',)
14811490reveal_type(t) # N: Revealed type is "Tuple[builtins.str, builtins.str]"
14821491t2 = -1 * ('',)
1483- reveal_type(t2) # N: Revealed type is "Tuple[]"
1492+ reveal_type(t2) # N: Revealed type is "Tuple[() ]"
14841493t3 = 2 * ('', 1)
14851494reveal_type(t3) # N: Revealed type is "Tuple[builtins.str, builtins.int, builtins.str, builtins.int]"
14861495def f() -> Tuple[str, ...]:
0 commit comments