Skip to content

Commit 5b4e853

Browse files
committed
fixup! specify that type variable tuples and parameter specification should have variance
1 parent 92287d4 commit 5b4e853

21 files changed

Lines changed: 675 additions & 462 deletions

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

conformance/results/mypy/generics_paramspec_variance.toml

Lines changed: 32 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -3,58 +3,42 @@ conformance_automated = "Fail"
33
errors_diff = """
44
Line 15: Expected 1 errors
55
Line 30: Expected 1 errors
6-
Line 64: Expected 1 errors
7-
Line 110: Expected 1 errors
8-
Line 121: Expected 1 errors
9-
Line 127: 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
1012
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]']
11-
Line 58: Unexpected errors ['generics_paramspec_variance.py:58: error: Incompatible types in assignment (expression has type "InitP[[NamedArg(int, \\'a\\')]]", variable has type "InitP[[int]]") [assignment]']
12-
Line 60: Unexpected errors ['generics_paramspec_variance.py:60: error: Incompatible types in assignment (expression has type "InitP[[int]]", variable has type "InitP[[Arg(int, \\'a\\')]]") [assignment]']
13-
Line 76: Unexpected errors ['generics_paramspec_variance.py:76: error: Argument 1 to "Box" has incompatible type "OutitP[[int]]"; expected "InitP[[int]]" [arg-type]']
14-
Line 78: Unexpected errors ['generics_paramspec_variance.py:78: error: Incompatible types in assignment (expression has type "OutitP[[NamedArg(int, \\'a\\')]]", variable has type "InitP[[NamedArg(int, \\'a\\')]]") [assignment]']
15-
Line 80: Unexpected errors ['generics_paramspec_variance.py:80: error: Incompatible types in assignment (expression has type "OutitP[[int]]", variable has type "InitP[[int]]") [assignment]']
16-
Line 82: Unexpected errors ['generics_paramspec_variance.py:82: error: Incompatible types in assignment (expression has type "OutitP[[int]]", variable has type "InitP[[int]]") [assignment]']
17-
Line 83: Unexpected errors ['generics_paramspec_variance.py:83: error: Name "_" already defined on line 62 [no-redef]', 'generics_paramspec_variance.py:83: error: Invalid type comment or annotation [valid-type]']
18-
Line 84: Unexpected errors ['generics_paramspec_variance.py:84: error: Incompatible types in assignment (expression has type "OutitP[[int]]", variable has type "InitP[[int]]") [assignment]']
19-
Line 86: Unexpected errors ['generics_paramspec_variance.py:86: error: Incompatible types in assignment (expression has type "OutitP[[int, str]]", variable has type "InitP[[int, str]]") [assignment]']
20-
Line 91: Unexpected errors ['generics_paramspec_variance.py:91: error: String argument 1 "InP" to ParamSpec(...) does not match variable name "P" [misc]']
21-
Line 92: Unexpected errors ['generics_paramspec_variance.py:92: error: The variance and bound arguments to ParamSpec do not have defined semantics yet [misc]']
22-
Line 97: Unexpected errors ['generics_paramspec_variance.py:97: error: Free type variable expected in Generic[...] [misc]']
23-
Line 101: Unexpected errors ['generics_paramspec_variance.py:101: error: "InvariantParamSpecOld" expects no type arguments, but 1 given [type-arg]']
24-
Line 102: Unexpected errors ['generics_paramspec_variance.py:102: error: The type "type[InvariantParamSpecOld]" is not generic and not indexable [misc]']
25-
Line 117: Unexpected errors ['generics_paramspec_variance.py:117: error: The variance and bound arguments to ParamSpec do not have defined semantics yet [misc]']
26-
Line 128: Unexpected errors ['generics_paramspec_variance.py:128: error: Incompatible types in assignment (expression has type "CovariantParamSpecOld[[int]]", variable has type "CovariantParamSpecOld[[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]']
2720
"""
2821
output = """
2922
generics_paramspec_variance.py:14: error: Incompatible types in assignment (expression has type "InvariantParamSpec[[int]]", variable has type "InvariantParamSpec[[object]]") [assignment]
3023
generics_paramspec_variance.py:21: error: Incompatible types in assignment (expression has type "ContravariantParamSpec[[int]]", variable has type "ContravariantParamSpec[[object]]") [assignment]
3124
generics_paramspec_variance.py:31: error: Incompatible types in assignment (expression has type "CovariantParamSpec[[int]]", variable has type "CovariantParamSpec[[object]]") [assignment]
32-
generics_paramspec_variance.py:58: error: Incompatible types in assignment (expression has type "InitP[[NamedArg(int, 'a')]]", variable has type "InitP[[int]]") [assignment]
33-
generics_paramspec_variance.py:60: error: Incompatible types in assignment (expression has type "InitP[[int]]", variable has type "InitP[[Arg(int, 'a')]]") [assignment]
34-
generics_paramspec_variance.py:62: error: Invalid type comment or annotation [valid-type]
35-
generics_paramspec_variance.py:66: error: Incompatible types in assignment (expression has type "InitP[[int, str]]", variable has type "InitP[[int]]") [assignment]
36-
generics_paramspec_variance.py:76: error: Argument 1 to "Box" has incompatible type "OutitP[[int]]"; expected "InitP[[int]]" [arg-type]
37-
generics_paramspec_variance.py:78: error: Incompatible types in assignment (expression has type "OutitP[[NamedArg(int, 'a')]]", variable has type "InitP[[NamedArg(int, 'a')]]") [assignment]
38-
generics_paramspec_variance.py:79: error: Incompatible types in assignment (expression has type "InitP[[NamedArg(int, 'a')]]", variable has type "InitP[[int]]") [assignment]
39-
generics_paramspec_variance.py:80: error: Incompatible types in assignment (expression has type "OutitP[[int]]", variable has type "InitP[[int]]") [assignment]
40-
generics_paramspec_variance.py:81: error: Incompatible types in assignment (expression has type "InitP[[int]]", variable has type "InitP[[Arg(int, 'a')]]") [assignment]
41-
generics_paramspec_variance.py:82: error: Incompatible types in assignment (expression has type "OutitP[[int]]", variable has type "InitP[[int]]") [assignment]
42-
generics_paramspec_variance.py:83: error: Name "_" already defined on line 62 [no-redef]
43-
generics_paramspec_variance.py:83: error: Invalid type comment or annotation [valid-type]
44-
generics_paramspec_variance.py:84: error: Incompatible types in assignment (expression has type "OutitP[[int]]", variable has type "InitP[[int]]") [assignment]
45-
generics_paramspec_variance.py:86: error: Incompatible types in assignment (expression has type "OutitP[[int, str]]", variable has type "InitP[[int, str]]") [assignment]
46-
generics_paramspec_variance.py:87: error: Incompatible types in assignment (expression has type "InitP[[int, str]]", variable has type "InitP[[int]]") [assignment]
47-
generics_paramspec_variance.py:91: error: String argument 1 "InP" to ParamSpec(...) does not match variable name "P" [misc]
48-
generics_paramspec_variance.py:92: error: The variance and bound arguments to ParamSpec do not have defined semantics yet [misc]
49-
generics_paramspec_variance.py:93: error: The variance and bound arguments to ParamSpec do not have defined semantics yet [misc]
50-
generics_paramspec_variance.py:94: error: String argument 1 "InvP1" to ParamSpec(...) does not match variable name "InvP2" [misc]
51-
generics_paramspec_variance.py:95: error: String argument 1 "InvP1" to ParamSpec(...) does not match variable name "InvP3" [misc]
52-
generics_paramspec_variance.py:97: error: Free type variable expected in Generic[...] [misc]
53-
generics_paramspec_variance.py:101: error: "InvariantParamSpecOld" expects no type arguments, but 1 given [type-arg]
54-
generics_paramspec_variance.py:102: error: The type "type[InvariantParamSpecOld]" is not generic and not indexable [misc]
55-
generics_paramspec_variance.py:103: error: The type "type[InvariantParamSpecOld]" is not generic and not indexable [misc]
56-
generics_paramspec_variance.py:104: error: The type "type[InvariantParamSpecOld]" is not generic and not indexable [misc]
57-
generics_paramspec_variance.py:114: error: Incompatible types in assignment (expression has type "ContravariantParamSpecOld[[int]]", variable has type "ContravariantParamSpecOld[[object]]") [assignment]
58-
generics_paramspec_variance.py:117: error: The variance and bound arguments to ParamSpec do not have defined semantics yet [misc]
59-
generics_paramspec_variance.py:128: error: Incompatible types in assignment (expression has type "CovariantParamSpecOld[[int]]", variable has type "CovariantParamSpecOld[[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]
6044
"""

0 commit comments

Comments
 (0)