Skip to content

Commit 34c9c0d

Browse files
committed
fixup! specify that type variable tuple should have variance
1 parent 7a4c793 commit 34c9c0d

11 files changed

Lines changed: 104 additions & 27 deletions

conformance/results/mypy/generics_typevartuple_variance.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,11 @@ conformance_automated = "Fail"
33
errors_diff = """
44
Line 14: Expected 1 errors
55
Line 16: Expected 1 errors
6-
Line 36: Expected 1 errors
76
Line 50: Expected 1 errors
87
Line 60: Expected 1 errors
98
Line 64: Expected 1 errors
109
Line 71: Expected 1 errors
1110
Line 24: Unexpected errors ['generics_typevartuple_variance.py:24: error: Incompatible types in assignment (expression has type "ContravariantTypeVarTuple[object]", variable has type "ContravariantTypeVarTuple[int]") [assignment]']
12-
Line 34: Unexpected errors ['generics_typevartuple_variance.py:34: error: Incompatible types in assignment (expression has type "CovariantTypeVarTuple[int, object]", variable has type "CovariantTypeVarTuple[float, float]") [assignment]']
1311
Line 54: Unexpected errors ['generics_typevartuple_variance.py:54: error: Unexpected keyword argument "contravariant" for "TypeVarTuple" [misc]']
1412
Line 65: Unexpected errors ['generics_typevartuple_variance.py:65: error: Incompatible types in assignment (expression has type "ContravariantTypeVarTupleOld[object]", variable has type "ContravariantTypeVarTupleOld[int]") [assignment]']
1513
Line 68: Unexpected errors ['generics_typevartuple_variance.py:68: error: Unexpected keyword argument "covariant" for "TypeVarTuple" [misc]']
@@ -19,7 +17,9 @@ generics_typevartuple_variance.py:15: error: Incompatible types in assignment (e
1917
generics_typevartuple_variance.py:23: error: Incompatible types in assignment (expression has type "ContravariantTypeVarTuple[int]", variable has type "ContravariantTypeVarTuple[object, object]") [assignment]
2018
generics_typevartuple_variance.py:24: error: Incompatible types in assignment (expression has type "ContravariantTypeVarTuple[object]", variable has type "ContravariantTypeVarTuple[int]") [assignment]
2119
generics_typevartuple_variance.py:32: error: Incompatible types in assignment (expression has type "CovariantTypeVarTuple[object]", variable has type "CovariantTypeVarTuple[int]") [assignment]
22-
generics_typevartuple_variance.py:34: error: Incompatible types in assignment (expression has type "CovariantTypeVarTuple[int, object]", variable has type "CovariantTypeVarTuple[float, float]") [assignment]
20+
generics_typevartuple_variance.py:35: error: Incompatible types in assignment (expression has type "CovariantTypeVarTuple[int, object]", variable has type "CovariantTypeVarTuple[float, float]") [assignment]
21+
generics_typevartuple_variance.py:36: error: Incompatible types in assignment (expression has type "CovariantTypeVarTuple[object, int]", variable has type "CovariantTypeVarTuple[float, float]") [assignment]
22+
generics_typevartuple_variance.py:37: error: Incompatible types in assignment (expression has type "CovariantTypeVarTuple[object, object]", variable has type "CovariantTypeVarTuple[float, float]") [assignment]
2323
generics_typevartuple_variance.py:51: error: Incompatible types in assignment (expression has type "InvariantTypeVarTupleOld[object]", variable has type "InvariantTypeVarTupleOld[int]") [assignment]
2424
generics_typevartuple_variance.py:54: error: Unexpected keyword argument "contravariant" for "TypeVarTuple" [misc]
2525
generics_typevartuple_variance.py:65: error: Incompatible types in assignment (expression has type "ContravariantTypeVarTupleOld[object]", variable has type "ContravariantTypeVarTupleOld[int]") [assignment]
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
conformant = "Unsupported"
2+
conformance_automated = "Fail"
3+
errors_diff = """
4+
Line 40: Expected 1 errors
5+
Line 51: Expected 1 errors
6+
Line 19: Unexpected errors ['./generics_paramspec_variance.py:19:23: Traceback (most recent call last):', './generics_paramspec_variance.py:19:4: Traceback (most recent call last):']
7+
Line 22: Unexpected errors ['./generics_paramspec_variance.py:22:38: Traceback (most recent call last):']
8+
Line 31: Unexpected errors ['./generics_paramspec_variance.py:31:38: Traceback (most recent call last):']
9+
Line 45: Unexpected errors ['./generics_paramspec_variance.py:45:45: Traceback (most recent call last):']
10+
Line 58: Unexpected errors ['./generics_paramspec_variance.py:58:45: Traceback (most recent call last):']
11+
"""
12+
output = """
13+
./generics_paramspec_variance.py:14:41: Traceback (most recent call last):
14+
./generics_paramspec_variance.py:15:38: Traceback (most recent call last):
15+
./generics_paramspec_variance.py:19:23: Traceback (most recent call last):
16+
./generics_paramspec_variance.py:19:4: Traceback (most recent call last):
17+
./generics_paramspec_variance.py:21:41: Traceback (most recent call last):
18+
./generics_paramspec_variance.py:22:38: Traceback (most recent call last):
19+
./generics_paramspec_variance.py:30:35: Traceback (most recent call last):
20+
./generics_paramspec_variance.py:31:38: Traceback (most recent call last):
21+
./generics_paramspec_variance.py:44:48: Traceback (most recent call last):
22+
./generics_paramspec_variance.py:45:45: Traceback (most recent call last):
23+
./generics_paramspec_variance.py:57:42: Traceback (most recent call last):
24+
./generics_paramspec_variance.py:58:45: Traceback (most recent call last):
25+
"""

conformance/results/pycroscope/generics_typevartuple_basic.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
conformant = "Unsupported"
12
conformance_automated = "Fail"
23
errors_diff = """
34
Line 111: Expected 1 errors
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
conformant = "Unsupported"
2+
conformance_automated = "Fail"
3+
errors_diff = """
4+
Line 16: Expected 1 errors
5+
Line 60: Expected 1 errors
6+
Line 71: Expected 1 errors
7+
Line 24: Unexpected errors ['./generics_typevartuple_variance.py:24:0: Incompatible assignment: expected ./generics_typevartuple_variance.py.ContravariantTypeVarTuple[int], got ./generics_typevartuple_variance.py.ContravariantTypeVarTuple[object] [incompatible_assignment]']
8+
Line 33: Unexpected errors ['./generics_typevartuple_variance.py:33:0: Incompatible assignment: expected ./generics_typevartuple_variance.py.CovariantTypeVarTuple[object], got ./generics_typevartuple_variance.py.CovariantTypeVarTuple[int] [incompatible_assignment]']
9+
Line 34: Unexpected errors ['./generics_typevartuple_variance.py:34:0: Incompatible assignment: expected ./generics_typevartuple_variance.py.CovariantTypeVarTuple[float | int, float | int], got ./generics_typevartuple_variance.py.CovariantTypeVarTuple[int, int] [incompatible_assignment]']
10+
Line 54: Unexpected errors ["./generics_typevartuple_variance.py:54:7: Error calling (name: str, /, *, default: TypeForm[object] = <no argument given>, bound: TypeForm[object] = <no argument given>, covariant: bool = Literal[False], contravariant: bool = Literal[False], infer_variance: bool = Literal[False]) -> typing_extensions.TypeVarTuple (with impl): TypeVarTuple.__new__() got an unexpected keyword argument 'contravariant' [incompatible_call]"]
11+
Line 65: Unexpected errors ['./generics_typevartuple_variance.py:65:0: Incompatible assignment: expected ./generics_typevartuple_variance.py.ContravariantTypeVarTupleOld[int], got ./generics_typevartuple_variance.py.ContravariantTypeVarTupleOld[object] [incompatible_assignment]']
12+
Line 68: Unexpected errors ["./generics_typevartuple_variance.py:68:8: Error calling (name: str, /, *, default: TypeForm[object] = <no argument given>, bound: TypeForm[object] = <no argument given>, covariant: bool = Literal[False], contravariant: bool = Literal[False], infer_variance: bool = Literal[False]) -> typing_extensions.TypeVarTuple (with impl): TypeVarTuple.__new__() got an unexpected keyword argument 'covariant' [incompatible_call]"]
13+
Line 79: Unexpected errors ['./generics_typevartuple_variance.py:79:0: Incompatible assignment: expected ./generics_typevartuple_variance.py.CovariantTypeVarTupleOld[object], got ./generics_typevartuple_variance.py.CovariantTypeVarTupleOld[int] [incompatible_assignment]']
14+
"""
15+
output = """
16+
./generics_typevartuple_variance.py:14:0: Incompatible assignment: expected ./generics_typevartuple_variance.py.InvariantTypeVarTuple[object], got ./generics_typevartuple_variance.py.InvariantTypeVarTuple[int] [incompatible_assignment]
17+
./generics_typevartuple_variance.py:15:0: Incompatible assignment: expected ./generics_typevartuple_variance.py.InvariantTypeVarTuple[int], got ./generics_typevartuple_variance.py.InvariantTypeVarTuple[object] [incompatible_assignment]
18+
./generics_typevartuple_variance.py:23:0: Incompatible assignment: expected ./generics_typevartuple_variance.py.ContravariantTypeVarTuple[object, object], got ./generics_typevartuple_variance.py.ContravariantTypeVarTuple[int] [incompatible_assignment]
19+
./generics_typevartuple_variance.py:24:0: Incompatible assignment: expected ./generics_typevartuple_variance.py.ContravariantTypeVarTuple[int], got ./generics_typevartuple_variance.py.ContravariantTypeVarTuple[object] [incompatible_assignment]
20+
./generics_typevartuple_variance.py:32:0: Incompatible assignment: expected ./generics_typevartuple_variance.py.CovariantTypeVarTuple[int], got ./generics_typevartuple_variance.py.CovariantTypeVarTuple[object] [incompatible_assignment]
21+
./generics_typevartuple_variance.py:33:0: Incompatible assignment: expected ./generics_typevartuple_variance.py.CovariantTypeVarTuple[object], got ./generics_typevartuple_variance.py.CovariantTypeVarTuple[int] [incompatible_assignment]
22+
./generics_typevartuple_variance.py:34:0: Incompatible assignment: expected ./generics_typevartuple_variance.py.CovariantTypeVarTuple[float | int, float | int], got ./generics_typevartuple_variance.py.CovariantTypeVarTuple[int, int] [incompatible_assignment]
23+
./generics_typevartuple_variance.py:35:0: Incompatible assignment: expected ./generics_typevartuple_variance.py.CovariantTypeVarTuple[float | int, float | int], got ./generics_typevartuple_variance.py.CovariantTypeVarTuple[int, object] [incompatible_assignment]
24+
./generics_typevartuple_variance.py:36:0: Incompatible assignment: expected ./generics_typevartuple_variance.py.CovariantTypeVarTuple[float | int, float | int], got ./generics_typevartuple_variance.py.CovariantTypeVarTuple[object, int] [incompatible_assignment]
25+
./generics_typevartuple_variance.py:37:0: Incompatible assignment: expected ./generics_typevartuple_variance.py.CovariantTypeVarTuple[float | int, float | int], got ./generics_typevartuple_variance.py.CovariantTypeVarTuple[object, object] [incompatible_assignment]
26+
./generics_typevartuple_variance.py:50:0: Incompatible assignment: expected ./generics_typevartuple_variance.py.InvariantTypeVarTupleOld[object], got ./generics_typevartuple_variance.py.InvariantTypeVarTupleOld[int] [incompatible_assignment]
27+
./generics_typevartuple_variance.py:51:0: Incompatible assignment: expected ./generics_typevartuple_variance.py.InvariantTypeVarTupleOld[int], got ./generics_typevartuple_variance.py.InvariantTypeVarTupleOld[object] [incompatible_assignment]
28+
./generics_typevartuple_variance.py:54:7: Error calling (name: str, /, *, default: TypeForm[object] = <no argument given>, bound: TypeForm[object] = <no argument given>, covariant: bool = Literal[False], contravariant: bool = Literal[False], infer_variance: bool = Literal[False]) -> typing_extensions.TypeVarTuple (with impl): TypeVarTuple.__new__() got an unexpected keyword argument 'contravariant' [incompatible_call]
29+
./generics_typevartuple_variance.py:64:0: Incompatible assignment: expected ./generics_typevartuple_variance.py.ContravariantTypeVarTupleOld[object], got ./generics_typevartuple_variance.py.ContravariantTypeVarTupleOld[int] [incompatible_assignment]
30+
./generics_typevartuple_variance.py:65:0: Incompatible assignment: expected ./generics_typevartuple_variance.py.ContravariantTypeVarTupleOld[int], got ./generics_typevartuple_variance.py.ContravariantTypeVarTupleOld[object] [incompatible_assignment]
31+
./generics_typevartuple_variance.py:68:8: Error calling (name: str, /, *, default: TypeForm[object] = <no argument given>, bound: TypeForm[object] = <no argument given>, covariant: bool = Literal[False], contravariant: bool = Literal[False], infer_variance: bool = Literal[False]) -> typing_extensions.TypeVarTuple (with impl): TypeVarTuple.__new__() got an unexpected keyword argument 'covariant' [incompatible_call]
32+
./generics_typevartuple_variance.py:78:0: Incompatible assignment: expected ./generics_typevartuple_variance.py.CovariantTypeVarTupleOld[int], got ./generics_typevartuple_variance.py.CovariantTypeVarTupleOld[object] [incompatible_assignment]
33+
./generics_typevartuple_variance.py:79:0: Incompatible assignment: expected ./generics_typevartuple_variance.py.CovariantTypeVarTupleOld[object], got ./generics_typevartuple_variance.py.CovariantTypeVarTupleOld[int] [incompatible_assignment]
34+
"""

