Skip to content

Commit cd8e1bd

Browse files
committed
Merge branch 'main' into alex/protocol-classvar-conformance
2 parents 7ab5fee + 97b98ba commit cd8e1bd

47 files changed

Lines changed: 1433 additions & 185 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

conformance/pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ dependencies = [
1212
"tomlkit",
1313
"ty",
1414
"types-markdown",
15+
"typing-extensions>=4.16.0",
1516
"zuban",
1617
]
1718

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
conformant = "Pass"
2+
conformance_automated = "Pass"
3+
errors_diff = """
4+
"""
5+
output = """
6+
generics_mixed_variance_inference.py:13: error: Incompatible types in assignment (expression has type "Mixed[bool, []]", variable has type "Mixed[int, []]") [assignment]
7+
generics_mixed_variance_inference.py:16: error: Incompatible types in assignment (expression has type "Mixed[int, object, []]", variable has type "Mixed[int, int, []]") [assignment]
8+
generics_mixed_variance_inference.py:21: error: Incompatible types in assignment (expression has type "Mixed[int, [bool]]", variable has type "Mixed[int, [int]]") [assignment]
9+
"""
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
conformant = "Unsupported"
2+
conformance_automated = "Fail"
3+
errors_diff = """
4+
Line 15: Expected 1 errors
5+
Line 30: Expected 1 errors
6+
Line 90: Expected 1 errors
7+
Line 111: Expected 1 errors
8+
Line 117: Expected 1 errors
9+
Line 126: Expected 1 errors
10+
Line 132: Expected 1 errors
11+
Line 151: Expected 1 errors
12+
Line 31: Unexpected errors ['generics_paramspec_variance.py:31: error: Incompatible types in assignment (expression has type "CovariantParamSpec[[int]]", variable has type "CovariantParamSpec[[object]]") [assignment]']
13+
Line 84: Unexpected errors ['generics_paramspec_variance.py:84: error: Incompatible types in assignment (expression has type "OutitP[[NamedArg(int, \\'a\\')]]", variable has type "OutitP[[int]]") [assignment]']
14+
Line 86: Unexpected errors ['generics_paramspec_variance.py:86: error: Incompatible types in assignment (expression has type "OutitP[[int]]", variable has type "OutitP[[Arg(int, \\'a\\')]]") [assignment]']
15+
Line 97: Unexpected errors ['generics_paramspec_variance.py:97: error: The variance and bound arguments to ParamSpec do not have defined semantics yet [misc]']
16+
Line 98: Unexpected errors ['generics_paramspec_variance.py:98: error: The variance and bound arguments to ParamSpec do not have defined semantics yet [misc]']
17+
Line 99: Unexpected errors ['generics_paramspec_variance.py:99: error: The variance and bound arguments to ParamSpec do not have defined semantics yet [misc]']
18+
Line 133: Unexpected errors ['generics_paramspec_variance.py:133: error: Incompatible types in assignment (expression has type "CovariantParamSpecOld[[int]]", variable has type "CovariantParamSpecOld[[object]]") [assignment]']
19+
Line 152: Unexpected errors ['generics_paramspec_variance.py:152: error: Incompatible types in assignment (expression has type "InferredCovariantParamSpecOld[[int]]", variable has type "InferredCovariantParamSpecOld[[object]]") [assignment]']
20+
"""
21+
output = """
22+
generics_paramspec_variance.py:14: error: Incompatible types in assignment (expression has type "InvariantParamSpec[[int]]", variable has type "InvariantParamSpec[[object]]") [assignment]
23+
generics_paramspec_variance.py:21: error: Incompatible types in assignment (expression has type "ContravariantParamSpec[[int]]", variable has type "ContravariantParamSpec[[object]]") [assignment]
24+
generics_paramspec_variance.py:31: error: Incompatible types in assignment (expression has type "CovariantParamSpec[[int]]", variable has type "CovariantParamSpec[[object]]") [assignment]
25+
generics_paramspec_variance.py:61: error: Incompatible types in assignment (expression has type "InitP[[NamedArg(int, 'a')]]", variable has type "InitP[[int]]") [assignment]
26+
generics_paramspec_variance.py:63: error: Incompatible types in assignment (expression has type "InitP[[int]]", variable has type "InitP[[Arg(int, 'a')]]") [assignment]
27+
generics_paramspec_variance.py:65: error: Incompatible types in assignment (expression has type "InitP[[Arg(int, 'b')]]", variable has type "InitP[[Arg(int, 'a')]]") [assignment]
28+
generics_paramspec_variance.py:69: error: Incompatible types in assignment (expression has type "InitP[[int, str]]", variable has type "InitP[[int]]") [assignment]
29+
generics_paramspec_variance.py:84: error: Incompatible types in assignment (expression has type "OutitP[[NamedArg(int, 'a')]]", variable has type "OutitP[[int]]") [assignment]
30+
generics_paramspec_variance.py:86: error: Incompatible types in assignment (expression has type "OutitP[[int]]", variable has type "OutitP[[Arg(int, 'a')]]") [assignment]
31+
generics_paramspec_variance.py:88: error: Incompatible types in assignment (expression has type "OutitP[[Arg(int, 'b')]]", variable has type "OutitP[[Arg(int, 'a')]]") [assignment]
32+
generics_paramspec_variance.py:92: error: Incompatible types in assignment (expression has type "OutitP[[int, str]]", variable has type "OutitP[[int]]") [assignment]
33+
generics_paramspec_variance.py:97: error: The variance and bound arguments to ParamSpec do not have defined semantics yet [misc]
34+
generics_paramspec_variance.py:98: error: The variance and bound arguments to ParamSpec do not have defined semantics yet [misc]
35+
generics_paramspec_variance.py:99: error: The variance and bound arguments to ParamSpec do not have defined semantics yet [misc]
36+
generics_paramspec_variance.py:100: error: The variance and bound arguments to ParamSpec do not have defined semantics yet [misc]
37+
generics_paramspec_variance.py:101: error: The variance and bound arguments to ParamSpec do not have defined semantics yet [misc]
38+
generics_paramspec_variance.py:102: error: The variance and bound arguments to ParamSpec do not have defined semantics yet [misc]
39+
generics_paramspec_variance.py:110: error: Incompatible types in assignment (expression has type "InvariantParamSpecOld[[bool]]", variable has type "InvariantParamSpecOld[[int]]") [assignment]
40+
generics_paramspec_variance.py:121: error: Incompatible types in assignment (expression has type "ContravariantParamSpecOld[[int]]", variable has type "ContravariantParamSpecOld[[object]]") [assignment]
41+
generics_paramspec_variance.py:133: error: Incompatible types in assignment (expression has type "CovariantParamSpecOld[[int]]", variable has type "CovariantParamSpecOld[[object]]") [assignment]
42+
generics_paramspec_variance.py:142: error: Incompatible types in assignment (expression has type "InferredContravariantParamSpecOld[[int]]", variable has type "InferredContravariantParamSpecOld[[object]]") [assignment]
43+
generics_paramspec_variance.py:152: error: Incompatible types in assignment (expression has type "InferredCovariantParamSpecOld[[int]]", variable has type "InferredCovariantParamSpecOld[[object]]") [assignment]
44+
"""

