Skip to content

Commit 8f30004

Browse files
committed
specify that parameter specification should have variance
1 parent fecce0d commit 8f30004

13 files changed

+208
-14
lines changed

conformance/results/mypy/generics_paramspec_semantics.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
conformant = "Pass"
1+
conformant = "Partial"
22
output = """
33
generics_paramspec_semantics.py:26: error: Unexpected keyword argument "a" [call-arg]
44
generics_paramspec_semantics.py:26: error: Unexpected keyword argument "b" [call-arg]
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
conformant = "Unsupported"
2+
conformance_automated = "Fail"
3+
errors_diff = """
4+
Line 24: Expected 1 errors
5+
Line 31: Expected 1 errors
6+
Line 47: Expected 1 errors
7+
Line 23: Unexpected errors ['generics_paramspec_variance.py:23: error: Incompatible types in assignment (expression has type "CovariantParamSpec[[int]]", variable has type "CovariantParamSpec[[object]]") [assignment]']
8+
Line 26: Unexpected errors ['generics_paramspec_variance.py:26: error: The variance and bound arguments to ParamSpec do not have defined semantics yet [misc]']
9+
Line 30: Unexpected errors ['generics_paramspec_variance.py:30: error: Missing return statement [empty-body]']
10+
Line 37: Unexpected errors ['generics_paramspec_variance.py:37: error: The variance and bound arguments to ParamSpec do not have defined semantics yet [misc]']
11+
Line 46: Unexpected errors ['generics_paramspec_variance.py:46: error: Incompatible types in assignment (expression has type "CovariantParamSpecOld[[int]]", variable has type "CovariantParamSpecOld[[object]]") [assignment]']
12+
"""
13+
output = """
14+
generics_paramspec_variance.py:15: error: Incompatible types in assignment (expression has type "ContravariantParamSpec[[int]]", variable has type "ContravariantParamSpec[[object]]") [assignment]
15+
generics_paramspec_variance.py:23: error: Incompatible types in assignment (expression has type "CovariantParamSpec[[int]]", variable has type "CovariantParamSpec[[object]]") [assignment]
16+
generics_paramspec_variance.py:26: error: The variance and bound arguments to ParamSpec do not have defined semantics yet [misc]
17+
generics_paramspec_variance.py:30: error: Missing return statement [empty-body]
18+
generics_paramspec_variance.py:35: error: Incompatible types in assignment (expression has type "ContravariantParamSpecOld[[int]]", variable has type "ContravariantParamSpecOld[[object]]") [assignment]
19+
generics_paramspec_variance.py:37: error: The variance and bound arguments to ParamSpec do not have defined semantics yet [misc]
20+
generics_paramspec_variance.py:41: error: Missing return statement [empty-body]
21+
generics_paramspec_variance.py:46: error: Incompatible types in assignment (expression has type "CovariantParamSpecOld[[int]]", variable has type "CovariantParamSpecOld[[object]]") [assignment]
22+
"""

conformance/results/pyrefly/generics_paramspec_semantics.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
conformant = "Pass"
1+
conformant = "Partial"
22
conformance_automated = "Pass"
33
errors_diff = """
44
"""
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
conformant = "Unsupported"
2+
conformance_automated = "Fail"
3+
errors_diff = """
4+
Line 15: Expected 1 errors
5+
Line 24: Expected 1 errors
6+
Line 31: Expected 1 errors
7+
Line 41: Expected 1 errors
8+
Line 14: Unexpected errors ['`ContravariantParamSpec[[object]]` is not assignable to `ContravariantParamSpec[[int]]` [bad-assignment]']
9+
Line 23: Unexpected errors ['`CovariantParamSpec[[int]]` is not assignable to `CovariantParamSpec[[object]]` [bad-assignment]']
10+
Line 26: Unexpected errors ['Unexpected keyword argument `contravariant` to ParamSpec [invalid-param-spec]']
11+
Line 34: Unexpected errors ['`ContravariantParamSpecOld[[object]]` is not assignable to `ContravariantParamSpecOld[[int]]` [bad-assignment]']
12+
Line 37: Unexpected errors ['Unexpected keyword argument `covariant` to ParamSpec [invalid-param-spec]']
13+
Line 46: Unexpected errors ['`CovariantParamSpecOld[[int]]` is not assignable to `CovariantParamSpecOld[[object]]` [bad-assignment]']
14+
"""
15+
output = """
16+
ERROR generics_paramspec_variance.py:14:39-45: `ContravariantParamSpec[[object]]` is not assignable to `ContravariantParamSpec[[int]]` [bad-assignment]
17+
ERROR generics_paramspec_variance.py:23:39-46: `CovariantParamSpec[[int]]` is not assignable to `CovariantParamSpec[[object]]` [bad-assignment]
18+
ERROR generics_paramspec_variance.py:26:24-42: Unexpected keyword argument `contravariant` to ParamSpec [invalid-param-spec]
19+
ERROR generics_paramspec_variance.py:34:46-56: `ContravariantParamSpecOld[[object]]` is not assignable to `ContravariantParamSpecOld[[int]]` [bad-assignment]
20+
ERROR generics_paramspec_variance.py:35:14-24: `ContravariantParamSpecOld[[int]]` is not assignable to variable `in_obj_old` with type `ContravariantParamSpecOld[[object]]` [bad-assignment]
21+
ERROR generics_paramspec_variance.py:37:26-40: Unexpected keyword argument `covariant` to ParamSpec [invalid-param-spec]
22+
ERROR generics_paramspec_variance.py:46:46-57: `CovariantParamSpecOld[[int]]` is not assignable to `CovariantParamSpecOld[[object]]` [bad-assignment]
23+
ERROR generics_paramspec_variance.py:47:15-26: `CovariantParamSpecOld[[object]]` is not assignable to variable `out_int_old` with type `CovariantParamSpecOld[[int]]` [bad-assignment]
24+
"""

conformance/results/pyright/generics_paramspec_semantics.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
conformant = "Pass"
1+
conformant = "Partial"
22
notes = """
33
Constraint solver doesn't find common type for two signatures captured by a single ParamSpec (allowed).
4+
parameter specification variance not supported
45
"""
56
output = """
67
generics_paramspec_semantics.py:26:6 - error: Expected 2 more positional arguments (reportCallIssue)
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
conformant = "Unsupported"
2+
conformance_automated = "Fail"
3+
errors_diff = """
4+
Line 31: Expected 1 errors
5+
Line 41: Expected 1 errors
6+
Line 14: Unexpected errors ['generics_paramspec_variance.py:14:39 - error: Type "ContravariantParamSpec[(object)]" is not assignable to declared type "ContravariantParamSpec[(int)]"']
7+
Line 23: Unexpected errors ['generics_paramspec_variance.py:23:39 - error: Type "CovariantParamSpec[(int)]" is not assignable to declared type "CovariantParamSpec[(object)]"']
8+
Line 26: Unexpected errors ['generics_paramspec_variance.py:26:24 - error: "contravariant" is unknown parameter to ParamSpec (reportGeneralTypeIssues)']
9+
Line 34: Unexpected errors ['generics_paramspec_variance.py:34:46 - error: Type "ContravariantParamSpecOld[(object)]" is not assignable to declared type "ContravariantParamSpecOld[(int)]"']
10+
Line 37: Unexpected errors ['generics_paramspec_variance.py:37:26 - error: "covariant" is unknown parameter to ParamSpec (reportGeneralTypeIssues)']
11+
Line 46: Unexpected errors ['generics_paramspec_variance.py:46:46 - error: Type "CovariantParamSpecOld[(int)]" is not assignable to declared type "CovariantParamSpecOld[(object)]"']
12+
"""
13+
output = """
14+
generics_paramspec_variance.py:14:39 - error: Type "ContravariantParamSpec[(object)]" is not assignable to declared type "ContravariantParamSpec[(int)]"
15+
  "ContravariantParamSpec[(object)]" is not assignable to "ContravariantParamSpec[(int)]"
16+
    Type parameter "InP@ContravariantParamSpec" is invariant, but "(object)" is not the same as "(int)" (reportAssignmentType)
17+
generics_paramspec_variance.py:15:10 - error: Type "ContravariantParamSpec[(int)]" is not assignable to declared type "ContravariantParamSpec[(object)]"
18+
  "ContravariantParamSpec[(int)]" is not assignable to "ContravariantParamSpec[(object)]"
19+
    Type parameter "InP@ContravariantParamSpec" is invariant, but "(int)" is not the same as "(object)" (reportAssignmentType)
20+
generics_paramspec_variance.py:23:39 - error: Type "CovariantParamSpec[(int)]" is not assignable to declared type "CovariantParamSpec[(object)]"
21+
  "CovariantParamSpec[(int)]" is not assignable to "CovariantParamSpec[(object)]"
22+
    Type parameter "OutP@CovariantParamSpec" is invariant, but "(int)" is not the same as "(object)" (reportAssignmentType)
23+
generics_paramspec_variance.py:24:11 - error: Type "CovariantParamSpec[(object)]" is not assignable to declared type "CovariantParamSpec[(int)]"
24+
  "CovariantParamSpec[(object)]" is not assignable to "CovariantParamSpec[(int)]"
25+
    Type parameter "OutP@CovariantParamSpec" is invariant, but "(object)" is not the same as "(int)" (reportAssignmentType)
26+
generics_paramspec_variance.py:26:24 - error: "contravariant" is unknown parameter to ParamSpec (reportGeneralTypeIssues)
27+
generics_paramspec_variance.py:34:46 - error: Type "ContravariantParamSpecOld[(object)]" is not assignable to declared type "ContravariantParamSpecOld[(int)]"
28+
  "ContravariantParamSpecOld[(object)]" is not assignable to "ContravariantParamSpecOld[(int)]"
29+
    Type parameter "InP@ContravariantParamSpecOld" is invariant, but "(object)" is not the same as "(int)" (reportAssignmentType)
30+
generics_paramspec_variance.py:35:14 - error: Type "ContravariantParamSpecOld[(int)]" is not assignable to declared type "ContravariantParamSpecOld[(object)]"
31+
  "ContravariantParamSpecOld[(int)]" is not assignable to "ContravariantParamSpecOld[(object)]"
32+
    Type parameter "InP@ContravariantParamSpecOld" is invariant, but "(int)" is not the same as "(object)" (reportAssignmentType)
33+
generics_paramspec_variance.py:37:26 - error: "covariant" is unknown parameter to ParamSpec (reportGeneralTypeIssues)
34+
generics_paramspec_variance.py:46:46 - error: Type "CovariantParamSpecOld[(int)]" is not assignable to declared type "CovariantParamSpecOld[(object)]"
35+
  "CovariantParamSpecOld[(int)]" is not assignable to "CovariantParamSpecOld[(object)]"
36+
    Type parameter "OutP@CovariantParamSpecOld" is invariant, but "(int)" is not the same as "(object)" (reportAssignmentType)
37+
generics_paramspec_variance.py:47:15 - error: Type "CovariantParamSpecOld[(object)]" is not assignable to declared type "CovariantParamSpecOld[(int)]"
38+
  "CovariantParamSpecOld[(object)]" is not assignable to "CovariantParamSpecOld[(int)]"
39+
    Type parameter "OutP@CovariantParamSpecOld" is invariant, but "(object)" is not the same as "(int)" (reportAssignmentType)
40+
"""

