You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
spec: do not mandate inference details around TypeVarTuple (#2203)
I don't think this case should error; a type checker can solve Ts
to something like (object,) or (int | str,). This is not all that
different from the first call to func4(), where the two calls with (0,)
and (1,) lead to Ts being solved to a common supertype.
Does not enforce that tuples captured by TypeVarTuple are same length.
4
-
Does not enforce that tuples captured by TypeVarTuple are same type.
5
4
"""
6
5
output = """
7
6
generics_typevartuple_basic.py:42: error: Argument 1 to "Array" has incompatible type "Height"; expected "tuple[Height, Width]" [arg-type]
@@ -10,7 +9,6 @@ generics_typevartuple_basic.py:45: error: Argument 1 to "Array" has incompatible
10
9
generics_typevartuple_basic.py:52: error: Free type variable expected in Generic[...] [misc]
11
10
generics_typevartuple_basic.py:53: error: TypeVarTuple "Shape" is only valid with an unpack [valid-type]
12
11
generics_typevartuple_basic.py:56: error: TypeVarTuple "Shape" is only valid with an unpack [valid-type]
13
-
generics_typevartuple_basic.py:57: error: Incompatible return value type (got "tuple[*Shape]", expected "tuple[Any]") [return-value]
14
12
generics_typevartuple_basic.py:59: error: TypeVarTuple "Shape" is only valid with an unpack [valid-type]
15
13
generics_typevartuple_basic.py:65: error: Unexpected keyword argument "covariant" for "TypeVarTuple" [misc]
16
14
generics_typevartuple_basic.py:66: error: Too many positional arguments for "TypeVarTuple" [misc]
@@ -21,7 +19,5 @@ generics_typevartuple_basic.py:106: error: Can only use one type var tuple in a
21
19
"""
22
20
conformance_automated = "Fail"
23
21
errors_diff = """
24
-
Line 89: Expected 1 errors
25
22
Line 90: Expected 1 errors
26
-
Line 57: Unexpected errors ['generics_typevartuple_basic.py:57: error: Incompatible return value type (got "tuple[*Shape]", expected "tuple[Any]") [return-value]']
Copy file name to clipboardExpand all lines: conformance/results/pyrefly/generics_typevartuple_args.toml
+6-2Lines changed: 6 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,10 @@
1
-
conformant = "Pass"
2
-
conformance_automated = "Pass"
1
+
conformant = "Partial"
2
+
conformance_automated = "Fail"
3
+
notes = """
4
+
Does not correctly solve TypeVarTuple with heterogeneous bounds.
5
+
"""
3
6
errors_diff = """
7
+
Line 76: Unexpected errors ["Argument `tuple[Literal['1']]` is not assignable to parameter `*args` with type `tuple[int]` in function `func4` [bad-argument-type]"]
4
8
"""
5
9
output = """
6
10
ERROR generics_typevartuple_args.py:33:12-23: Unpacked argument `tuple[Literal[0], Literal['']]` is not assignable to parameter `*args` with type `tuple[*@_, Env]` in function `exec_le` [bad-argument-type]
Copy file name to clipboardExpand all lines: conformance/results/pyrefly/generics_typevartuple_basic.toml
+2-1Lines changed: 2 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,11 @@
1
1
conformant = "Partial"
2
2
notes = """
3
-
TypeVarTuple is pinned too early when calling generic function
3
+
TypeVarTuple is pinned too early when calling generic function.
4
4
"""
5
5
conformance_automated = "Fail"
6
6
errors_diff = """
7
7
Line 85: Unexpected errors ['Argument `tuple[float]` is not assignable to parameter `arg2` with type `tuple[int]` in function `func2` [bad-argument-type]']
8
+
Line 89: Unexpected errors ["Argument `tuple[Literal['0']]` is not assignable to parameter `arg2` with type `tuple[int]` in function `func2` [bad-argument-type]"]
8
9
"""
9
10
output = """
10
11
ERROR generics_typevartuple_basic.py:42:34-43: Argument `Height` is not assignable to parameter `shape` with type `tuple[Height, Width]` in function `Array.__init__` [bad-argument-type]
Copy file name to clipboardExpand all lines: conformance/results/pyright/generics_typevartuple_args.toml
+8-4Lines changed: 8 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,11 @@
1
-
conformant = "Pass"
1
+
conformant = "Partial"
2
+
notes = """
3
+
Does not correctly solve TypeVarTuple with heterogeneous bounds.
4
+
"""
5
+
conformance_automated = "Fail"
6
+
errors_diff = """
7
+
Line 76: Unexpected errors ['generics_typevartuple_args.py:76:14 - error: Argument of type "tuple[Literal[\\'1\\']]" cannot be assigned to parameter "args" of type "tuple[*Ts@func4]" in function "func4"']
8
+
"""
2
9
output = """
3
10
generics_typevartuple_args.py:33:20 - error: Argument of type "Literal['']" cannot be assigned to parameter of type "Env" in function "exec_le"
4
11
"Literal['']" is not assignable to "Env" (reportArgumentType)
@@ -17,6 +24,3 @@ generics_typevartuple_args.py:75:13 - error: Argument of type "tuple[Literal[1],
17
24
generics_typevartuple_args.py:76:14 - error: Argument of type "tuple[Literal['1']]" cannot be assigned to parameter "args" of type "tuple[*Ts@func4]" in function "func4"
18
25
"Literal['1']" is not assignable to "int" (reportArgumentType)
Copy file name to clipboardExpand all lines: conformance/results/pyright/generics_typevartuple_basic.toml
+8-4Lines changed: 8 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,11 @@
1
-
conformant = "Pass"
1
+
conformant = "Partial"
2
+
notes = """
3
+
Does not correctly solve TypeVarTuple with heterogeneous bounds.
4
+
"""
5
+
conformance_automated = "Fail"
6
+
errors_diff = """
7
+
Line 89: Unexpected errors ['generics_typevartuple_basic.py:89:14 - error: Argument of type "tuple[Literal[\\'0\\']]" cannot be assigned to parameter "arg2" of type "tuple[*Ts@func2]" in function "func2"']
8
+
"""
2
9
output = """
3
10
generics_typevartuple_basic.py:42:34 - error: Argument of type "Height" cannot be assigned to parameter "shape" of type "tuple[*Shape@Array]" in function "__init__"
4
11
"Height" is not assignable to "tuple[*Shape@Array]" (reportArgumentType)
@@ -30,6 +37,3 @@ generics_typevartuple_basic.py:100:17 - error: Argument of type "Array[Height, W
30
37
generics_typevartuple_basic.py:106:14 - error: Generic class can have at most one TypeVarTuple type parameter but received multiple ("Ts1", "Ts2") (reportGeneralTypeIssues)
31
38
generics_typevartuple_basic.py:106:29 - error: Type argument list can have at most one unpacked TypeVarTuple or tuple (reportInvalidTypeForm)
Copy file name to clipboardExpand all lines: conformance/results/results.html
+8-8Lines changed: 8 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -413,17 +413,17 @@ <h3>Python Type System Conformance Test Results</h3>
413
413
<thclass="column col2 partially-conformant"><divclass="hover-text">Partial<spanclass="tooltip-text" id="bottom"><p>Does not reject access of generic instance variable from the class object.</p></span></div></th>
<thclass="column col2 partially-conformant"><divclass="hover-text">Partial<spanclass="tooltip-text" id="bottom"><p>Does not enforce that tuples captured by TypeVarTuple are same type.</p></span></div></th>
417
-
<thclass="column col2 conformant">Pass</th>
418
-
<thclass="column col2 conformant">Pass</th>
419
-
<thclass="column col2 conformant">Pass</th>
416
+
<thclass="column col2 partially-conformant"><divclass="hover-text">Partial<spanclass="tooltip-text" id="bottom"><p>Does not enforce that tuples captured by TypeVarTuple are of the same length.</p></span></div></th>
417
+
<thclass="column col2 partially-conformant"><divclass="hover-text">Partial<spanclass="tooltip-text" id="bottom"><p>Does not correctly solve TypeVarTuple with heterogeneous bounds.</p></span></div></th>
418
+
<thclass="column col2 partially-conformant"><divclass="hover-text">Partial<spanclass="tooltip-text" id="bottom"><p>Does not correctly solve TypeVarTuple with heterogeneous bounds.</p></span></div></th>
419
+
<thclass="column col2 partially-conformant"><divclass="hover-text">Partial<spanclass="tooltip-text" id="bottom"><p>Does not correctly solve TypeVarTuple with heterogeneous bounds.</p></span></div></th>
420
420
<thclass="column col2 partially-conformant"><divclass="hover-text">Partial<spanclass="tooltip-text" id="bottom"><p>Supports PEP-646 unpacked tuples but not TypeVarTuple.</p></span></div></th>
<thclass="column col2 partially-conformant"><divclass="hover-text">Partial<spanclass="tooltip-text" id="bottom"><p>Does not enforce that tuples captured by TypeVarTuple are same length.</p><p>Does not enforce that tuples captured by TypeVarTuple are same type.</p></span></div></th>
424
-
<thclass="column col2 conformant">Pass</th>
425
-
<thclass="column col2 conformant">Pass</th>
426
-
<thclass="column col2 partially-conformant"><divclass="hover-text">Partial<spanclass="tooltip-text" id="bottom"><p>TypeVarTuple is pinned too early when calling generic function</p></span></div></th>
423
+
<thclass="column col2 partially-conformant"><divclass="hover-text">Partial<spanclass="tooltip-text" id="bottom"><p>Does not enforce that tuples captured by TypeVarTuple are same length.</p></span></div></th>
424
+
<thclass="column col2 partially-conformant"><divclass="hover-text">Partial<spanclass="tooltip-text" id="bottom"><p>Does not correctly solve TypeVarTuple with heterogeneous bounds.</p></span></div></th>
425
+
<thclass="column col2 partially-conformant"><divclass="hover-text">Partial<spanclass="tooltip-text" id="bottom"><p>Does not correctly solve TypeVarTuple with heterogeneous bounds.</p></span></div></th>
426
+
<thclass="column col2 partially-conformant"><divclass="hover-text">Partial<spanclass="tooltip-text" id="bottom"><p>TypeVarTuple is pinned too early when calling generic function.</p></span></div></th>
Copy file name to clipboardExpand all lines: conformance/results/ty/generics_typevartuple_args.toml
-1Lines changed: 0 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,6 @@ Line 58: Expected 1 errors
12
12
Line 59: Expected 1 errors
13
13
Line 67: Expected 1 errors
14
14
Line 75: Expected 1 errors
15
-
Line 76: Expected 1 errors
16
15
Line 29: Unexpected errors ['generics_typevartuple_args.py:29:5: error[type-assertion-failure] Type `tuple[@Todo(TypeVarTuple), ...]` does not match asserted type `tuple[int, str]`']
17
16
Line 31: Unexpected errors ['generics_typevartuple_args.py:31:5: error[type-assertion-failure] Type `tuple[@Todo(TypeVarTuple), ...]` does not match asserted type `tuple[()]`']
18
17
Line 32: Unexpected errors ['generics_typevartuple_args.py:32:5: error[type-assertion-failure] Type `tuple[@Todo(TypeVarTuple), ...]` does not match asserted type `tuple[int, str]`']
Copy file name to clipboardExpand all lines: conformance/results/zuban/generics_typevartuple_args.toml
+6-1Lines changed: 6 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,10 @@
1
-
conformance_automated = "Pass"
1
+
conformant = "Partial"
2
+
notes = """
3
+
Does not correctly solve TypeVarTuple with heterogeneous bounds.
4
+
"""
5
+
conformance_automated = "Fail"
2
6
errors_diff = """
7
+
Line 76: Unexpected errors ['generics_typevartuple_args.py:76: error: Argument 2 to "func4" has incompatible type "tuple[Literal[\\'1\\']]"; expected "tuple[int]" [arg-type]']
3
8
"""
4
9
output = """
5
10
generics_typevartuple_args.py:33: error: Argument 3 to "exec_le" has incompatible type "str"; expected "Env" [arg-type]
0 commit comments