conformance/results/mypy/generics_typevartuple_basic.toml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,19 @@ notes = """
33
Does not enforce that tuples captured by `TypeVarTuple` are same length.
44
"""
55
output = """
6-
generics_typevartuple_basic.py:42: error: Argument 1 to "Array" has incompatible type "Height"; expected "tuple[Height, Width]" [arg-type]
7-
generics_typevartuple_basic.py:43: error: Argument 1 to "Array" has incompatible type "tuple[Batch, Width]"; expected "tuple[Batch, Height, Width]" [arg-type]
8-
generics_typevartuple_basic.py:45: error: Argument 1 to "Array" has incompatible type "tuple[Time, Batch, Width, Height]"; expected "tuple[Time, Batch, Height, Width]" [arg-type]
9-
generics_typevartuple_basic.py:52: error: Free type variable expected in Generic[...] [misc]
10-
generics_typevartuple_basic.py:53: error: TypeVarTuple "Shape" is only valid with an unpack [valid-type]
11-
generics_typevartuple_basic.py:56: error: TypeVarTuple "Shape" is only valid with an unpack [valid-type]
12-
generics_typevartuple_basic.py:59: error: TypeVarTuple "Shape" is only valid with an unpack [valid-type]
13-
generics_typevartuple_basic.py:65: error: Unexpected keyword argument "covariant" for "TypeVarTuple" [misc]
6+
generics_typevartuple_basic.py:43: error: Argument 1 to "Array" has incompatible type "Height"; expected "tuple[Height, Width]" [arg-type]
7+
generics_typevartuple_basic.py:44: error: Argument 1 to "Array" has incompatible type "tuple[Batch, Width]"; expected "tuple[Batch, Height, Width]" [arg-type]
8+
generics_typevartuple_basic.py:46: error: Argument 1 to "Array" has incompatible type "tuple[Time, Batch, Width, Height]"; expected "tuple[Time, Batch, Height, Width]" [arg-type]
9+
generics_typevartuple_basic.py:53: error: Free type variable expected in Generic[...] [misc]
10+
generics_typevartuple_basic.py:54: error: TypeVarTuple "Shape" is only valid with an unpack [valid-type]
11+
generics_typevartuple_basic.py:57: error: TypeVarTuple "Shape" is only valid with an unpack [valid-type]
12+
generics_typevartuple_basic.py:60: error: TypeVarTuple "Shape" is only valid with an unpack [valid-type]
1413
generics_typevartuple_basic.py:66: error: Too many positional arguments for "TypeVarTuple" [misc]
1514
generics_typevartuple_basic.py:67: error: Unexpected keyword argument "bound" for "TypeVarTuple" [misc]
1615
generics_typevartuple_basic.py:100: error: Cannot infer value of type parameter "Shape" of "multiply" [misc]
1716
generics_typevartuple_basic.py:101: error: Cannot infer value of type parameter "Shape" of "multiply" [misc]
1817
generics_typevartuple_basic.py:107: error: Can only use one type var tuple in a class def [misc]
18+
generics_typevartuple_basic.py:111: error: Can only use one type var tuple in a class def [misc]
1919
"""
2020
conformance_automated = "Fail"
2121
errors_diff = """
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
conformant = "Unsupported"
2+
conformance_automated = "Fail"
3+
errors_diff = """
4+
Line 14: Expected 1 errors
5+
Line 18: Expected 1 errors
6+
Line 21: Expected 1 errors
7+
Line 28: Expected 1 errors
8+
Line 31: Expected 1 errors
9+
Line 34: Expected 1 errors
10+
Line 68: Expected 1 errors
11+
Line 79: Expected 1 errors
12+
Line 83: Expected 1 errors
13+
Line 90: Expected 1 errors
14+
Line 107: Expected 1 errors
15+
Line 29: Unexpected errors ['generics_typevartuple_variance.py:29: error: Incompatible types in assignment (expression has type "ContravariantTypeVarTuple[object]", variable has type "ContravariantTypeVarTuple[int]") [assignment]']
16+
Line 30: Unexpected errors ['generics_typevartuple_variance.py:30: error: Incompatible types in assignment (expression has type "ContravariantTypeVarTuple[*tuple[object, ...]]", variable has type "ContravariantTypeVarTuple[*tuple[int, ...]]") [assignment]']
17+
Line 33: Unexpected errors ['generics_typevartuple_variance.py:33: error: Incompatible types in assignment (expression has type "ContravariantTypeVarTuple[*tuple[int, ...]]", variable has type "ContravariantTypeVarTuple[int]") [assignment]']
18+
Line 55: Unexpected errors ['generics_typevartuple_variance.py:55: error: Unexpected keyword argument "infer_variance" for "TypeVarTuple" [misc]']
19+
Line 73: Unexpected errors ['generics_typevartuple_variance.py:73: error: Unexpected keyword argument "contravariant" for "TypeVarTuple" [misc]']
20+
Line 84: Unexpected errors ['generics_typevartuple_variance.py:84: error: Incompatible types in assignment (expression has type "ContravariantTypeVarTupleOld[object]", variable has type "ContravariantTypeVarTupleOld[int]") [assignment]']
21+
Line 87: Unexpected errors ['generics_typevartuple_variance.py:87: error: Unexpected keyword argument "covariant" for "TypeVarTuple" [misc]']
22+
Line 108: Unexpected errors ['generics_typevartuple_variance.py:108: error: Incompatible types in assignment (expression has type "InferredContravariantTypeVarTupleOld[object]", variable has type "InferredContravariantTypeVarTupleOld[int]") [assignment]']
23+
"""
24+
output = """
25+
generics_typevartuple_variance.py:15: error: Incompatible types in assignment (expression has type "InvariantTypeVarTuple[object]", variable has type "InvariantTypeVarTuple[int]") [assignment]
26+
generics_typevartuple_variance.py:17: error: Incompatible types in assignment (expression has type "InvariantTypeVarTuple[*tuple[object, ...]]", variable has type "InvariantTypeVarTuple[*tuple[int, ...]]") [assignment]
27+
generics_typevartuple_variance.py:20: error: Incompatible types in assignment (expression has type "InvariantTypeVarTuple[*tuple[int, ...]]", variable has type "InvariantTypeVarTuple[int]") [assignment]
28+
generics_typevartuple_variance.py:29: error: Incompatible types in assignment (expression has type "ContravariantTypeVarTuple[object]", variable has type "ContravariantTypeVarTuple[int]") [assignment]
29+
generics_typevartuple_variance.py:30: error: Incompatible types in assignment (expression has type "ContravariantTypeVarTuple[*tuple[object, ...]]", variable has type "ContravariantTypeVarTuple[*tuple[int, ...]]") [assignment]
30+
generics_typevartuple_variance.py:33: error: Incompatible types in assignment (expression has type "ContravariantTypeVarTuple[*tuple[int, ...]]", variable has type "ContravariantTypeVarTuple[int]") [assignment]
31+
generics_typevartuple_variance.py:42: error: Incompatible types in assignment (expression has type "CovariantTypeVarTuple[object]", variable has type "CovariantTypeVarTuple[int]") [assignment]
32+
generics_typevartuple_variance.py:45: error: Incompatible types in assignment (expression has type "CovariantTypeVarTuple[bool, object]", variable has type "CovariantTypeVarTuple[int, int]") [assignment]
33+
generics_typevartuple_variance.py:46: error: Incompatible types in assignment (expression has type "CovariantTypeVarTuple[object, bool]", variable has type "CovariantTypeVarTuple[int, int]") [assignment]
34+
generics_typevartuple_variance.py:47: error: Incompatible types in assignment (expression has type "CovariantTypeVarTuple[object, object]", variable has type "CovariantTypeVarTuple[int, int]") [assignment]
35+
generics_typevartuple_variance.py:48: error: Incompatible types in assignment (expression has type "CovariantTypeVarTuple[*tuple[object, ...]]", variable has type "CovariantTypeVarTuple[*tuple[int, ...]]") [assignment]
36+
generics_typevartuple_variance.py:51: error: Incompatible types in assignment (expression has type "CovariantTypeVarTuple[*tuple[int, ...]]", variable has type "CovariantTypeVarTuple[int]") [assignment]
37+
generics_typevartuple_variance.py:55: error: Unexpected keyword argument "infer_variance" for "TypeVarTuple" [misc]
38+
generics_typevartuple_variance.py:56: error: Unexpected keyword argument "covariant" for "TypeVarTuple" [misc]
39+
generics_typevartuple_variance.py:56: error: Unexpected keyword argument "contravariant" for "TypeVarTuple" [misc]
40+
generics_typevartuple_variance.py:57: error: Unexpected keyword argument "covariant" for "TypeVarTuple" [misc]
41+
generics_typevartuple_variance.py:57: error: Unexpected keyword argument "infer_variance" for "TypeVarTuple" [misc]
42+
generics_typevartuple_variance.py:58: error: Unexpected keyword argument "contravariant" for "TypeVarTuple" [misc]
43+
generics_typevartuple_variance.py:58: error: Unexpected keyword argument "infer_variance" for "TypeVarTuple" [misc]
44+
generics_typevartuple_variance.py:69: error: Incompatible types in assignment (expression has type "InvariantTypeVarTupleOld[object]", variable has type "InvariantTypeVarTupleOld[int]") [assignment]
45+
generics_typevartuple_variance.py:73: error: Unexpected keyword argument "contravariant" for "TypeVarTuple" [misc]
46+
generics_typevartuple_variance.py:84: error: Incompatible types in assignment (expression has type "ContravariantTypeVarTupleOld[object]", variable has type "ContravariantTypeVarTupleOld[int]") [assignment]
47+
generics_typevartuple_variance.py:87: error: Unexpected keyword argument "covariant" for "TypeVarTuple" [misc]
48+
generics_typevartuple_variance.py:97: error: Incompatible types in assignment (expression has type "CovariantTypeVarTupleOld[object]", variable has type "CovariantTypeVarTupleOld[int]") [assignment]
49+
generics_typevartuple_variance.py:108: error: Incompatible types in assignment (expression has type "InferredContravariantTypeVarTupleOld[object]", variable has type "InferredContravariantTypeVarTupleOld[int]") [assignment]
50+
generics_typevartuple_variance.py:116: error: Incompatible types in assignment (expression has type "InferredCovariantTypeVarTupleOld[object]", variable has type "InferredCovariantTypeVarTupleOld[int]") [assignment]
51+
"""
Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,20 @@
1-
conformant = "Pass"
1+
conformant = "Partial"
2+
notes = """
3+
False report of ParamSpec variance keywords.
4+
"""
25
output = """
3-
protocols_variance.py:21: error: Invariant type variable "T1" used in protocol where covariant one is expected [misc]
4-
protocols_variance.py:40: error: Invariant type variable "T3" used in protocol where contravariant one is expected [misc]
5-
protocols_variance.py:56: error: Invariant type variable "T1" used in protocol where contravariant one is expected [misc]
6-
protocols_variance.py:61: error: Covariant type variable "T1_co" used in protocol where contravariant one is expected [misc]
7-
protocols_variance.py:62: error: Cannot use a covariant type variable as a parameter [misc]
8-
protocols_variance.py:66: error: Invariant type variable "T1" used in protocol where covariant one is expected [misc]
9-
protocols_variance.py:71: error: Contravariant type variable "T1_contra" used in protocol where covariant one is expected [misc]
10-
protocols_variance.py:72: error: Cannot use a contravariant type variable as return type [misc]
11-
protocols_variance.py:104: error: Invariant type variable "T1" used in protocol where covariant one is expected [misc]
6+
protocols_variance.py:15: error: The variance and bound arguments to ParamSpec do not have defined semantics yet [misc]
7+
protocols_variance.py:22: error: Invariant type variable "T1" used in protocol where covariant one is expected [misc]
8+
protocols_variance.py:41: error: Invariant type variable "T3" used in protocol where contravariant one is expected [misc]
9+
protocols_variance.py:57: error: Invariant type variable "T1" used in protocol where contravariant one is expected [misc]
10+
protocols_variance.py:62: error: Covariant type variable "T1_co" used in protocol where contravariant one is expected [misc]
11+
protocols_variance.py:63: error: Cannot use a covariant type variable as a parameter [misc]
12+
protocols_variance.py:67: error: Invariant type variable "T1" used in protocol where covariant one is expected [misc]
13+
protocols_variance.py:72: error: Contravariant type variable "T1_contra" used in protocol where covariant one is expected [misc]
14+
protocols_variance.py:73: error: Cannot use a contravariant type variable as return type [misc]
15+
protocols_variance.py:105: error: Invariant type variable "T1" used in protocol where covariant one is expected [misc]
1216
"""
13-
conformance_automated = "Pass"
17+
conformance_automated = "Fail"
1418
errors_diff = """
19+
Line 15: Unexpected errors ['protocols_variance.py:15: error: The variance and bound arguments to ParamSpec do not have defined semantics yet [misc]']
1520
"""

conformance/results/pycroscope/callables_annotation.toml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1-
conformance_automated = "Pass"
1+
conformant = "Partial"
2+
notes = """
3+
Does not support callback protocols with PEP 695 ParamSpec type parameters.
4+
"""
5+
conformance_automated = "Fail"
26
errors_diff = """
7+
Line 115: Unexpected errors ['./callables_annotation.py:115:38: Traceback (most recent call last):', './callables_annotation.py:115:4: Traceback (most recent call last):']
38
"""
49
output = """
510
./callables_annotation.py:25:4: Missing required positional argument at position 1 [incompatible_call]
@@ -14,6 +19,8 @@ output = """
1419
./callables_annotation.py:59:4: Ellipsis must be used directly in Callable[..., T], not in Callable[[...], T] [invalid_annotation]
1520
./callables_annotation.py:91:0: Incompatible assignment: expected (int, /, **Any[explicit]) -> str, got () -> str [incompatible_assignment]
1621
./callables_annotation.py:93:0: Incompatible assignment: expected (int, /, **Any[explicit]) -> str, got (*, a: int) -> str [incompatible_assignment]
22+
./callables_annotation.py:115:38: Traceback (most recent call last):
23+
./callables_annotation.py:115:4: Traceback (most recent call last):
1724
./callables_annotation.py:159:4: Incompatible assignment: expected ./callables_annotation.py.Proto5[Any[explicit]], got ./callables_annotation.py.Proto8 [incompatible_assignment]
1825
./callables_annotation.py:172:4: Incompatible assignment: expected .Callback2[Any[ellipsis_callable]] = (int, /, ****P) -> str, got () -> str [incompatible_assignment]
1926
./callables_annotation.py:187:4: Incompatible assignment: expected (str, /, **Any[explicit]) -> str, got (int, str, /) -> str [incompatible_assignment]

0 commit comments

Comments
 (0)