conformance/results/results.html

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -322,11 +322,11 @@ <h3>Python Type System Conformance Test Results</h3>
322322
<th class="column col2 partially-conformant"><div class="hover-text">Partial<span class="tooltip-text" id="bottom"><p>Incorrectly allows using `*args: P.args` and `**kwargs: P.kwargs` when `P` has not been put into scope by any other parameter annotation or enclosing scope.</p></span></div></th>
323323
</tr>
324324
<tr><th class="column col1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;generics_paramspec_semantics</th>
325-
<th class="column col2 conformant">Pass</th>
326-
<th class="column col2 conformant"><div class="hover-text">Pass*<span class="tooltip-text" id="bottom"><p>Constraint solver doesn't find common type for two signatures captured by a single ParamSpec (allowed).</p></span></div></th>
327-
<th class="column col2 conformant">Pass</th>
328-
<th class="column col2 conformant">Pass</th>
329-
<th class="column col2 conformant">Pass</th>
325+
<th class="column col2 partially-conformant">Partial</th>
326+
<th class="column col2 partially-conformant"><div class="hover-text">Partial<span class="tooltip-text" id="bottom"><p>Constraint solver doesn't find common type for two signatures captured by a single ParamSpec (allowed).</p><p>parameter specification variance not supported</p></span></div></th>
327+
<th class="column col2 partially-conformant">Partial</th>
328+
<th class="column col2 partially-conformant">Partial</th>
329+
<th class="column col2 partially-conformant">Partial</th>
330330
</tr>
331331
<tr><th class="column col1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;generics_paramspec_specialization</th>
332332
<th class="column col2 conformant">Pass</th>
@@ -335,6 +335,13 @@ <h3>Python Type System Conformance Test Results</h3>
335335
<th class="column col2 conformant">Pass</th>
336336
<th class="column col2 conformant">Pass</th>
337337
</tr>
338+
<tr><th class="column col1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;generics_paramspec_variance</th>
339+
<th class="column col2 not-conformant">Unsupported</th>
340+
<th class="column col2 not-conformant">Unsupported</th>
341+
<th class="column col2 not-conformant">Unsupported</th>
342+
<th class="column col2 not-conformant">Unsupported</th>
343+
<th class="column col2 not-conformant">Unsupported</th>
344+
</tr>
338345
<tr><th class="column col1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;generics_scoping</th>
339346
<th class="column col2 conformant">Pass</th>
340347
<th class="column col2 conformant">Pass</th>