conformance/results/pyrefly/generics_typevartuple_variance.toml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@ conformant = "Unsupported"
22
conformance_automated = "Fail"
33
errors_diff = """
44
Line 16: Expected 1 errors
5-
Line 36: Expected 1 errors
65
Line 60: Expected 1 errors
76
Line 71: Expected 1 errors
87
Line 24: Unexpected errors ['`ContravariantTypeVarTuple[object]` is not assignable to `ContravariantTypeVarTuple[int]` [bad-assignment]']
98
Line 33: Unexpected errors ['`CovariantTypeVarTuple[int]` is not assignable to `CovariantTypeVarTuple[object]` [bad-assignment]']
10-
Line 34: Unexpected errors ['4: `CovariantTypeVarTuple[int, object]` is not assignable to `CovariantTypeVarTuple[float, float]` [bad-assignment]']
9+
Line 34: Unexpected errors ['`CovariantTypeVarTuple[int, int]` is not assignable to `CovariantTypeVarTuple[float, float]` [bad-assignment]']
1110
Line 54: Unexpected errors ['Unexpected keyword argument `contravariant` to TypeVarTuple [invalid-type-var-tuple]']
1211
Line 65: Unexpected errors ['`ContravariantTypeVarTupleOld[object]` is not assignable to `ContravariantTypeVarTupleOld[int]` [bad-assignment]']
1312
Line 68: Unexpected errors ['Unexpected keyword argument `covariant` to TypeVarTuple [invalid-type-var-tuple]']
@@ -20,7 +19,10 @@ ERROR generics_typevartuple_variance.py:23:53-85: `ContravariantTypeVarTuple[int
2019
ERROR generics_typevartuple_variance.py:24:42-77: `ContravariantTypeVarTuple[object]` is not assignable to `ContravariantTypeVarTuple[int]` [bad-assignment]
2120
ERROR generics_typevartuple_variance.py:32:39-70: `CovariantTypeVarTuple[object]` is not assignable to `CovariantTypeVarTuple[int]` [bad-assignment]
2221
ERROR generics_typevartuple_variance.py:33:42-70: `CovariantTypeVarTuple[int]` is not assignable to `CovariantTypeVarTuple[object]` [bad-assignment]
23-
ERROR generics_typevartuple_variance.py:34:53-37:4: `CovariantTypeVarTuple[int, object]` is not assignable to `CovariantTypeVarTuple[float, float]` [bad-assignment]
22+
ERROR generics_typevartuple_variance.py:34:54-88: `CovariantTypeVarTuple[int, int]` is not assignable to `CovariantTypeVarTuple[float, float]` [bad-assignment]
23+
ERROR generics_typevartuple_variance.py:35:54-91: `CovariantTypeVarTuple[int, object]` is not assignable to `CovariantTypeVarTuple[float, float]` [bad-assignment]
24+
ERROR generics_typevartuple_variance.py:36:54-91: `CovariantTypeVarTuple[object, int]` is not assignable to `CovariantTypeVarTuple[float, float]` [bad-assignment]
25+
ERROR generics_typevartuple_variance.py:37:54-94: `CovariantTypeVarTuple[object, object]` is not assignable to `CovariantTypeVarTuple[float, float]` [bad-assignment]
2426
ERROR generics_typevartuple_variance.py:50:45-76: `InvariantTypeVarTupleOld[int]` is not assignable to `InvariantTypeVarTupleOld[object]` [bad-assignment]
2527
ERROR generics_typevartuple_variance.py:51:42-76: `InvariantTypeVarTupleOld[object]` is not assignable to `InvariantTypeVarTupleOld[int]` [bad-assignment]
2628
ERROR generics_typevartuple_variance.py:54:29-47: Unexpected keyword argument `contravariant` to TypeVarTuple [invalid-type-var-tuple]

conformance/results/pyright/generics_typevartuple_variance.toml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@ conformant = "Unsupported"
22
conformance_automated = "Fail"
33
errors_diff = """
44
Line 16: Expected 1 errors
5-
Line 36: Expected 1 errors
65
Line 60: Expected 1 errors
76
Line 71: Expected 1 errors
87
Line 24: Unexpected errors ['generics_typevartuple_variance.py:24:42 - error: Type "ContravariantTypeVarTuple[object]" is not assignable to declared type "ContravariantTypeVarTuple[int]"']
98
Line 33: Unexpected errors ['generics_typevartuple_variance.py:33:42 - error: Type "CovariantTypeVarTuple[int]" is not assignable to declared type "CovariantTypeVarTuple[object]"']
10-
Line 34: Unexpected errors ['generics_typevartuple_variance.py:34:53 - error: Type "CovariantTypeVarTuple[int, object]" is not assignable to declared type "CovariantTypeVarTuple[float, float]"']
9+
Line 34: Unexpected errors ['generics_typevartuple_variance.py:34:54 - error: Type "CovariantTypeVarTuple[int, int]" is not assignable to declared type "CovariantTypeVarTuple[float, float]"']
1110
Line 43: Unexpected errors ['generics_typevartuple_variance.py:43:27 - error: Unpack operator not allowed in type expression (reportInvalidTypeForm)', 'generics_typevartuple_variance.py:43:28 - error: "InTs" is not defined (reportUndefinedVariable)']
1211
Line 46: Unexpected errors ['generics_typevartuple_variance.py:46:31 - error: "InTs" is not defined (reportUndefinedVariable)', 'generics_typevartuple_variance.py:46:31 - error: Unpack is not allowed in this context (reportInvalidTypeForm)']
1312
Line 54: Unexpected errors ['generics_typevartuple_variance.py:54:29 - error: "contravariant" is unknown parameter to TypeVarTuple (reportGeneralTypeIssues)']
@@ -34,9 +33,18 @@ generics_typevartuple_variance.py:32:39 - error: Type "CovariantTypeVarTuple[obj
3433
generics_typevartuple_variance.py:33:42 - error: Type "CovariantTypeVarTuple[int]" is not assignable to declared type "CovariantTypeVarTuple[object]"
3534
  "CovariantTypeVarTuple[int]" is not assignable to "CovariantTypeVarTuple[object]"