conformance/results/ty/generics_paramspec_semantics.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
conformant = "Partial"
12
conformance_automated = "Pass"
23
errors_diff = """
34
"""
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
conformant = "Unsupported"
2+
conformance_automated = "Fail"
3+
errors_diff = """
4+
Line 15: Expected 1 errors
5+
Line 24: Expected 1 errors
6+
Line 35: Expected 1 errors
7+
Line 47: Expected 1 errors
8+
Line 26: Unexpected errors ['generics_paramspec_variance.py:26:7: error[invalid-paramspec] The variance and bound arguments for `ParamSpec` do not have defined semantics yet']
9+
Line 29: Unexpected errors ['generics_paramspec_variance.py:29:33: error[invalid-argument-type] `ParamSpec` is not a valid argument to `Generic`']
10+
Line 30: Unexpected errors ['generics_paramspec_variance.py:30:23: error[empty-body] Function always implicitly returns `None`, which is not assignable to return type `(...) -> Unknown`', 'generics_paramspec_variance.py:30:32: error[invalid-type-form] Variable of type `ParamSpec` is not allowed in a return type annotation', 'generics_paramspec_variance.py:30:32: error[invalid-type-form] The first argument to `Callable` must be either a list of types, ParamSpec, Concatenate, or `...`']
11+
Line 37: Unexpected errors ['generics_paramspec_variance.py:37:8: error[invalid-paramspec] The variance and bound arguments for `ParamSpec` do not have defined semantics yet']
12+
Line 40: Unexpected errors ['generics_paramspec_variance.py:40:29: error[invalid-argument-type] `ParamSpec` is not a valid argument to `Generic`']
13+
Line 42: Unexpected errors ['generics_paramspec_variance.py:42:34: error[invalid-type-form] Variable of type `ParamSpec` is not allowed in a parameter annotation', 'generics_paramspec_variance.py:42:34: error[invalid-type-form] The first argument to `Callable` must be either a list of types, ParamSpec, Concatenate, or `...`']
14+
"""
15+
output = """
16+
generics_paramspec_variance.py:26:7: error[invalid-paramspec] The variance and bound arguments for `ParamSpec` do not have defined semantics yet
17+
generics_paramspec_variance.py:29:33: error[invalid-argument-type] `ParamSpec` is not a valid argument to `Generic`
18+
generics_paramspec_variance.py:30:23: error[empty-body] Function always implicitly returns `None`, which is not assignable to return type `(...) -> Unknown`
19+
generics_paramspec_variance.py:30:32: error[invalid-type-form] Variable of type `ParamSpec` is not allowed in a return type annotation
20+
generics_paramspec_variance.py:30:32: error[invalid-type-form] The first argument to `Callable` must be either a list of types, ParamSpec, Concatenate, or `...`
21+
generics_paramspec_variance.py:31:34: error[invalid-type-form] Variable of type `ParamSpec` is not allowed in a parameter annotation
22+
generics_paramspec_variance.py:31:34: error[invalid-type-form] The first argument to `Callable` must be either a list of types, ParamSpec, Concatenate, or `...`
23+
generics_paramspec_variance.py:37:8: error[invalid-paramspec] The variance and bound arguments for `ParamSpec` do not have defined semantics yet
24+
generics_paramspec_variance.py:40:29: error[invalid-argument-type] `ParamSpec` is not a valid argument to `Generic`
25+
generics_paramspec_variance.py:41:23: error[empty-body] Function always implicitly returns `None`, which is not assignable to return type `(...) -> Unknown`
26+
generics_paramspec_variance.py:41:32: error[invalid-type-form] Variable of type `ParamSpec` is not allowed in a return type annotation
27+
generics_paramspec_variance.py:41:32: error[invalid-type-form] The first argument to `Callable` must be either a list of types, ParamSpec, Concatenate, or `...`
28+
generics_paramspec_variance.py:42:34: error[invalid-type-form] Variable of type `ParamSpec` is not allowed in a parameter annotation
29+
generics_paramspec_variance.py:42:34: error[invalid-type-form] The first argument to `Callable` must be either a list of types, ParamSpec, Concatenate, or `...`
30+
"""

conformance/results/zuban/generics_paramspec_semantics.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
conformant = "Partial"
12
conformance_automated = "Pass"
23
errors_diff = """
34
"""

0 commit comments

Comments
 (0)