3635
    Type parameter "OutTs@CovariantTypeVarTuple" is invariant, but "*tuple[int]" is not the same as "*tuple[object]" (reportAssignmentType)
37-
generics_typevartuple_variance.py:34:53 - error: Type "CovariantTypeVarTuple[int, object]" is not assignable to declared type "CovariantTypeVarTuple[float, float]"
36+
generics_typevartuple_variance.py:34:54 - error: Type "CovariantTypeVarTuple[int, int]" is not assignable to declared type "CovariantTypeVarTuple[float, float]"
37+
  "CovariantTypeVarTuple[int, int]" is not assignable to "CovariantTypeVarTuple[float, float]"
38+
    Type parameter "OutTs@CovariantTypeVarTuple" is invariant, but "*tuple[int, int]" is not the same as "*tuple[float, float]" (reportAssignmentType)
39+
generics_typevartuple_variance.py:35:54 - error: Type "CovariantTypeVarTuple[int, object]" is not assignable to declared type "CovariantTypeVarTuple[float, float]"
3840
  "CovariantTypeVarTuple[int, object]" is not assignable to "CovariantTypeVarTuple[float, float]"
3941
    Type parameter "OutTs@CovariantTypeVarTuple" is invariant, but "*tuple[int, object]" is not the same as "*tuple[float, float]" (reportAssignmentType)
42+
generics_typevartuple_variance.py:36:54 - error: Type "CovariantTypeVarTuple[object, int]" is not assignable to declared type "CovariantTypeVarTuple[float, float]"
43+
  "CovariantTypeVarTuple[object, int]" is not assignable to "CovariantTypeVarTuple[float, float]"
44+
    Type parameter "OutTs@CovariantTypeVarTuple" is invariant, but "*tuple[object, int]" is not the same as "*tuple[float, float]" (reportAssignmentType)
45+
generics_typevartuple_variance.py:37:54 - error: Type "CovariantTypeVarTuple[object, object]" is not assignable to declared type "CovariantTypeVarTuple[float, float]"
46+
  "CovariantTypeVarTuple[object, object]" is not assignable to "CovariantTypeVarTuple[float, float]"
47+
    Type parameter "OutTs@CovariantTypeVarTuple" is invariant, but "*tuple[object, object]" is not the same as "*tuple[float, float]" (reportAssignmentType)
4048
generics_typevartuple_variance.py:43:27 - error: Unpack operator not allowed in type expression (reportInvalidTypeForm)
4149
generics_typevartuple_variance.py:43:28 - error: "InTs" is not defined (reportUndefinedVariable)
4250
generics_typevartuple_variance.py:46:31 - error: "InTs" is not defined (reportUndefinedVariable)

0 commit comments

Comments
 (0)