From 92287d4eee32edb843076ae97a62ff53e12777ba Mon Sep 17 00:00:00 2001 From: kotlinisland <65446343+kotlinisland@users.noreply.github.com> Date: Mon, 9 Mar 2026 12:58:09 +1000 Subject: [PATCH 1/7] specify that type variable tuples and parameter specification should have variance --- .../generics_mixed_variance_inference.toml | 9 ++ .../mypy/generics_paramspec_variance.toml | 60 ++++++++ .../mypy/generics_typevartuple_basic.toml | 16 +-- .../mypy/generics_typevartuple_variance.toml | 39 ++++++ .../results/mypy/protocols_variance.toml | 27 ++-- .../generics_mixed_variance_inference.toml | 20 +++ .../generics_paramspec_variance.toml | 49 +++++++ .../generics_typevartuple_basic.toml | 22 +-- .../generics_typevartuple_variance.toml | 40 ++++++ .../literals_parameterizations.toml | 2 +- .../pycroscope/protocols_variance.toml | 14 +- .../pycroscope/specialtypes_sentinels.toml | 4 +- .../generics_mixed_variance_inference.toml | 13 ++ .../pyrefly/generics_paramspec_variance.toml | 46 +++++++ .../pyrefly/generics_typevartuple_basic.toml | 16 +-- .../generics_typevartuple_variance.toml | 47 +++++++ .../results/pyrefly/protocols_variance.toml | 23 ++-- .../generics_mixed_variance_inference.toml | 24 ++++ .../pyright/generics_paramspec_variance.toml | 88 ++++++++++++ .../pyright/generics_typevartuple_basic.toml | 20 +-- .../generics_typevartuple_variance.toml | 91 +++++++++++++ .../results/pyright/protocols_variance.toml | 27 ++-- .../ty/generics_mixed_variance_inference.toml | 9 ++ .../ty/generics_paramspec_variance.toml | 40 ++++++ .../ty/generics_typevartuple_basic.toml | 17 +-- .../ty/generics_typevartuple_variance.toml | 29 ++++ .../results/ty/protocols_variance.toml | 14 +- .../generics_mixed_variance_inference.toml | 11 ++ .../zuban/generics_paramspec_variance.toml | 46 +++++++ .../zuban/generics_typevartuple_basic.toml | 16 +-- .../zuban/generics_typevartuple_variance.toml | 47 +++++++ .../results/zuban/protocols_variance.toml | 26 ++-- .../generics_mixed_variance_inference.py | 21 +++ .../tests/generics_paramspec_variance.py | 128 ++++++++++++++++++ .../tests/generics_typevartuple_basic.py | 10 +- .../tests/generics_typevartuple_variance.py | 91 +++++++++++++ conformance/tests/protocols_variance.py | 5 +- conformance/uv.lock | 6 +- docs/spec/generics.rst | 42 +++--- 39 files changed, 1119 insertions(+), 136 deletions(-) create mode 100644 conformance/results/mypy/generics_mixed_variance_inference.toml create mode 100644 conformance/results/mypy/generics_paramspec_variance.toml create mode 100644 conformance/results/mypy/generics_typevartuple_variance.toml create mode 100644 conformance/results/pycroscope/generics_mixed_variance_inference.toml create mode 100644 conformance/results/pycroscope/generics_paramspec_variance.toml create mode 100644 conformance/results/pycroscope/generics_typevartuple_variance.toml create mode 100644 conformance/results/pyrefly/generics_mixed_variance_inference.toml create mode 100644 conformance/results/pyrefly/generics_paramspec_variance.toml create mode 100644 conformance/results/pyrefly/generics_typevartuple_variance.toml create mode 100644 conformance/results/pyright/generics_mixed_variance_inference.toml create mode 100644 conformance/results/pyright/generics_paramspec_variance.toml create mode 100644 conformance/results/pyright/generics_typevartuple_variance.toml create mode 100644 conformance/results/ty/generics_mixed_variance_inference.toml create mode 100644 conformance/results/ty/generics_paramspec_variance.toml create mode 100644 conformance/results/ty/generics_typevartuple_variance.toml create mode 100644 conformance/results/zuban/generics_mixed_variance_inference.toml create mode 100644 conformance/results/zuban/generics_paramspec_variance.toml create mode 100644 conformance/results/zuban/generics_typevartuple_variance.toml create mode 100644 conformance/tests/generics_mixed_variance_inference.py create mode 100644 conformance/tests/generics_paramspec_variance.py create mode 100644 conformance/tests/generics_typevartuple_variance.py diff --git a/conformance/results/mypy/generics_mixed_variance_inference.toml b/conformance/results/mypy/generics_mixed_variance_inference.toml new file mode 100644 index 000000000..84f10eed9 --- /dev/null +++ b/conformance/results/mypy/generics_mixed_variance_inference.toml @@ -0,0 +1,9 @@ +conformant = "Pass" +conformance_automated = "Pass" +errors_diff = """ +""" +output = """ +generics_mixed_variance_inference.py:13: error: Incompatible types in assignment (expression has type "Mixed[bool, []]", variable has type "Mixed[int, []]") [assignment] +generics_mixed_variance_inference.py:16: error: Incompatible types in assignment (expression has type "Mixed[int, object, []]", variable has type "Mixed[int, int, []]") [assignment] +generics_mixed_variance_inference.py:21: error: Incompatible types in assignment (expression has type "Mixed[int, [bool]]", variable has type "Mixed[int, [int]]") [assignment] +""" diff --git a/conformance/results/mypy/generics_paramspec_variance.toml b/conformance/results/mypy/generics_paramspec_variance.toml new file mode 100644 index 000000000..d6c507362 --- /dev/null +++ b/conformance/results/mypy/generics_paramspec_variance.toml @@ -0,0 +1,60 @@ +conformant = "Unsupported" +conformance_automated = "Fail" +errors_diff = """ +Line 15: Expected 1 errors +Line 30: Expected 1 errors +Line 64: Expected 1 errors +Line 110: Expected 1 errors +Line 121: Expected 1 errors +Line 127: Expected 1 errors +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]'] +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]'] +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]'] +Line 76: Unexpected errors ['generics_paramspec_variance.py:76: error: Argument 1 to "Box" has incompatible type "OutitP[[int]]"; expected "InitP[[int]]" [arg-type]'] +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]'] +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]'] +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]'] +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]'] +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]'] +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]'] +Line 91: Unexpected errors ['generics_paramspec_variance.py:91: error: String argument 1 "InP" to ParamSpec(...) does not match variable name "P" [misc]'] +Line 92: Unexpected errors ['generics_paramspec_variance.py:92: error: The variance and bound arguments to ParamSpec do not have defined semantics yet [misc]'] +Line 97: Unexpected errors ['generics_paramspec_variance.py:97: error: Free type variable expected in Generic[...] [misc]'] +Line 101: Unexpected errors ['generics_paramspec_variance.py:101: error: "InvariantParamSpecOld" expects no type arguments, but 1 given [type-arg]'] +Line 102: Unexpected errors ['generics_paramspec_variance.py:102: error: The type "type[InvariantParamSpecOld]" is not generic and not indexable [misc]'] +Line 117: Unexpected errors ['generics_paramspec_variance.py:117: error: The variance and bound arguments to ParamSpec do not have defined semantics yet [misc]'] +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]'] +""" +output = """ +generics_paramspec_variance.py:14: error: Incompatible types in assignment (expression has type "InvariantParamSpec[[int]]", variable has type "InvariantParamSpec[[object]]") [assignment] +generics_paramspec_variance.py:21: error: Incompatible types in assignment (expression has type "ContravariantParamSpec[[int]]", variable has type "ContravariantParamSpec[[object]]") [assignment] +generics_paramspec_variance.py:31: error: Incompatible types in assignment (expression has type "CovariantParamSpec[[int]]", variable has type "CovariantParamSpec[[object]]") [assignment] +generics_paramspec_variance.py:58: error: Incompatible types in assignment (expression has type "InitP[[NamedArg(int, 'a')]]", variable has type "InitP[[int]]") [assignment] +generics_paramspec_variance.py:60: error: Incompatible types in assignment (expression has type "InitP[[int]]", variable has type "InitP[[Arg(int, 'a')]]") [assignment] +generics_paramspec_variance.py:62: error: Invalid type comment or annotation [valid-type] +generics_paramspec_variance.py:66: error: Incompatible types in assignment (expression has type "InitP[[int, str]]", variable has type "InitP[[int]]") [assignment] +generics_paramspec_variance.py:76: error: Argument 1 to "Box" has incompatible type "OutitP[[int]]"; expected "InitP[[int]]" [arg-type] +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] +generics_paramspec_variance.py:79: error: Incompatible types in assignment (expression has type "InitP[[NamedArg(int, 'a')]]", variable has type "InitP[[int]]") [assignment] +generics_paramspec_variance.py:80: error: Incompatible types in assignment (expression has type "OutitP[[int]]", variable has type "InitP[[int]]") [assignment] +generics_paramspec_variance.py:81: error: Incompatible types in assignment (expression has type "InitP[[int]]", variable has type "InitP[[Arg(int, 'a')]]") [assignment] +generics_paramspec_variance.py:82: error: Incompatible types in assignment (expression has type "OutitP[[int]]", variable has type "InitP[[int]]") [assignment] +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] +generics_paramspec_variance.py:84: error: Incompatible types in assignment (expression has type "OutitP[[int]]", variable has type "InitP[[int]]") [assignment] +generics_paramspec_variance.py:86: error: Incompatible types in assignment (expression has type "OutitP[[int, str]]", variable has type "InitP[[int, str]]") [assignment] +generics_paramspec_variance.py:87: error: Incompatible types in assignment (expression has type "InitP[[int, str]]", variable has type "InitP[[int]]") [assignment] +generics_paramspec_variance.py:91: error: String argument 1 "InP" to ParamSpec(...) does not match variable name "P" [misc] +generics_paramspec_variance.py:92: error: The variance and bound arguments to ParamSpec do not have defined semantics yet [misc] +generics_paramspec_variance.py:93: error: The variance and bound arguments to ParamSpec do not have defined semantics yet [misc] +generics_paramspec_variance.py:94: error: String argument 1 "InvP1" to ParamSpec(...) does not match variable name "InvP2" [misc] +generics_paramspec_variance.py:95: error: String argument 1 "InvP1" to ParamSpec(...) does not match variable name "InvP3" [misc] +generics_paramspec_variance.py:97: error: Free type variable expected in Generic[...] [misc] +generics_paramspec_variance.py:101: error: "InvariantParamSpecOld" expects no type arguments, but 1 given [type-arg] +generics_paramspec_variance.py:102: error: The type "type[InvariantParamSpecOld]" is not generic and not indexable [misc] +generics_paramspec_variance.py:103: error: The type "type[InvariantParamSpecOld]" is not generic and not indexable [misc] +generics_paramspec_variance.py:104: error: The type "type[InvariantParamSpecOld]" is not generic and not indexable [misc] +generics_paramspec_variance.py:114: error: Incompatible types in assignment (expression has type "ContravariantParamSpecOld[[int]]", variable has type "ContravariantParamSpecOld[[object]]") [assignment] +generics_paramspec_variance.py:117: error: The variance and bound arguments to ParamSpec do not have defined semantics yet [misc] +generics_paramspec_variance.py:128: error: Incompatible types in assignment (expression has type "CovariantParamSpecOld[[int]]", variable has type "CovariantParamSpecOld[[object]]") [assignment] +""" diff --git a/conformance/results/mypy/generics_typevartuple_basic.toml b/conformance/results/mypy/generics_typevartuple_basic.toml index c9a734127..5bf562c64 100644 --- a/conformance/results/mypy/generics_typevartuple_basic.toml +++ b/conformance/results/mypy/generics_typevartuple_basic.toml @@ -3,19 +3,19 @@ notes = """ Does not enforce that tuples captured by `TypeVarTuple` are same length. """ output = """ -generics_typevartuple_basic.py:42: error: Argument 1 to "Array" has incompatible type "Height"; expected "tuple[Height, Width]" [arg-type] -generics_typevartuple_basic.py:43: error: Argument 1 to "Array" has incompatible type "tuple[Batch, Width]"; expected "tuple[Batch, Height, Width]" [arg-type] -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] -generics_typevartuple_basic.py:52: error: Free type variable expected in Generic[...] [misc] -generics_typevartuple_basic.py:53: error: TypeVarTuple "Shape" is only valid with an unpack [valid-type] -generics_typevartuple_basic.py:56: error: TypeVarTuple "Shape" is only valid with an unpack [valid-type] -generics_typevartuple_basic.py:59: error: TypeVarTuple "Shape" is only valid with an unpack [valid-type] -generics_typevartuple_basic.py:65: error: Unexpected keyword argument "covariant" for "TypeVarTuple" [misc] +generics_typevartuple_basic.py:43: error: Argument 1 to "Array" has incompatible type "Height"; expected "tuple[Height, Width]" [arg-type] +generics_typevartuple_basic.py:44: error: Argument 1 to "Array" has incompatible type "tuple[Batch, Width]"; expected "tuple[Batch, Height, Width]" [arg-type] +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] +generics_typevartuple_basic.py:53: error: Free type variable expected in Generic[...] [misc] +generics_typevartuple_basic.py:54: error: TypeVarTuple "Shape" is only valid with an unpack [valid-type] +generics_typevartuple_basic.py:57: error: TypeVarTuple "Shape" is only valid with an unpack [valid-type] +generics_typevartuple_basic.py:60: error: TypeVarTuple "Shape" is only valid with an unpack [valid-type] generics_typevartuple_basic.py:66: error: Too many positional arguments for "TypeVarTuple" [misc] generics_typevartuple_basic.py:67: error: Unexpected keyword argument "bound" for "TypeVarTuple" [misc] generics_typevartuple_basic.py:100: error: Cannot infer value of type parameter "Shape" of "multiply" [misc] generics_typevartuple_basic.py:101: error: Cannot infer value of type parameter "Shape" of "multiply" [misc] generics_typevartuple_basic.py:107: error: Can only use one type var tuple in a class def [misc] +generics_typevartuple_basic.py:111: error: Can only use one type var tuple in a class def [misc] """ conformance_automated = "Fail" errors_diff = """ diff --git a/conformance/results/mypy/generics_typevartuple_variance.toml b/conformance/results/mypy/generics_typevartuple_variance.toml new file mode 100644 index 000000000..ca2856d00 --- /dev/null +++ b/conformance/results/mypy/generics_typevartuple_variance.toml @@ -0,0 +1,39 @@ +conformant = "Unsupported" +conformance_automated = "Fail" +errors_diff = """ +Line 14: Expected 1 errors +Line 18: Expected 1 errors +Line 26: Expected 1 errors +Line 29: Expected 1 errors +Line 61: Expected 1 errors +Line 72: Expected 1 errors +Line 76: Expected 1 errors +Line 83: Expected 1 errors +Line 27: Unexpected errors ['generics_typevartuple_variance.py:27: error: Incompatible types in assignment (expression has type "ContravariantTypeVarTuple[object]", variable has type "ContravariantTypeVarTuple[int]") [assignment]'] +Line 28: Unexpected errors ['generics_typevartuple_variance.py:28: error: Incompatible types in assignment (expression has type "ContravariantTypeVarTuple[*tuple[object, ...]]", variable has type "ContravariantTypeVarTuple[*tuple[int, ...]]") [assignment]'] +Line 66: Unexpected errors ['generics_typevartuple_variance.py:66: error: Unexpected keyword argument "contravariant" for "TypeVarTuple" [misc]'] +Line 77: Unexpected errors ['generics_typevartuple_variance.py:77: error: Incompatible types in assignment (expression has type "ContravariantTypeVarTupleOld[object]", variable has type "ContravariantTypeVarTupleOld[int]") [assignment]'] +Line 80: Unexpected errors ['generics_typevartuple_variance.py:80: error: Unexpected keyword argument "covariant" for "TypeVarTuple" [misc]'] +""" +output = """ +generics_typevartuple_variance.py:15: error: Incompatible types in assignment (expression has type "InvariantTypeVarTuple[object]", variable has type "InvariantTypeVarTuple[int]") [assignment] +generics_typevartuple_variance.py:17: error: Incompatible types in assignment (expression has type "InvariantTypeVarTuple[*tuple[object, ...]]", variable has type "InvariantTypeVarTuple[*tuple[int, ...]]") [assignment] +generics_typevartuple_variance.py:27: error: Incompatible types in assignment (expression has type "ContravariantTypeVarTuple[object]", variable has type "ContravariantTypeVarTuple[int]") [assignment] +generics_typevartuple_variance.py:28: error: Incompatible types in assignment (expression has type "ContravariantTypeVarTuple[*tuple[object, ...]]", variable has type "ContravariantTypeVarTuple[*tuple[int, ...]]") [assignment] +generics_typevartuple_variance.py:38: error: Incompatible types in assignment (expression has type "CovariantTypeVarTuple[object]", variable has type "CovariantTypeVarTuple[int]") [assignment] +generics_typevartuple_variance.py:41: error: Incompatible types in assignment (expression has type "CovariantTypeVarTuple[bool, object]", variable has type "CovariantTypeVarTuple[int, int]") [assignment] +generics_typevartuple_variance.py:42: error: Incompatible types in assignment (expression has type "CovariantTypeVarTuple[object, bool]", variable has type "CovariantTypeVarTuple[int, int]") [assignment] +generics_typevartuple_variance.py:43: error: Incompatible types in assignment (expression has type "CovariantTypeVarTuple[object, object]", variable has type "CovariantTypeVarTuple[int, int]") [assignment] +generics_typevartuple_variance.py:44: error: Incompatible types in assignment (expression has type "CovariantTypeVarTuple[*tuple[object, ...]]", variable has type "CovariantTypeVarTuple[*tuple[int, ...]]") [assignment] +generics_typevartuple_variance.py:49: error: Unexpected keyword argument "covariant" for "TypeVarTuple" [misc] +generics_typevartuple_variance.py:49: error: Unexpected keyword argument "contravariant" for "TypeVarTuple" [misc] +generics_typevartuple_variance.py:50: error: Unexpected keyword argument "covariant" for "TypeVarTuple" [misc] +generics_typevartuple_variance.py:50: error: Unexpected keyword argument "infer_variance" for "TypeVarTuple" [misc] +generics_typevartuple_variance.py:51: error: Unexpected keyword argument "covariant" for "TypeVarTuple" [misc] +generics_typevartuple_variance.py:51: error: Unexpected keyword argument "infer_variance" for "TypeVarTuple" [misc] +generics_typevartuple_variance.py:62: error: Incompatible types in assignment (expression has type "InvariantTypeVarTupleOld[object]", variable has type "InvariantTypeVarTupleOld[int]") [assignment] +generics_typevartuple_variance.py:66: error: Unexpected keyword argument "contravariant" for "TypeVarTuple" [misc] +generics_typevartuple_variance.py:77: error: Incompatible types in assignment (expression has type "ContravariantTypeVarTupleOld[object]", variable has type "ContravariantTypeVarTupleOld[int]") [assignment] +generics_typevartuple_variance.py:80: error: Unexpected keyword argument "covariant" for "TypeVarTuple" [misc] +generics_typevartuple_variance.py:90: error: Incompatible types in assignment (expression has type "CovariantTypeVarTupleOld[object]", variable has type "CovariantTypeVarTupleOld[int]") [assignment] +""" diff --git a/conformance/results/mypy/protocols_variance.toml b/conformance/results/mypy/protocols_variance.toml index e434501cf..58d213901 100644 --- a/conformance/results/mypy/protocols_variance.toml +++ b/conformance/results/mypy/protocols_variance.toml @@ -1,15 +1,20 @@ -conformant = "Pass" +conformant = "Partial" +notes = """ +False report of ParamSpec variance keywords. +""" output = """ -protocols_variance.py:21: error: Invariant type variable "T1" used in protocol where covariant one is expected [misc] -protocols_variance.py:40: error: Invariant type variable "T3" used in protocol where contravariant one is expected [misc] -protocols_variance.py:56: error: Invariant type variable "T1" used in protocol where contravariant one is expected [misc] -protocols_variance.py:61: error: Covariant type variable "T1_co" used in protocol where contravariant one is expected [misc] -protocols_variance.py:62: error: Cannot use a covariant type variable as a parameter [misc] -protocols_variance.py:66: error: Invariant type variable "T1" used in protocol where covariant one is expected [misc] -protocols_variance.py:71: error: Contravariant type variable "T1_contra" used in protocol where covariant one is expected [misc] -protocols_variance.py:72: error: Cannot use a contravariant type variable as return type [misc] -protocols_variance.py:104: error: Invariant type variable "T1" used in protocol where covariant one is expected [misc] +protocols_variance.py:15: error: The variance and bound arguments to ParamSpec do not have defined semantics yet [misc] +protocols_variance.py:22: error: Invariant type variable "T1" used in protocol where covariant one is expected [misc] +protocols_variance.py:41: error: Invariant type variable "T3" used in protocol where contravariant one is expected [misc] +protocols_variance.py:57: error: Invariant type variable "T1" used in protocol where contravariant one is expected [misc] +protocols_variance.py:62: error: Covariant type variable "T1_co" used in protocol where contravariant one is expected [misc] +protocols_variance.py:63: error: Cannot use a covariant type variable as a parameter [misc] +protocols_variance.py:67: error: Invariant type variable "T1" used in protocol where covariant one is expected [misc] +protocols_variance.py:72: error: Contravariant type variable "T1_contra" used in protocol where covariant one is expected [misc] +protocols_variance.py:73: error: Cannot use a contravariant type variable as return type [misc] +protocols_variance.py:105: error: Invariant type variable "T1" used in protocol where covariant one is expected [misc] """ -conformance_automated = "Pass" +conformance_automated = "Fail" errors_diff = """ +Line 15: Unexpected errors ['protocols_variance.py:15: error: The variance and bound arguments to ParamSpec do not have defined semantics yet [misc]'] """ diff --git a/conformance/results/pycroscope/generics_mixed_variance_inference.toml b/conformance/results/pycroscope/generics_mixed_variance_inference.toml new file mode 100644 index 000000000..6aa55eb89 --- /dev/null +++ b/conformance/results/pycroscope/generics_mixed_variance_inference.toml @@ -0,0 +1,20 @@ +conformant = "Unsupported" +conformance_automated = "Fail" +errors_diff = """ +Line 8: Unexpected errors ['./generics_mixed_variance_inference.py:8:32: Traceback (most recent call last):', './generics_mixed_variance_inference.py:8:4: Traceback (most recent call last):'] +Line 12: Unexpected errors ['./generics_mixed_variance_inference.py:12:0: Incompatible assignment: expected generics_mixed_variance_inference.Mixed[int, Any[error]], got generics_mixed_variance_inference.Mixed[object, AnySig()] [incompatible_assignment]', './generics_mixed_variance_inference.py:12:4: Invalid type annotation [] [invalid_annotation]'] +Line 17: Unexpected errors ['./generics_mixed_variance_inference.py:17:0: Incompatible assignment: expected generics_mixed_variance_inference.Mixed[int, int, ], got generics_mixed_variance_inference.Mixed[int, bool, AnySig()] [incompatible_assignment]'] +Line 20: Unexpected errors ["./generics_mixed_variance_inference.py:20:4: Invalid type annotation [] [invalid_annotation]"] +""" +output = """ +./generics_mixed_variance_inference.py:8:32: Traceback (most recent call last): +./generics_mixed_variance_inference.py:8:4: Traceback (most recent call last): +./generics_mixed_variance_inference.py:12:0: Incompatible assignment: expected generics_mixed_variance_inference.Mixed[int, Any[error]], got generics_mixed_variance_inference.Mixed[object, AnySig()] [incompatible_assignment] +./generics_mixed_variance_inference.py:12:4: Invalid type annotation [] [invalid_annotation] +./generics_mixed_variance_inference.py:13:0: Incompatible assignment: expected generics_mixed_variance_inference.Mixed[int, Any[error]], got generics_mixed_variance_inference.Mixed[bool, AnySig()] [incompatible_assignment] +./generics_mixed_variance_inference.py:13:4: Invalid type annotation [] [invalid_annotation] +./generics_mixed_variance_inference.py:16:0: Incompatible assignment: expected generics_mixed_variance_inference.Mixed[int, int, ], got generics_mixed_variance_inference.Mixed[int, object, AnySig()] [incompatible_assignment] +./generics_mixed_variance_inference.py:17:0: Incompatible assignment: expected generics_mixed_variance_inference.Mixed[int, int, ], got generics_mixed_variance_inference.Mixed[int, bool, AnySig()] [incompatible_assignment] +./generics_mixed_variance_inference.py:20:4: Invalid type annotation [] [invalid_annotation] +./generics_mixed_variance_inference.py:21:4: Invalid type annotation [] [invalid_annotation] +""" diff --git a/conformance/results/pycroscope/generics_paramspec_variance.toml b/conformance/results/pycroscope/generics_paramspec_variance.toml new file mode 100644 index 000000000..3e4872f89 --- /dev/null +++ b/conformance/results/pycroscope/generics_paramspec_variance.toml @@ -0,0 +1,49 @@ +conformant = "Unsupported" +conformance_automated = "Fail" +errors_diff = """ +Line 64: Expected 1 errors +Line 110: Expected 1 errors +Line 121: Expected 1 errors +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):'] +Line 22: Unexpected errors ['./generics_paramspec_variance.py:22:38: Traceback (most recent call last):'] +Line 31: Unexpected errors ['./generics_paramspec_variance.py:31:38: Traceback (most recent call last):'] +Line 58: Unexpected errors ["./generics_paramspec_variance.py:58:0: Incompatible types in assignment to attribute 't': expected ./generics_paramspec_variance.py.InitP~[(a: int) -> Any[unannotated]], got ./generics_paramspec_variance.py.InitP~[(*, a: int) -> Any[unannotated]] [incompatible_assignment]"] +Line 60: Unexpected errors ["./generics_paramspec_variance.py:60:0: Incompatible types in assignment to attribute 't': expected ./generics_paramspec_variance.py.InitP~[(a: int) -> Any[unannotated]], got ./generics_paramspec_variance.py.InitP~[(a: int, /) -> Any[unannotated]] [incompatible_assignment]"] +Line 83: Unexpected errors ['./generics_paramspec_variance.py:83:3: Traceback (most recent call last):', './generics_paramspec_variance.py:83:0: _ already declared [already_declared]'] +Line 91: Unexpected errors ["./generics_paramspec_variance.py:91:14: ParamSpec named 'InP' must be assigned to a variable with the same name [must_have_same_name]"] +Line 102: Unexpected errors ['./generics_paramspec_variance.py:102:13: Traceback (most recent call last):'] +Line 115: Unexpected errors ['./generics_paramspec_variance.py:115:45: Traceback (most recent call last):'] +Line 128: Unexpected errors ['./generics_paramspec_variance.py:128:45: Traceback (most recent call last):'] +""" +output = """ +./generics_paramspec_variance.py:14:41: Traceback (most recent call last): +./generics_paramspec_variance.py:15:38: Traceback (most recent call last): +./generics_paramspec_variance.py:19:23: Traceback (most recent call last): +./generics_paramspec_variance.py:19:4: Traceback (most recent call last): +./generics_paramspec_variance.py:21:41: Traceback (most recent call last): +./generics_paramspec_variance.py:22:38: Traceback (most recent call last): +./generics_paramspec_variance.py:30:35: Traceback (most recent call last): +./generics_paramspec_variance.py:31:38: Traceback (most recent call last): +./generics_paramspec_variance.py:58:0: Incompatible types in assignment to attribute 't': expected ./generics_paramspec_variance.py.InitP~[(a: int) -> Any[unannotated]], got ./generics_paramspec_variance.py.InitP~[(*, a: int) -> Any[unannotated]] [incompatible_assignment] +./generics_paramspec_variance.py:60:0: Incompatible types in assignment to attribute 't': expected ./generics_paramspec_variance.py.InitP~[(a: int) -> Any[unannotated]], got ./generics_paramspec_variance.py.InitP~[(a: int, /) -> Any[unannotated]] [incompatible_assignment] +./generics_paramspec_variance.py:62:3: Traceback (most recent call last): +./generics_paramspec_variance.py:66:0: Incompatible types in assignment to attribute 't': expected ./generics_paramspec_variance.py.InitP~[(a: int) -> Any[unannotated]], got ./generics_paramspec_variance.py.InitP~[(a: int, b: str) -> Any[unannotated]] [incompatible_assignment] +./generics_paramspec_variance.py:79:0: Incompatible types in assignment to attribute 't': expected ./generics_paramspec_variance.py.OutitP~[(a: int) -> Any[unannotated]], got ./generics_paramspec_variance.py.OutitP~[(*, a: int) -> Any[unannotated]] [incompatible_assignment] +./generics_paramspec_variance.py:81:0: Incompatible types in assignment to attribute 't': expected ./generics_paramspec_variance.py.OutitP~[(a: int) -> Any[unannotated]], got ./generics_paramspec_variance.py.OutitP~[(a: int, /) -> Any[unannotated]] [incompatible_assignment] +./generics_paramspec_variance.py:83:3: Traceback (most recent call last): +./generics_paramspec_variance.py:83:0: _ already declared [already_declared] +./generics_paramspec_variance.py:87:0: Incompatible types in assignment to attribute 't': expected ./generics_paramspec_variance.py.OutitP~[(a: int) -> Any[unannotated]], got ./generics_paramspec_variance.py.OutitP~[(a: int, b: str) -> Any[unannotated]] [incompatible_assignment] +./generics_paramspec_variance.py:91:14: ParamSpec named 'InP' must be assigned to a variable with the same name [must_have_same_name] +./generics_paramspec_variance.py:93:8: Error calling (name: str, /, *, bound: object = no argument given, covariant: bool = Literal[False], contravariant: bool = Literal[False], infer_variance: bool = Literal[False], default: object = no argument given) -> typing.ParamSpec (with impl): Bivariant types are not supported. [incompatible_call] +./generics_paramspec_variance.py:94:8: Error calling (name: str, /, *, bound: object = no argument given, covariant: bool = Literal[False], contravariant: bool = Literal[False], infer_variance: bool = Literal[False], default: object = no argument given) -> typing.ParamSpec (with impl): Variance cannot be specified with infer_variance. [incompatible_call] +./generics_paramspec_variance.py:94:18: ParamSpec named 'InvP1' must be assigned to a variable with the same name [must_have_same_name] +./generics_paramspec_variance.py:95:8: Error calling (name: str, /, *, bound: object = no argument given, covariant: bool = Literal[False], contravariant: bool = Literal[False], infer_variance: bool = Literal[False], default: object = no argument given) -> typing.ParamSpec (with impl): Variance cannot be specified with infer_variance. [incompatible_call] +./generics_paramspec_variance.py:95:18: ParamSpec named 'InvP1' must be assigned to a variable with the same name [must_have_same_name] +./generics_paramspec_variance.py:102:13: Traceback (most recent call last): +./generics_paramspec_variance.py:103:13: Traceback (most recent call last): +./generics_paramspec_variance.py:104:13: Traceback (most recent call last): +./generics_paramspec_variance.py:114:48: Traceback (most recent call last): +./generics_paramspec_variance.py:115:45: Traceback (most recent call last): +./generics_paramspec_variance.py:127:42: Traceback (most recent call last): +./generics_paramspec_variance.py:128:45: Traceback (most recent call last): +""" diff --git a/conformance/results/pycroscope/generics_typevartuple_basic.toml b/conformance/results/pycroscope/generics_typevartuple_basic.toml index 842c7ca46..7438d8115 100644 --- a/conformance/results/pycroscope/generics_typevartuple_basic.toml +++ b/conformance/results/pycroscope/generics_typevartuple_basic.toml @@ -1,15 +1,19 @@ -conformance_automated = "Pass" +conformant = "Partial" +conformance_automated = "Fail" +notes = """ +doesn't error when there are multiple type var tuples in a definition +""" errors_diff = """ +Line 111: Expected 1 errors """ output = """ -./generics_typevartuple_basic.py:42:33: Incompatible argument type for shape: expected tuple[*tuple[Shape, ...]] but got NewType('Height', int) [incompatible_argument] -./generics_typevartuple_basic.py:43:0: Incompatible assignment: expected ./generics_typevartuple_basic.py.Array[NewType('Batch', int), NewType('Height', int), NewType('Width', int)], got ./generics_typevartuple_basic.py.Array~[NewType('Batch', int), NewType('Width', int)] [incompatible_assignment] -./generics_typevartuple_basic.py:44:0: Incompatible assignment: expected ./generics_typevartuple_basic.py.Array[NewType('Time', int), NewType('Batch', int), NewType('Height', int), NewType('Width', int)], got ./generics_typevartuple_basic.py.Array~[NewType('Time', int), NewType('Batch', int), NewType('Width', int), NewType('Height', int)] [incompatible_assignment] -./generics_typevartuple_basic.py:52:21: TypeVarTuple must be unpacked [invalid_base] -./generics_typevartuple_basic.py:53:30: TypeVarTuple must be unpacked [invalid_annotation] -./generics_typevartuple_basic.py:56:27: TypeVarTuple must be unpacked [invalid_annotation] -./generics_typevartuple_basic.py:59:17: TypeVarTuple must be unpacked [invalid_annotation] -./generics_typevartuple_basic.py:65:6: In call to typing.TypeVarTuple: Got an unexpected keyword argument 'covariant' [incompatible_call] +./generics_typevartuple_basic.py:43:33: Incompatible argument type for shape: expected tuple[*tuple[Shape, ...]] but got NewType('Height', int) [incompatible_argument] +./generics_typevartuple_basic.py:44:0: Incompatible assignment: expected ./generics_typevartuple_basic.py.Array[NewType('Batch', int), NewType('Height', int), NewType('Width', int)], got ./generics_typevartuple_basic.py.Array~[NewType('Batch', int), NewType('Width', int)] [incompatible_assignment] +./generics_typevartuple_basic.py:45:0: Incompatible assignment: expected ./generics_typevartuple_basic.py.Array[NewType('Time', int), NewType('Batch', int), NewType('Height', int), NewType('Width', int)], got ./generics_typevartuple_basic.py.Array~[NewType('Time', int), NewType('Batch', int), NewType('Width', int), NewType('Height', int)] [incompatible_assignment] +./generics_typevartuple_basic.py:53:21: TypeVarTuple must be unpacked [invalid_base] +./generics_typevartuple_basic.py:54:30: TypeVarTuple must be unpacked [invalid_annotation] +./generics_typevartuple_basic.py:57:27: TypeVarTuple must be unpacked [invalid_annotation] +./generics_typevartuple_basic.py:60:17: TypeVarTuple must be unpacked [invalid_annotation] ./generics_typevartuple_basic.py:66:6: In call to typing.TypeVarTuple: Takes 1 positional arguments but 3 were given [incompatible_call] ./generics_typevartuple_basic.py:67:6: In call to typing.TypeVarTuple: Got an unexpected keyword argument 'bound' [incompatible_call] ./generics_typevartuple_basic.py:91:0: Cannot resolve type variables [incompatible_call] diff --git a/conformance/results/pycroscope/generics_typevartuple_variance.toml b/conformance/results/pycroscope/generics_typevartuple_variance.toml new file mode 100644 index 000000000..7788ce48a --- /dev/null +++ b/conformance/results/pycroscope/generics_typevartuple_variance.toml @@ -0,0 +1,40 @@ +conformant = "Unsupported" +conformance_automated = "Fail" +errors_diff = """ +Line 49: Expected 1 errors +Line 50: Expected 1 errors +Line 51: Expected 1 errors +Line 72: Expected 1 errors +Line 83: Expected 1 errors +Line 27: Unexpected errors ['./generics_typevartuple_variance.py:27:0: Incompatible assignment: expected generics_typevartuple_variance.ContravariantTypeVarTuple[int], got generics_typevartuple_variance.ContravariantTypeVarTuple[object] [incompatible_assignment]'] +Line 28: Unexpected errors ['./generics_typevartuple_variance.py:28:0: Incompatible assignment: expected generics_typevartuple_variance.ContravariantTypeVarTuple[*tuple[int, ...]], got generics_typevartuple_variance.ContravariantTypeVarTuple[tuple[object, ...]] [incompatible_assignment]'] +Line 39: Unexpected errors ['./generics_typevartuple_variance.py:39:0: Incompatible assignment: expected generics_typevartuple_variance.CovariantTypeVarTuple[object], got generics_typevartuple_variance.CovariantTypeVarTuple[int] [incompatible_assignment]'] +Line 40: Unexpected errors ['./generics_typevartuple_variance.py:40:0: Incompatible assignment: expected generics_typevartuple_variance.CovariantTypeVarTuple[int, int], got generics_typevartuple_variance.CovariantTypeVarTuple[bool, bool] [incompatible_assignment]'] +Line 45: Unexpected errors ['./generics_typevartuple_variance.py:45:0: Incompatible assignment: expected generics_typevartuple_variance.CovariantTypeVarTuple[*tuple[object, ...]], got generics_typevartuple_variance.CovariantTypeVarTuple[tuple[int, ...]] [incompatible_assignment]'] +Line 77: Unexpected errors ['./generics_typevartuple_variance.py:77:0: Incompatible assignment: expected generics_typevartuple_variance.ContravariantTypeVarTupleOld[int], got generics_typevartuple_variance.ContravariantTypeVarTupleOld[object] [incompatible_assignment]'] +Line 91: Unexpected errors ['./generics_typevartuple_variance.py:91:0: Incompatible assignment: expected generics_typevartuple_variance.CovariantTypeVarTupleOld[object], got generics_typevartuple_variance.CovariantTypeVarTupleOld[int] [incompatible_assignment]'] +""" +output = """ +./generics_typevartuple_variance.py:14:0: Incompatible assignment: expected generics_typevartuple_variance.InvariantTypeVarTuple[object], got generics_typevartuple_variance.InvariantTypeVarTuple[int] [incompatible_assignment] +./generics_typevartuple_variance.py:15:0: Incompatible assignment: expected generics_typevartuple_variance.InvariantTypeVarTuple[int], got generics_typevartuple_variance.InvariantTypeVarTuple[object] [incompatible_assignment] +./generics_typevartuple_variance.py:17:0: Incompatible assignment: expected generics_typevartuple_variance.InvariantTypeVarTuple[*tuple[int, ...]], got generics_typevartuple_variance.InvariantTypeVarTuple[tuple[object, ...]] [incompatible_assignment] +./generics_typevartuple_variance.py:18:0: Incompatible assignment: expected generics_typevartuple_variance.InvariantTypeVarTuple[*tuple[object, ...]], got generics_typevartuple_variance.InvariantTypeVarTuple[tuple[int, ...]] [incompatible_assignment] +./generics_typevartuple_variance.py:26:0: Incompatible assignment: expected generics_typevartuple_variance.ContravariantTypeVarTuple[object, object], got generics_typevartuple_variance.ContravariantTypeVarTuple[object, int] [incompatible_assignment] +./generics_typevartuple_variance.py:27:0: Incompatible assignment: expected generics_typevartuple_variance.ContravariantTypeVarTuple[int], got generics_typevartuple_variance.ContravariantTypeVarTuple[object] [incompatible_assignment] +./generics_typevartuple_variance.py:28:0: Incompatible assignment: expected generics_typevartuple_variance.ContravariantTypeVarTuple[*tuple[int, ...]], got generics_typevartuple_variance.ContravariantTypeVarTuple[tuple[object, ...]] [incompatible_assignment] +./generics_typevartuple_variance.py:29:0: Incompatible assignment: expected generics_typevartuple_variance.ContravariantTypeVarTuple[*tuple[object, ...]], got generics_typevartuple_variance.ContravariantTypeVarTuple[tuple[int, ...]] [incompatible_assignment] +./generics_typevartuple_variance.py:38:0: Incompatible assignment: expected generics_typevartuple_variance.CovariantTypeVarTuple[int], got generics_typevartuple_variance.CovariantTypeVarTuple[object] [incompatible_assignment] +./generics_typevartuple_variance.py:39:0: Incompatible assignment: expected generics_typevartuple_variance.CovariantTypeVarTuple[object], got generics_typevartuple_variance.CovariantTypeVarTuple[int] [incompatible_assignment] +./generics_typevartuple_variance.py:40:0: Incompatible assignment: expected generics_typevartuple_variance.CovariantTypeVarTuple[int, int], got generics_typevartuple_variance.CovariantTypeVarTuple[bool, bool] [incompatible_assignment] +./generics_typevartuple_variance.py:41:0: Incompatible assignment: expected generics_typevartuple_variance.CovariantTypeVarTuple[int, int], got generics_typevartuple_variance.CovariantTypeVarTuple[bool, object] [incompatible_assignment] +./generics_typevartuple_variance.py:42:0: Incompatible assignment: expected generics_typevartuple_variance.CovariantTypeVarTuple[int, int], got generics_typevartuple_variance.CovariantTypeVarTuple[object, bool] [incompatible_assignment] +./generics_typevartuple_variance.py:43:0: Incompatible assignment: expected generics_typevartuple_variance.CovariantTypeVarTuple[int, int], got generics_typevartuple_variance.CovariantTypeVarTuple[object, object] [incompatible_assignment] +./generics_typevartuple_variance.py:44:0: Incompatible assignment: expected generics_typevartuple_variance.CovariantTypeVarTuple[*tuple[int, ...]], got generics_typevartuple_variance.CovariantTypeVarTuple[tuple[object, ...]] [incompatible_assignment] +./generics_typevartuple_variance.py:45:0: Incompatible assignment: expected generics_typevartuple_variance.CovariantTypeVarTuple[*tuple[object, ...]], got generics_typevartuple_variance.CovariantTypeVarTuple[tuple[int, ...]] [incompatible_assignment] +./generics_typevartuple_variance.py:61:0: Incompatible assignment: expected generics_typevartuple_variance.InvariantTypeVarTupleOld[object], got generics_typevartuple_variance.InvariantTypeVarTupleOld[int] [incompatible_assignment] +./generics_typevartuple_variance.py:62:0: Incompatible assignment: expected generics_typevartuple_variance.InvariantTypeVarTupleOld[int], got generics_typevartuple_variance.InvariantTypeVarTupleOld[object] [incompatible_assignment] +./generics_typevartuple_variance.py:76:0: Incompatible assignment: expected generics_typevartuple_variance.ContravariantTypeVarTupleOld[object], got generics_typevartuple_variance.ContravariantTypeVarTupleOld[int] [incompatible_assignment] +./generics_typevartuple_variance.py:77:0: Incompatible assignment: expected generics_typevartuple_variance.ContravariantTypeVarTupleOld[int], got generics_typevartuple_variance.ContravariantTypeVarTupleOld[object] [incompatible_assignment] +./generics_typevartuple_variance.py:90:0: Incompatible assignment: expected generics_typevartuple_variance.CovariantTypeVarTupleOld[int], got generics_typevartuple_variance.CovariantTypeVarTupleOld[object] [incompatible_assignment] +./generics_typevartuple_variance.py:91:0: Incompatible assignment: expected generics_typevartuple_variance.CovariantTypeVarTupleOld[object], got generics_typevartuple_variance.CovariantTypeVarTupleOld[int] [incompatible_assignment] +""" diff --git a/conformance/results/pycroscope/literals_parameterizations.toml b/conformance/results/pycroscope/literals_parameterizations.toml index 80a88342d..d6be8e851 100644 --- a/conformance/results/pycroscope/literals_parameterizations.toml +++ b/conformance/results/pycroscope/literals_parameterizations.toml @@ -16,7 +16,7 @@ output = """ ./literals_parameterizations.py:43:6: Arguments to Literal[] must be None, bool, int, str, bytes, or enum members; got (4+3j) [invalid_literal] ./literals_parameterizations.py:47:6: Arguments to Literal[] must be None, bool, int, str, bytes, or enum members; got {'a': 'b', 'c': 'd'} [invalid_literal] ./literals_parameterizations.py:48:6: Arguments to Literal[] must be None, bool, int, str, bytes, or enum members; got [invalid_literal] -./literals_parameterizations.py:50:7: Arguments to Literal[] must be literals, not (PartialCallValue(callee=KnownValue(val=), arguments={'name': KnownValue(val='T'), 'constraints': SequenceValue(typ=, literal_only=False, args=(MultiValuedValue(vals=()),), weak=True, members=()), 'bound': KnownValue(val=), 'covariant': KnownValue(val=False), 'contravariant': KnownValue(val=False), 'infer_variance': KnownValue(val=False), 'default': KnownValue(val=)}, runtime_value=TypedValue(typ=, literal_only=False), node=),) [invalid_literal] +./literals_parameterizations.py:50:7: Arguments to Literal[] must be literals, not (PartialCallValue(callee=KnownValue(val=), arguments={'name': KnownValue(val='T'), 'constraints': SequenceValue(typ=, literal_only=False, args=(MultiValuedValue(vals=()),), weak=True, members=()), 'bound': KnownValue(val=no argument given), 'covariant': KnownValue(val=False), 'contravariant': KnownValue(val=False), 'infer_variance': KnownValue(val=False), 'default': KnownValue(val=no argument given)}, runtime_value=TypedValue(typ=, literal_only=False), node=),) [invalid_literal] ./literals_parameterizations.py:50:15: Type parameter is not valid in this annotation context [invalid_annotation] ./literals_parameterizations.py:51:7: Arguments to Literal[] must be None, bool, int, str, bytes, or enum members; got 3.14 [invalid_literal] ./literals_parameterizations.py:52:7: Arguments to Literal[] must be None, bool, int, str, bytes, or enum members; got typing.Any [invalid_literal] diff --git a/conformance/results/pycroscope/protocols_variance.toml b/conformance/results/pycroscope/protocols_variance.toml index 70d6e1c4b..43efcf3a7 100644 --- a/conformance/results/pycroscope/protocols_variance.toml +++ b/conformance/results/pycroscope/protocols_variance.toml @@ -2,11 +2,11 @@ conformance_automated = "Pass" errors_diff = """ """ output = """ -./protocols_variance.py:21:0: T1 should be covariant [invalid_protocol] -./protocols_variance.py:40:0: T3 should be contravariant [invalid_protocol] -./protocols_variance.py:56:0: T1 should be contravariant [invalid_protocol] -./protocols_variance.py:61:0: T1_co should be contravariant [invalid_protocol] -./protocols_variance.py:66:0: T1 should be covariant [invalid_protocol] -./protocols_variance.py:71:0: T1_contra should be covariant [invalid_protocol] -./protocols_variance.py:104:0: T1 should be covariant [invalid_protocol] +./protocols_variance.py:22:0: T1 should be covariant [invalid_protocol] +./protocols_variance.py:41:0: T3 should be contravariant [invalid_protocol] +./protocols_variance.py:57:0: T1 should be contravariant [invalid_protocol] +./protocols_variance.py:62:0: T1_co should be contravariant [invalid_protocol] +./protocols_variance.py:67:0: T1 should be covariant [invalid_protocol] +./protocols_variance.py:72:0: T1_contra should be covariant [invalid_protocol] +./protocols_variance.py:105:0: T1 should be covariant [invalid_protocol] """ diff --git a/conformance/results/pycroscope/specialtypes_sentinels.toml b/conformance/results/pycroscope/specialtypes_sentinels.toml index 4c2425384..77f5d331c 100644 --- a/conformance/results/pycroscope/specialtypes_sentinels.toml +++ b/conformance/results/pycroscope/specialtypes_sentinels.toml @@ -3,6 +3,6 @@ errors_diff = """ """ output = """ ./specialtypes_sentinels.py:14:10: Default value for argument x incompatible with declared type int [incompatible_default] -./specialtypes_sentinels.py:36:6: Incompatible argument type for x: expected int | Literal[<>, ] but got [incompatible_argument] -./specialtypes_sentinels.py:39:6: Incompatible argument type for x: expected int | Literal[] but got <> [incompatible_argument] +./specialtypes_sentinels.py:36:6: Incompatible argument type for x: expected int | Literal[, SPECIAL] but got Cls.IN_CLASS [incompatible_argument] +./specialtypes_sentinels.py:39:6: Incompatible argument type for x: expected int | Literal[Cls.IN_CLASS] but got [incompatible_argument] """ diff --git a/conformance/results/pyrefly/generics_mixed_variance_inference.toml b/conformance/results/pyrefly/generics_mixed_variance_inference.toml new file mode 100644 index 000000000..862cfd90f --- /dev/null +++ b/conformance/results/pyrefly/generics_mixed_variance_inference.toml @@ -0,0 +1,13 @@ +conformant = "Unsupported" +conformance_automated = "Fail" +errors_diff = """ +Line 21: Expected 1 errors +Line 17: Unexpected errors ['`Mixed[int, bool, []]` is not assignable to `Mixed[int, int, []]` [bad-assignment]'] +Line 20: Unexpected errors ['`Mixed[int, *tuple[()], [object]]` is not assignable to `Mixed[int, *tuple[()], [int]]` [bad-assignment]'] +""" +output = """ +ERROR generics_mixed_variance_inference.py:13:22-39: `Mixed[bool, *tuple[()], []]` is not assignable to `Mixed[int, *tuple[()], []]` [bad-assignment] +ERROR generics_mixed_variance_inference.py:16:27-51: `Mixed[int, object, []]` is not assignable to `Mixed[int, int, []]` [bad-assignment] +ERROR generics_mixed_variance_inference.py:17:27-49: `Mixed[int, bool, []]` is not assignable to `Mixed[int, int, []]` [bad-assignment] +ERROR generics_mixed_variance_inference.py:20:25-47: `Mixed[int, *tuple[()], [object]]` is not assignable to `Mixed[int, *tuple[()], [int]]` [bad-assignment] +""" diff --git a/conformance/results/pyrefly/generics_paramspec_variance.toml b/conformance/results/pyrefly/generics_paramspec_variance.toml new file mode 100644 index 000000000..b04a2ded0 --- /dev/null +++ b/conformance/results/pyrefly/generics_paramspec_variance.toml @@ -0,0 +1,46 @@ +conformant = "Unsupported" +conformance_automated = "Fail" +errors_diff = """ +Line 14: Expected 1 errors +Line 21: Expected 1 errors +Line 30: Expected 1 errors +Line 110: Expected 1 errors +Line 121: Expected 1 errors +Line 22: Unexpected errors ['`ContravariantParamSpec[[object]]` is not assignable to `ContravariantParamSpec[[int]]` [bad-assignment]'] +Line 31: Unexpected errors ['`CovariantParamSpec[[int]]` is not assignable to `CovariantParamSpec[[object]]` [bad-assignment]'] +Line 83: Unexpected errors ['Function call cannot be used in annotations [invalid-annotation]'] +Line 91: Unexpected errors ['ParamSpec must be assigned to a variable named `InP` [invalid-param-spec]'] +Line 92: Unexpected errors ['Unexpected keyword argument `contravariant` to ParamSpec [invalid-param-spec]'] +Line 115: Unexpected errors ['`ContravariantParamSpecOld[[object]]` is not assignable to `ContravariantParamSpecOld[[int]]` [bad-assignment]'] +Line 117: Unexpected errors ['Unexpected keyword argument `covariant` to ParamSpec [invalid-param-spec]'] +Line 128: Unexpected errors ['`CovariantParamSpecOld[[int]]` is not assignable to `CovariantParamSpecOld[[object]]` [bad-assignment]'] +""" +output = """ +ERROR generics_paramspec_variance.py:15:39-67: `InvariantParamSpec[[object]]` is not assignable to `InvariantParamSpec[[int]]` [bad-assignment] +ERROR generics_paramspec_variance.py:22:39-71: `ContravariantParamSpec[[object]]` is not assignable to `ContravariantParamSpec[[int]]` [bad-assignment] +ERROR generics_paramspec_variance.py:31:39-64: `CovariantParamSpec[[int]]` is not assignable to `CovariantParamSpec[[object]]` [bad-assignment] +ERROR generics_paramspec_variance.py:62:4-16: Function call cannot be used in annotations [invalid-annotation] +ERROR generics_paramspec_variance.py:64:9-18: `InitP[[a: int = 1]]` is not assignable to attribute `t` with type `InitP[[a: int]]` [bad-assignment] +ERROR generics_paramspec_variance.py:66:9-16: `InitP[[a: int, b: str]]` is not assignable to attribute `t` with type `InitP[[a: int]]` [bad-assignment] +ERROR generics_paramspec_variance.py:79:9-13: `OutitP[[*, a: int]]` is not assignable to attribute `t` with type `OutitP[[a: int]]` [bad-assignment] +ERROR generics_paramspec_variance.py:81:9-14: `OutitP[[a: int, /]]` is not assignable to attribute `t` with type `OutitP[[a: int]]` [bad-assignment] +ERROR generics_paramspec_variance.py:83:4-17: Function call cannot be used in annotations [invalid-annotation] +ERROR generics_paramspec_variance.py:87:9-16: `OutitP[[a: int, b: str]]` is not assignable to attribute `t` with type `OutitP[[a: int]]` [bad-assignment] +ERROR generics_paramspec_variance.py:91:5-21: ParamSpec must be assigned to a variable named `InP` [invalid-param-spec] +ERROR generics_paramspec_variance.py:92:24-42: Unexpected keyword argument `contravariant` to ParamSpec [invalid-param-spec] +ERROR generics_paramspec_variance.py:93:28-42: Unexpected keyword argument `covariant` to ParamSpec [invalid-param-spec] +ERROR generics_paramspec_variance.py:93:44-62: Unexpected keyword argument `contravariant` to ParamSpec [invalid-param-spec] +ERROR generics_paramspec_variance.py:94:9-64: ParamSpec must be assigned to a variable named `InvP1` [invalid-param-spec] +ERROR generics_paramspec_variance.py:94:28-42: Unexpected keyword argument `covariant` to ParamSpec [invalid-param-spec] +ERROR generics_paramspec_variance.py:94:44-63: Unexpected keyword argument `infer_variance` to ParamSpec [invalid-param-spec] +ERROR generics_paramspec_variance.py:95:9-68: ParamSpec must be assigned to a variable named `InvP1` [invalid-param-spec] +ERROR generics_paramspec_variance.py:95:28-46: Unexpected keyword argument `contravariant` to ParamSpec [invalid-param-spec] +ERROR generics_paramspec_variance.py:95:48-67: Unexpected keyword argument `infer_variance` to ParamSpec [invalid-param-spec] +ERROR generics_paramspec_variance.py:103:14-43: `InvariantParamSpecOld[[bool]]` is not assignable to variable `in_out_old` with type `InvariantParamSpecOld[[int]]` [bad-assignment] +ERROR generics_paramspec_variance.py:104:14-45: `InvariantParamSpecOld[[object]]` is not assignable to variable `in_out_old` with type `InvariantParamSpecOld[[int]]` [bad-assignment] +ERROR generics_paramspec_variance.py:114:49-81: `ContravariantParamSpecOld[[int]]` is not assignable to `ContravariantParamSpecOld[[object]]` [bad-assignment] +ERROR generics_paramspec_variance.py:115:46-81: `ContravariantParamSpecOld[[object]]` is not assignable to `ContravariantParamSpecOld[[int]]` [bad-assignment] +ERROR generics_paramspec_variance.py:117:26-40: Unexpected keyword argument `covariant` to ParamSpec [invalid-param-spec] +ERROR generics_paramspec_variance.py:127:43-74: `CovariantParamSpecOld[[object]]` is not assignable to `CovariantParamSpecOld[[int]]` [bad-assignment] +ERROR generics_paramspec_variance.py:128:46-74: `CovariantParamSpecOld[[int]]` is not assignable to `CovariantParamSpecOld[[object]]` [bad-assignment] +""" diff --git a/conformance/results/pyrefly/generics_typevartuple_basic.toml b/conformance/results/pyrefly/generics_typevartuple_basic.toml index e4437865d..df28e1648 100644 --- a/conformance/results/pyrefly/generics_typevartuple_basic.toml +++ b/conformance/results/pyrefly/generics_typevartuple_basic.toml @@ -3,18 +3,18 @@ conformance_automated = "Pass" errors_diff = """ """ output = """ -ERROR generics_typevartuple_basic.py:42:34-43: Argument `Height` is not assignable to parameter `shape` with type `tuple[*@_]` in function `Array.__init__` [bad-argument-type] -ERROR generics_typevartuple_basic.py:43:35-62: `Array[Batch, Width]` is not assignable to `Array[Batch, Height, Width]` [bad-assignment] -ERROR generics_typevartuple_basic.py:44:41-46:2: `Array[Time, Batch, Width, Height]` is not assignable to `Array[Time, Batch, Height, Width]` [bad-assignment] -ERROR generics_typevartuple_basic.py:52:22-27: `TypeVarTuple` must be unpacked [invalid-annotation] -ERROR generics_typevartuple_basic.py:53:37-42: `TypeVarTuple` must be unpacked [invalid-type-var-tuple] -ERROR generics_typevartuple_basic.py:56:34-39: `TypeVarTuple` must be unpacked [invalid-type-var-tuple] -ERROR generics_typevartuple_basic.py:59:24-29: `TypeVarTuple` must be unpacked [invalid-annotation] -ERROR generics_typevartuple_basic.py:65:27-41: Unexpected keyword argument `covariant` to TypeVarTuple [invalid-type-var-tuple] +ERROR generics_typevartuple_basic.py:43:34-43: Argument `Height` is not assignable to parameter `shape` with type `tuple[*@_]` in function `Array.__init__` [bad-argument-type] +ERROR generics_typevartuple_basic.py:44:35-62: `Array[Batch, Width]` is not assignable to `Array[Batch, Height, Width]` [bad-assignment] +ERROR generics_typevartuple_basic.py:45:41-47:2: `Array[Time, Batch, Width, Height]` is not assignable to `Array[Time, Batch, Height, Width]` [bad-assignment] +ERROR generics_typevartuple_basic.py:53:22-27: `TypeVarTuple` must be unpacked [invalid-annotation] +ERROR generics_typevartuple_basic.py:54:37-42: `TypeVarTuple` must be unpacked [invalid-type-var-tuple] +ERROR generics_typevartuple_basic.py:57:34-39: `TypeVarTuple` must be unpacked [invalid-type-var-tuple] +ERROR generics_typevartuple_basic.py:60:24-29: `TypeVarTuple` must be unpacked [invalid-annotation] ERROR generics_typevartuple_basic.py:66:27-30: Unexpected positional argument to TypeVarTuple [invalid-type-var-tuple] ERROR generics_typevartuple_basic.py:67:27-36: Unexpected keyword argument `bound` to TypeVarTuple [invalid-type-var-tuple] ERROR generics_typevartuple_basic.py:91:15-19: Argument `tuple[Literal[0]]` is not assignable to parameter `arg2` with type `tuple[int, int]` in function `func2` [bad-argument-type] ERROR generics_typevartuple_basic.py:100:17-18: Argument `Array[Width]` is not assignable to parameter `y` with type `Array[Height]` in function `multiply` [bad-argument-type] ERROR generics_typevartuple_basic.py:101:17-18: Argument `Array[Height, Width]` is not assignable to parameter `y` with type `Array[Height]` in function `multiply` [bad-argument-type] ERROR generics_typevartuple_basic.py:107:7-13: Type parameters for class may not have more than one TypeVarTuple [invalid-type-var-tuple] +ERROR generics_typevartuple_basic.py:111:7-13: Type parameters for class may not have more than one TypeVarTuple [invalid-type-var-tuple] """ diff --git a/conformance/results/pyrefly/generics_typevartuple_variance.toml b/conformance/results/pyrefly/generics_typevartuple_variance.toml new file mode 100644 index 000000000..fb5185e8a --- /dev/null +++ b/conformance/results/pyrefly/generics_typevartuple_variance.toml @@ -0,0 +1,47 @@ +conformant = "Unsupported" +conformance_automated = "Fail" +errors_diff = """ +Line 72: Expected 1 errors +Line 83: Expected 1 errors +Line 27: Unexpected errors ['`ContravariantTypeVarTuple[object]` is not assignable to `ContravariantTypeVarTuple[int]` [bad-assignment]'] +Line 28: Unexpected errors ['`ContravariantTypeVarTuple[*tuple[object, ...]]` is not assignable to `ContravariantTypeVarTuple[*tuple[int, ...]]` [bad-assignment]'] +Line 39: Unexpected errors ['`CovariantTypeVarTuple[int]` is not assignable to `CovariantTypeVarTuple[object]` [bad-assignment]'] +Line 40: Unexpected errors ['`CovariantTypeVarTuple[bool, bool]` is not assignable to `CovariantTypeVarTuple[int, int]` [bad-assignment]'] +Line 45: Unexpected errors ['`CovariantTypeVarTuple[*tuple[int, ...]]` is not assignable to `CovariantTypeVarTuple[*tuple[object, ...]]` [bad-assignment]'] +Line 66: Unexpected errors ['Unexpected keyword argument `contravariant` to TypeVarTuple [invalid-type-var-tuple]'] +Line 77: Unexpected errors ['`ContravariantTypeVarTupleOld[object]` is not assignable to `ContravariantTypeVarTupleOld[int]` [bad-assignment]'] +Line 80: Unexpected errors ['Unexpected keyword argument `covariant` to TypeVarTuple [invalid-type-var-tuple]'] +Line 91: Unexpected errors ['`CovariantTypeVarTupleOld[int]` is not assignable to `CovariantTypeVarTupleOld[object]` [bad-assignment]'] +""" +output = """ +ERROR generics_typevartuple_variance.py:14:45-73: `InvariantTypeVarTuple[int]` is not assignable to `InvariantTypeVarTuple[object]` [bad-assignment] +ERROR generics_typevartuple_variance.py:15:42-73: `InvariantTypeVarTuple[object]` is not assignable to `InvariantTypeVarTuple[int]` [bad-assignment] +ERROR generics_typevartuple_variance.py:17:64-108: `InvariantTypeVarTuple[*tuple[object, ...]]` is not assignable to `InvariantTypeVarTuple[*tuple[int, ...]]` [bad-assignment] +ERROR generics_typevartuple_variance.py:18:70-111: `InvariantTypeVarTuple[*tuple[int, ...]]` is not assignable to `InvariantTypeVarTuple[*tuple[object, ...]]` [bad-assignment] +ERROR generics_typevartuple_variance.py:26:53-93: `ContravariantTypeVarTuple[object, int]` is not assignable to `ContravariantTypeVarTuple[object, object]` [bad-assignment] +ERROR generics_typevartuple_variance.py:27:42-77: `ContravariantTypeVarTuple[object]` is not assignable to `ContravariantTypeVarTuple[int]` [bad-assignment] +ERROR generics_typevartuple_variance.py:28:64-112: `ContravariantTypeVarTuple[*tuple[object, ...]]` is not assignable to `ContravariantTypeVarTuple[*tuple[int, ...]]` [bad-assignment] +ERROR generics_typevartuple_variance.py:29:70-115: `ContravariantTypeVarTuple[*tuple[int, ...]]` is not assignable to `ContravariantTypeVarTuple[*tuple[object, ...]]` [bad-assignment] +ERROR generics_typevartuple_variance.py:38:39-70: `CovariantTypeVarTuple[object]` is not assignable to `CovariantTypeVarTuple[int]` [bad-assignment] +ERROR generics_typevartuple_variance.py:39:42-70: `CovariantTypeVarTuple[int]` is not assignable to `CovariantTypeVarTuple[object]` [bad-assignment] +ERROR generics_typevartuple_variance.py:40:50-86: `CovariantTypeVarTuple[bool, bool]` is not assignable to `CovariantTypeVarTuple[int, int]` [bad-assignment] +ERROR generics_typevartuple_variance.py:41:50-88: `CovariantTypeVarTuple[bool, object]` is not assignable to `CovariantTypeVarTuple[int, int]` [bad-assignment] +ERROR generics_typevartuple_variance.py:42:50-88: `CovariantTypeVarTuple[object, bool]` is not assignable to `CovariantTypeVarTuple[int, int]` [bad-assignment] +ERROR generics_typevartuple_variance.py:43:50-90: `CovariantTypeVarTuple[object, object]` is not assignable to `CovariantTypeVarTuple[int, int]` [bad-assignment] +ERROR generics_typevartuple_variance.py:44:61-105: `CovariantTypeVarTuple[*tuple[object, ...]]` is not assignable to `CovariantTypeVarTuple[*tuple[int, ...]]` [bad-assignment] +ERROR generics_typevartuple_variance.py:45:67-108: `CovariantTypeVarTuple[*tuple[int, ...]]` is not assignable to `CovariantTypeVarTuple[*tuple[object, ...]]` [bad-assignment] +ERROR generics_typevartuple_variance.py:49:33-47: Unexpected keyword argument `covariant` to TypeVarTuple [invalid-type-var-tuple] +ERROR generics_typevartuple_variance.py:49:49-67: Unexpected keyword argument `contravariant` to TypeVarTuple [invalid-type-var-tuple] +ERROR generics_typevartuple_variance.py:50:33-47: Unexpected keyword argument `covariant` to TypeVarTuple [invalid-type-var-tuple] +ERROR generics_typevartuple_variance.py:50:49-68: Unexpected keyword argument `infer_variance` to TypeVarTuple [invalid-type-var-tuple] +ERROR generics_typevartuple_variance.py:51:33-47: Unexpected keyword argument `covariant` to TypeVarTuple [invalid-type-var-tuple] +ERROR generics_typevartuple_variance.py:51:49-68: Unexpected keyword argument `infer_variance` to TypeVarTuple [invalid-type-var-tuple] +ERROR generics_typevartuple_variance.py:61:45-76: `InvariantTypeVarTupleOld[int]` is not assignable to `InvariantTypeVarTupleOld[object]` [bad-assignment] +ERROR generics_typevartuple_variance.py:62:42-76: `InvariantTypeVarTupleOld[object]` is not assignable to `InvariantTypeVarTupleOld[int]` [bad-assignment] +ERROR generics_typevartuple_variance.py:66:29-47: Unexpected keyword argument `contravariant` to TypeVarTuple [invalid-type-var-tuple] +ERROR generics_typevartuple_variance.py:76:52-87: `ContravariantTypeVarTupleOld[int]` is not assignable to `ContravariantTypeVarTupleOld[object]` [bad-assignment] +ERROR generics_typevartuple_variance.py:77:49-87: `ContravariantTypeVarTupleOld[object]` is not assignable to `ContravariantTypeVarTupleOld[int]` [bad-assignment] +ERROR generics_typevartuple_variance.py:80:31-45: Unexpected keyword argument `covariant` to TypeVarTuple [invalid-type-var-tuple] +ERROR generics_typevartuple_variance.py:90:46-80: `CovariantTypeVarTupleOld[object]` is not assignable to `CovariantTypeVarTupleOld[int]` [bad-assignment] +ERROR generics_typevartuple_variance.py:91:49-80: `CovariantTypeVarTupleOld[int]` is not assignable to `CovariantTypeVarTupleOld[object]` [bad-assignment] +""" diff --git a/conformance/results/pyrefly/protocols_variance.toml b/conformance/results/pyrefly/protocols_variance.toml index f0c9d08dc..f6836baf9 100644 --- a/conformance/results/pyrefly/protocols_variance.toml +++ b/conformance/results/pyrefly/protocols_variance.toml @@ -1,13 +1,18 @@ -conformant = "Pass" -conformance_automated = "Pass" +conformant = "Partial" +conformance_automated = "Fail" +notes = """ +Doesn't support variance keywords to ParamSpec +""" errors_diff = """ +Line 15: Unexpected errors ['Unexpected keyword argument `contravariant` to ParamSpec [invalid-param-spec]'] """ output = """ - WARN protocols_variance.py:21:7-17: Type variable `T1` in class `AnotherBox` is declared as invariant, but could be covariant based on its usage [variance-mismatch] - WARN protocols_variance.py:40:7-16: Type variable `T3` in class `Protocol2` is declared as invariant, but could be contravariant based on its usage [variance-mismatch] - WARN protocols_variance.py:56:7-16: Type variable `T1` in class `Protocol4` is declared as invariant, but could be contravariant based on its usage [variance-mismatch] -ERROR protocols_variance.py:62:9-11: Type variable `T1_co` is covariant but is used in contravariant position [invalid-variance] - WARN protocols_variance.py:66:7-16: Type variable `T1` in class `Protocol6` is declared as invariant, but could be covariant based on its usage [variance-mismatch] -ERROR protocols_variance.py:72:9-11: Type variable `T1_contra` is contravariant but is used in covariant position [invalid-variance] - WARN protocols_variance.py:104:7-17: Type variable `T1` in class `Protocol12` is declared as invariant, but could be covariant based on its usage [variance-mismatch] +ERROR protocols_variance.py:15:20-38: Unexpected keyword argument `contravariant` to ParamSpec [invalid-param-spec] + WARN protocols_variance.py:22:7-17: Type variable `T1` in class `AnotherBox` is declared as invariant, but could be covariant based on its usage [variance-mismatch] + WARN protocols_variance.py:41:7-16: Type variable `T3` in class `Protocol2` is declared as invariant, but could be contravariant based on its usage [variance-mismatch] + WARN protocols_variance.py:57:7-16: Type variable `T1` in class `Protocol4` is declared as invariant, but could be contravariant based on its usage [variance-mismatch] +ERROR protocols_variance.py:63:9-11: Type variable `T1_co` is covariant but is used in contravariant position [invalid-variance] + WARN protocols_variance.py:67:7-16: Type variable `T1` in class `Protocol6` is declared as invariant, but could be covariant based on its usage [variance-mismatch] +ERROR protocols_variance.py:73:9-11: Type variable `T1_contra` is contravariant but is used in covariant position [invalid-variance] + WARN protocols_variance.py:105:7-17: Type variable `T1` in class `Protocol12` is declared as invariant, but could be covariant based on its usage [variance-mismatch] """ diff --git a/conformance/results/pyright/generics_mixed_variance_inference.toml b/conformance/results/pyright/generics_mixed_variance_inference.toml new file mode 100644 index 000000000..36e0b0436 --- /dev/null +++ b/conformance/results/pyright/generics_mixed_variance_inference.toml @@ -0,0 +1,24 @@ +conformant = "Unsupported" +conformance_automated = "Fail" +errors_diff = """ +Line 17: Unexpected errors ['generics_mixed_variance_inference.py:17:27 - error: Type "Mixed[int, bool, ()]" is not assignable to declared type "Mixed[int, int, ()]"'] +Line 20: Unexpected errors ['generics_mixed_variance_inference.py:20:25 - error: Type "Mixed[int, (object)]" is not assignable to declared type "Mixed[int, (int)]"'] +""" +output = """ +generics_mixed_variance_inference.py:13:22 - error: Type "Mixed[bool, ()]" is not assignable to declared type "Mixed[int, ()]" +  "Mixed[bool, ()]" is not assignable to "Mixed[int, ()]" +    Type parameter "T@Mixed" is contravariant, but "bool" is not a supertype of "int" +      "int" is not assignable to "bool" (reportAssignmentType) +generics_mixed_variance_inference.py:16:27 - error: Type "Mixed[int, object, ()]" is not assignable to declared type "Mixed[int, int, ()]" +  "Mixed[int, object, ()]" is not assignable to "Mixed[int, int, ()]" +    Type parameter "Ts@Mixed" is invariant, but "*tuple[object]" is not the same as "*tuple[int]" (reportAssignmentType) +generics_mixed_variance_inference.py:17:27 - error: Type "Mixed[int, bool, ()]" is not assignable to declared type "Mixed[int, int, ()]" +  "Mixed[int, bool, ()]" is not assignable to "Mixed[int, int, ()]" +    Type parameter "Ts@Mixed" is invariant, but "*tuple[bool]" is not the same as "*tuple[int]" (reportAssignmentType) +generics_mixed_variance_inference.py:20:25 - error: Type "Mixed[int, (object)]" is not assignable to declared type "Mixed[int, (int)]" +  "Mixed[int, (object)]" is not assignable to "Mixed[int, (int)]" +    Type parameter "P@Mixed" is invariant, but "(object)" is not the same as "(int)" (reportAssignmentType) +generics_mixed_variance_inference.py:21:25 - error: Type "Mixed[int, (bool)]" is not assignable to declared type "Mixed[int, (int)]" +  "Mixed[int, (bool)]" is not assignable to "Mixed[int, (int)]" +    Type parameter "P@Mixed" is invariant, but "(bool)" is not the same as "(int)" (reportAssignmentType) +""" diff --git a/conformance/results/pyright/generics_paramspec_variance.toml b/conformance/results/pyright/generics_paramspec_variance.toml new file mode 100644 index 000000000..8d1903d0b --- /dev/null +++ b/conformance/results/pyright/generics_paramspec_variance.toml @@ -0,0 +1,88 @@ +conformant = "Unsupported" +conformance_automated = "Fail" +errors_diff = """ +Line 64: Expected 1 errors +Line 110: Expected 1 errors +Line 121: Expected 1 errors +Line 22: Unexpected errors ['generics_paramspec_variance.py:22:39 - error: Type "ContravariantParamSpec[(object)]" is not assignable to declared type "ContravariantParamSpec[(int)]"'] +Line 31: Unexpected errors ['generics_paramspec_variance.py:31:39 - error: Type "CovariantParamSpec[(int)]" is not assignable to declared type "CovariantParamSpec[(object)]"'] +Line 58: Unexpected errors ['generics_paramspec_variance.py:58:9 - error: Cannot assign to attribute "t" for class "Box[InitP[(a: int)]]"'] +Line 60: Unexpected errors ['generics_paramspec_variance.py:60:9 - error: Cannot assign to attribute "t" for class "Box[InitP[(a: int)]]"'] +Line 83: Unexpected errors ['generics_paramspec_variance.py:83:4 - error: Argument missing for parameter "fn" (reportCallIssue)', 'generics_paramspec_variance.py:83:4 - error: Call expression not allowed in type expression (reportInvalidTypeForm)'] +Line 91: Unexpected errors ['generics_paramspec_variance.py:91:1 - error: ParamSpec must be assigned to a variable named "InP" (reportGeneralTypeIssues)'] +Line 92: Unexpected errors ['generics_paramspec_variance.py:92:24 - error: "contravariant" is unknown parameter to ParamSpec (reportGeneralTypeIssues)'] +Line 115: Unexpected errors ['generics_paramspec_variance.py:115:46 - error: Type "ContravariantParamSpecOld[(object)]" is not assignable to declared type "ContravariantParamSpecOld[(int)]"'] +Line 117: Unexpected errors ['generics_paramspec_variance.py:117:26 - error: "covariant" is unknown parameter to ParamSpec (reportGeneralTypeIssues)'] +Line 128: Unexpected errors ['generics_paramspec_variance.py:128:46 - error: Type "CovariantParamSpecOld[(int)]" is not assignable to declared type "CovariantParamSpecOld[(object)]"'] +""" +output = """ +generics_paramspec_variance.py:14:42 - error: Type "InvariantParamSpec[(int)]" is not assignable to declared type "InvariantParamSpec[(object)]" +  "InvariantParamSpec[(int)]" is not assignable to "InvariantParamSpec[(object)]" +    Type parameter "InOutP@InvariantParamSpec" is invariant, but "(int)" is not the same as "(object)" (reportAssignmentType) +generics_paramspec_variance.py:15:39 - error: Type "InvariantParamSpec[(object)]" is not assignable to declared type "InvariantParamSpec[(int)]" +  "InvariantParamSpec[(object)]" is not assignable to "InvariantParamSpec[(int)]" +    Type parameter "InOutP@InvariantParamSpec" is invariant, but "(object)" is not the same as "(int)" (reportAssignmentType) +generics_paramspec_variance.py:21:42 - error: Type "ContravariantParamSpec[(int)]" is not assignable to declared type "ContravariantParamSpec[(object)]" +  "ContravariantParamSpec[(int)]" is not assignable to "ContravariantParamSpec[(object)]" +    Type parameter "InP@ContravariantParamSpec" is invariant, but "(int)" is not the same as "(object)" (reportAssignmentType) +generics_paramspec_variance.py:22:39 - error: Type "ContravariantParamSpec[(object)]" is not assignable to declared type "ContravariantParamSpec[(int)]" +  "ContravariantParamSpec[(object)]" is not assignable to "ContravariantParamSpec[(int)]" +    Type parameter "InP@ContravariantParamSpec" is invariant, but "(object)" is not the same as "(int)" (reportAssignmentType) +generics_paramspec_variance.py:30:36 - error: Type "CovariantParamSpec[(object)]" is not assignable to declared type "CovariantParamSpec[(int)]" +  "CovariantParamSpec[(object)]" is not assignable to "CovariantParamSpec[(int)]" +    Type parameter "OutP@CovariantParamSpec" is invariant, but "(object)" is not the same as "(int)" (reportAssignmentType) +generics_paramspec_variance.py:31:39 - error: Type "CovariantParamSpec[(int)]" is not assignable to declared type "CovariantParamSpec[(object)]" +  "CovariantParamSpec[(int)]" is not assignable to "CovariantParamSpec[(object)]" +    Type parameter "OutP@CovariantParamSpec" is invariant, but "(int)" is not the same as "(object)" (reportAssignmentType) +generics_paramspec_variance.py:58:9 - error: Cannot assign to attribute "t" for class "Box[InitP[(a: int)]]" +  "InitP[(*, a: int)]" is not assignable to "InitP[(a: int)]" +    Type parameter "P@InitP" is invariant, but "(*, a: int)" is not the same as "(a: int)" (reportAttributeAccessIssue) +generics_paramspec_variance.py:60:9 - error: Cannot assign to attribute "t" for class "Box[InitP[(a: int)]]" +  "InitP[(a: int, /)]" is not assignable to "InitP[(a: int)]" +    Type parameter "P@InitP" is invariant, but "(a: int, /)" is not the same as "(a: int)" (reportAttributeAccessIssue) +generics_paramspec_variance.py:62:4 - error: Argument missing for parameter "fn" (reportCallIssue) +generics_paramspec_variance.py:62:4 - error: Call expression not allowed in type expression (reportInvalidTypeForm) +generics_paramspec_variance.py:66:9 - error: Cannot assign to attribute "t" for class "Box[InitP[(a: int)]]" +  "InitP[(a: int, b: str)]" is not assignable to "InitP[(a: int)]" +    Type parameter "P@InitP" is invariant, but "(a: int, b: str)" is not the same as "(a: int)" (reportAttributeAccessIssue) +generics_paramspec_variance.py:79:9 - error: Cannot assign to attribute "t" for class "Box[OutitP[(a: int)]]" +  "OutitP[(*, a: int)]" is not assignable to "OutitP[(a: int)]" +    Type parameter "P@OutitP" is invariant, but "(*, a: int)" is not the same as "(a: int)" (reportAttributeAccessIssue) +generics_paramspec_variance.py:81:9 - error: Cannot assign to attribute "t" for class "Box[OutitP[(a: int)]]" +  "OutitP[(a: int, /)]" is not assignable to "OutitP[(a: int)]" +    Type parameter "P@OutitP" is invariant, but "(a: int, /)" is not the same as "(a: int)" (reportAttributeAccessIssue) +generics_paramspec_variance.py:83:4 - error: Argument missing for parameter "fn" (reportCallIssue) +generics_paramspec_variance.py:83:4 - error: Call expression not allowed in type expression (reportInvalidTypeForm) +generics_paramspec_variance.py:87:9 - error: Cannot assign to attribute "t" for class "Box[OutitP[(a: int)]]" +  "OutitP[(a: int, b: str)]" is not assignable to "OutitP[(a: int)]" +    Type parameter "P@OutitP" is invariant, but "(a: int, b: str)" is not the same as "(a: int)" (reportAttributeAccessIssue) +generics_paramspec_variance.py:91:1 - error: ParamSpec must be assigned to a variable named "InP" (reportGeneralTypeIssues) +generics_paramspec_variance.py:92:24 - error: "contravariant" is unknown parameter to ParamSpec (reportGeneralTypeIssues) +generics_paramspec_variance.py:93:28 - error: "covariant" is unknown parameter to ParamSpec (reportGeneralTypeIssues) +generics_paramspec_variance.py:93:44 - error: "contravariant" is unknown parameter to ParamSpec (reportGeneralTypeIssues) +generics_paramspec_variance.py:94:1 - error: ParamSpec must be assigned to a variable named "InvP1" (reportGeneralTypeIssues) +generics_paramspec_variance.py:94:28 - error: "covariant" is unknown parameter to ParamSpec (reportGeneralTypeIssues) +generics_paramspec_variance.py:94:44 - error: "infer_variance" is unknown parameter to ParamSpec (reportGeneralTypeIssues) +generics_paramspec_variance.py:95:1 - error: ParamSpec must be assigned to a variable named "InvP1" (reportGeneralTypeIssues) +generics_paramspec_variance.py:95:28 - error: "contravariant" is unknown parameter to ParamSpec (reportGeneralTypeIssues) +generics_paramspec_variance.py:95:48 - error: "infer_variance" is unknown parameter to ParamSpec (reportGeneralTypeIssues) +generics_paramspec_variance.py:103:14 - error: Type "InvariantParamSpecOld[(bool)]" is not assignable to declared type "InvariantParamSpecOld[(int)]" +  "InvariantParamSpecOld[(bool)]" is not assignable to "InvariantParamSpecOld[(int)]" +    Type parameter "InP@InvariantParamSpecOld" is invariant, but "(bool)" is not the same as "(int)" (reportAssignmentType) +generics_paramspec_variance.py:104:14 - error: Type "InvariantParamSpecOld[(object)]" is not assignable to declared type "InvariantParamSpecOld[(int)]" +  "InvariantParamSpecOld[(object)]" is not assignable to "InvariantParamSpecOld[(int)]" +    Type parameter "InP@InvariantParamSpecOld" is invariant, but "(object)" is not the same as "(int)" (reportAssignmentType) +generics_paramspec_variance.py:114:49 - error: Type "ContravariantParamSpecOld[(int)]" is not assignable to declared type "ContravariantParamSpecOld[(object)]" +  "ContravariantParamSpecOld[(int)]" is not assignable to "ContravariantParamSpecOld[(object)]" +    Type parameter "InP@ContravariantParamSpecOld" is invariant, but "(int)" is not the same as "(object)" (reportAssignmentType) +generics_paramspec_variance.py:115:46 - error: Type "ContravariantParamSpecOld[(object)]" is not assignable to declared type "ContravariantParamSpecOld[(int)]" +  "ContravariantParamSpecOld[(object)]" is not assignable to "ContravariantParamSpecOld[(int)]" +    Type parameter "InP@ContravariantParamSpecOld" is invariant, but "(object)" is not the same as "(int)" (reportAssignmentType) +generics_paramspec_variance.py:117:26 - error: "covariant" is unknown parameter to ParamSpec (reportGeneralTypeIssues) +generics_paramspec_variance.py:127:43 - error: Type "CovariantParamSpecOld[(object)]" is not assignable to declared type "CovariantParamSpecOld[(int)]" +  "CovariantParamSpecOld[(object)]" is not assignable to "CovariantParamSpecOld[(int)]" +    Type parameter "OutP@CovariantParamSpecOld" is invariant, but "(object)" is not the same as "(int)" (reportAssignmentType) +generics_paramspec_variance.py:128:46 - error: Type "CovariantParamSpecOld[(int)]" is not assignable to declared type "CovariantParamSpecOld[(object)]" +  "CovariantParamSpecOld[(int)]" is not assignable to "CovariantParamSpecOld[(object)]" +    Type parameter "OutP@CovariantParamSpecOld" is invariant, but "(int)" is not the same as "(object)" (reportAssignmentType) +""" diff --git a/conformance/results/pyright/generics_typevartuple_basic.toml b/conformance/results/pyright/generics_typevartuple_basic.toml index 4021237e7..ea0d0a1a8 100644 --- a/conformance/results/pyright/generics_typevartuple_basic.toml +++ b/conformance/results/pyright/generics_typevartuple_basic.toml @@ -7,19 +7,18 @@ errors_diff = """ Line 90: Unexpected errors ['generics_typevartuple_basic.py:90:14 - error: Argument of type "tuple[Literal[\\'0\\']]" cannot be assigned to parameter "arg2" of type "tuple[*Ts@func2]" in function "func2"'] """ output = """ -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__" +generics_typevartuple_basic.py:43:34 - error: Argument of type "Height" cannot be assigned to parameter "shape" of type "tuple[*Shape@Array]" in function "__init__"   "Height" is not assignable to "tuple[*Shape@Array]" (reportArgumentType) -generics_typevartuple_basic.py:43:35 - error: Type "Array[Batch, Width]" is not assignable to declared type "Array[Batch, Height, Width]" +generics_typevartuple_basic.py:44:35 - error: Type "Array[Batch, Width]" is not assignable to declared type "Array[Batch, Height, Width]"   "Array[Batch, Width]" is not assignable to "Array[Batch, Height, Width]"     Type parameter "Shape@Array" is invariant, but "*tuple[Batch, Width]" is not the same as "*tuple[Batch, Height, Width]" (reportAssignmentType) -generics_typevartuple_basic.py:44:41 - error: Type "Array[Time, Batch, Width, Height]" is not assignable to declared type "Array[Time, Batch, Height, Width]" +generics_typevartuple_basic.py:45:41 - error: Type "Array[Time, Batch, Width, Height]" is not assignable to declared type "Array[Time, Batch, Height, Width]"   "Array[Time, Batch, Width, Height]" is not assignable to "Array[Time, Batch, Height, Width]"     Type parameter "Shape@Array" is invariant, but "*tuple[Time, Batch, Width, Height]" is not the same as "*tuple[Time, Batch, Height, Width]" (reportAssignmentType) -generics_typevartuple_basic.py:52:22 - error: Expected unpacked TypeVarTuple; use Unpack[Shape] or *Shape (reportInvalidTypeForm) -generics_typevartuple_basic.py:53:37 - error: Expected unpacked TypeVarTuple; use Unpack[Shape] or *Shape (reportInvalidTypeForm) -generics_typevartuple_basic.py:56:34 - error: Expected unpacked TypeVarTuple; use Unpack[Shape] or *Shape (reportInvalidTypeForm) -generics_typevartuple_basic.py:59:24 - error: Expected unpacked TypeVarTuple; use Unpack[Shape] or *Shape (reportInvalidTypeForm) -generics_typevartuple_basic.py:65:27 - error: "covariant" is unknown parameter to TypeVarTuple (reportGeneralTypeIssues) +generics_typevartuple_basic.py:53:22 - error: Expected unpacked TypeVarTuple; use Unpack[Shape] or *Shape (reportInvalidTypeForm) +generics_typevartuple_basic.py:54:37 - error: Expected unpacked TypeVarTuple; use Unpack[Shape] or *Shape (reportInvalidTypeForm) +generics_typevartuple_basic.py:57:34 - error: Expected unpacked TypeVarTuple; use Unpack[Shape] or *Shape (reportInvalidTypeForm) +generics_typevartuple_basic.py:60:24 - error: Expected unpacked TypeVarTuple; use Unpack[Shape] or *Shape (reportInvalidTypeForm) generics_typevartuple_basic.py:66:27 - error: TypeVarTuple cannot have value constraints (reportGeneralTypeIssues) generics_typevartuple_basic.py:66:32 - error: TypeVarTuple cannot have value constraints (reportGeneralTypeIssues) generics_typevartuple_basic.py:67:27 - error: "bound" is unknown parameter to TypeVarTuple (reportGeneralTypeIssues) @@ -34,6 +33,7 @@ generics_typevartuple_basic.py:100:17 - error: Argument of type "Array[Width]" c generics_typevartuple_basic.py:101:17 - error: Argument of type "Array[Height, Width]" cannot be assigned to parameter "y" of type "Array[*Shape@multiply]" in function "multiply"   "Array[Height, Width]" is not assignable to "Array[Height]"     Type parameter "Shape@Array" is invariant, but "*tuple[Height, Width]" is not the same as "*tuple[Height]" (reportArgumentType) -generics_typevartuple_basic.py:107:14 - error: Generic class can have at most one TypeVarTuple type parameter but received multiple ("Ts1", "Ts2") (reportGeneralTypeIssues) -generics_typevartuple_basic.py:107:29 - error: Type argument list can have at most one unpacked TypeVarTuple or tuple (reportInvalidTypeForm) +generics_typevartuple_basic.py:107:14 - error: Generic class can have at most one TypeVarTuple type parameter but received multiple ("Ts", "Ts1") (reportGeneralTypeIssues) +generics_typevartuple_basic.py:107:28 - error: Type argument list can have at most one unpacked TypeVarTuple or tuple (reportInvalidTypeForm) +generics_typevartuple_basic.py:111:7 - error: Generic class can have at most one TypeVarTuple type parameter but received multiple ("Ts1", "Ts2") (reportGeneralTypeIssues) """ diff --git a/conformance/results/pyright/generics_typevartuple_variance.toml b/conformance/results/pyright/generics_typevartuple_variance.toml new file mode 100644 index 000000000..0d7578e7c --- /dev/null +++ b/conformance/results/pyright/generics_typevartuple_variance.toml @@ -0,0 +1,91 @@ +conformant = "Unsupported" +conformance_automated = "Fail" +errors_diff = """ +Line 72: Expected 1 errors +Line 83: Expected 1 errors +Line 27: Unexpected errors ['generics_typevartuple_variance.py:27:42 - error: Type "ContravariantTypeVarTuple[object]" is not assignable to declared type "ContravariantTypeVarTuple[int]"'] +Line 28: Unexpected errors ['generics_typevartuple_variance.py:28:64 - error: Type "ContravariantTypeVarTuple[*tuple[object, ...]]" is not assignable to declared type "ContravariantTypeVarTuple[*tuple[int, ...]]"'] +Line 39: Unexpected errors ['generics_typevartuple_variance.py:39:42 - error: Type "CovariantTypeVarTuple[int]" is not assignable to declared type "CovariantTypeVarTuple[object]"'] +Line 40: Unexpected errors ['generics_typevartuple_variance.py:40:50 - error: Type "CovariantTypeVarTuple[bool, bool]" is not assignable to declared type "CovariantTypeVarTuple[int, int]"'] +Line 45: Unexpected errors ['generics_typevartuple_variance.py:45:67 - error: Type "CovariantTypeVarTuple[*tuple[int, ...]]" is not assignable to declared type "CovariantTypeVarTuple[*tuple[object, ...]]"'] +Line 66: Unexpected errors ['generics_typevartuple_variance.py:66:29 - error: "contravariant" is unknown parameter to TypeVarTuple (reportGeneralTypeIssues)'] +Line 77: Unexpected errors ['generics_typevartuple_variance.py:77:49 - error: Type "ContravariantTypeVarTupleOld[object]" is not assignable to declared type "ContravariantTypeVarTupleOld[int]"'] +Line 80: Unexpected errors ['generics_typevartuple_variance.py:80:31 - error: "covariant" is unknown parameter to TypeVarTuple (reportGeneralTypeIssues)'] +Line 91: Unexpected errors ['generics_typevartuple_variance.py:91:49 - error: Type "CovariantTypeVarTupleOld[int]" is not assignable to declared type "CovariantTypeVarTupleOld[object]"'] +""" +output = """ +generics_typevartuple_variance.py:14:45 - error: Type "InvariantTypeVarTuple[int]" is not assignable to declared type "InvariantTypeVarTuple[object]" +  "InvariantTypeVarTuple[int]" is not assignable to "InvariantTypeVarTuple[object]" +    Type parameter "InOutTs@InvariantTypeVarTuple" is invariant, but "*tuple[int]" is not the same as "*tuple[object]" (reportAssignmentType) +generics_typevartuple_variance.py:15:42 - error: Type "InvariantTypeVarTuple[object]" is not assignable to declared type "InvariantTypeVarTuple[int]" +  "InvariantTypeVarTuple[object]" is not assignable to "InvariantTypeVarTuple[int]" +    Type parameter "InOutTs@InvariantTypeVarTuple" is invariant, but "*tuple[object]" is not the same as "*tuple[int]" (reportAssignmentType) +generics_typevartuple_variance.py:17:64 - error: Type "InvariantTypeVarTuple[*tuple[object, ...]]" is not assignable to declared type "InvariantTypeVarTuple[*tuple[int, ...]]" +  "InvariantTypeVarTuple[*tuple[object, ...]]" is not assignable to "InvariantTypeVarTuple[*tuple[int, ...]]" +    Type parameter "InOutTs@InvariantTypeVarTuple" is invariant, but "*tuple[object, ...]" is not the same as "*tuple[int, ...]" (reportAssignmentType) +generics_typevartuple_variance.py:18:70 - error: Type "InvariantTypeVarTuple[*tuple[int, ...]]" is not assignable to declared type "InvariantTypeVarTuple[*tuple[object, ...]]" +  "InvariantTypeVarTuple[*tuple[int, ...]]" is not assignable to "InvariantTypeVarTuple[*tuple[object, ...]]" +    Type parameter "InOutTs@InvariantTypeVarTuple" is invariant, but "*tuple[int, ...]" is not the same as "*tuple[object, ...]" (reportAssignmentType) +generics_typevartuple_variance.py:26:53 - error: Type "ContravariantTypeVarTuple[object, int]" is not assignable to declared type "ContravariantTypeVarTuple[object, object]" +  "ContravariantTypeVarTuple[object, int]" is not assignable to "ContravariantTypeVarTuple[object, object]" +    Type parameter "InTs@ContravariantTypeVarTuple" is invariant, but "*tuple[object, int]" is not the same as "*tuple[object, object]" (reportAssignmentType) +generics_typevartuple_variance.py:27:42 - error: Type "ContravariantTypeVarTuple[object]" is not assignable to declared type "ContravariantTypeVarTuple[int]" +  "ContravariantTypeVarTuple[object]" is not assignable to "ContravariantTypeVarTuple[int]" +    Type parameter "InTs@ContravariantTypeVarTuple" is invariant, but "*tuple[object]" is not the same as "*tuple[int]" (reportAssignmentType) +generics_typevartuple_variance.py:28:64 - error: Type "ContravariantTypeVarTuple[*tuple[object, ...]]" is not assignable to declared type "ContravariantTypeVarTuple[*tuple[int, ...]]" +  "ContravariantTypeVarTuple[*tuple[object, ...]]" is not assignable to "ContravariantTypeVarTuple[*tuple[int, ...]]" +    Type parameter "InTs@ContravariantTypeVarTuple" is invariant, but "*tuple[object, ...]" is not the same as "*tuple[int, ...]" (reportAssignmentType) +generics_typevartuple_variance.py:29:70 - error: Type "ContravariantTypeVarTuple[*tuple[int, ...]]" is not assignable to declared type "ContravariantTypeVarTuple[*tuple[object, ...]]" +  "ContravariantTypeVarTuple[*tuple[int, ...]]" is not assignable to "ContravariantTypeVarTuple[*tuple[object, ...]]" +    Type parameter "InTs@ContravariantTypeVarTuple" is invariant, but "*tuple[int, ...]" is not the same as "*tuple[object, ...]" (reportAssignmentType) +generics_typevartuple_variance.py:38:39 - error: Type "CovariantTypeVarTuple[object]" is not assignable to declared type "CovariantTypeVarTuple[int]" +  "CovariantTypeVarTuple[object]" is not assignable to "CovariantTypeVarTuple[int]" +    Type parameter "OutTs@CovariantTypeVarTuple" is invariant, but "*tuple[object]" is not the same as "*tuple[int]" (reportAssignmentType) +generics_typevartuple_variance.py:39:42 - error: Type "CovariantTypeVarTuple[int]" is not assignable to declared type "CovariantTypeVarTuple[object]" +  "CovariantTypeVarTuple[int]" is not assignable to "CovariantTypeVarTuple[object]" +    Type parameter "OutTs@CovariantTypeVarTuple" is invariant, but "*tuple[int]" is not the same as "*tuple[object]" (reportAssignmentType) +generics_typevartuple_variance.py:40:50 - error: Type "CovariantTypeVarTuple[bool, bool]" is not assignable to declared type "CovariantTypeVarTuple[int, int]" +  "CovariantTypeVarTuple[bool, bool]" is not assignable to "CovariantTypeVarTuple[int, int]" +    Type parameter "OutTs@CovariantTypeVarTuple" is invariant, but "*tuple[bool, bool]" is not the same as "*tuple[int, int]" (reportAssignmentType) +generics_typevartuple_variance.py:41:50 - error: Type "CovariantTypeVarTuple[bool, object]" is not assignable to declared type "CovariantTypeVarTuple[int, int]" +  "CovariantTypeVarTuple[bool, object]" is not assignable to "CovariantTypeVarTuple[int, int]" +    Type parameter "OutTs@CovariantTypeVarTuple" is invariant, but "*tuple[bool, object]" is not the same as "*tuple[int, int]" (reportAssignmentType) +generics_typevartuple_variance.py:42:50 - error: Type "CovariantTypeVarTuple[object, bool]" is not assignable to declared type "CovariantTypeVarTuple[int, int]" +  "CovariantTypeVarTuple[object, bool]" is not assignable to "CovariantTypeVarTuple[int, int]" +    Type parameter "OutTs@CovariantTypeVarTuple" is invariant, but "*tuple[object, bool]" is not the same as "*tuple[int, int]" (reportAssignmentType) +generics_typevartuple_variance.py:43:50 - error: Type "CovariantTypeVarTuple[object, object]" is not assignable to declared type "CovariantTypeVarTuple[int, int]" +  "CovariantTypeVarTuple[object, object]" is not assignable to "CovariantTypeVarTuple[int, int]" +    Type parameter "OutTs@CovariantTypeVarTuple" is invariant, but "*tuple[object, object]" is not the same as "*tuple[int, int]" (reportAssignmentType) +generics_typevartuple_variance.py:44:61 - error: Type "CovariantTypeVarTuple[*tuple[object, ...]]" is not assignable to declared type "CovariantTypeVarTuple[*tuple[int, ...]]" +  "CovariantTypeVarTuple[*tuple[object, ...]]" is not assignable to "CovariantTypeVarTuple[*tuple[int, ...]]" +    Type parameter "OutTs@CovariantTypeVarTuple" is invariant, but "*tuple[object, ...]" is not the same as "*tuple[int, ...]" (reportAssignmentType) +generics_typevartuple_variance.py:45:67 - error: Type "CovariantTypeVarTuple[*tuple[int, ...]]" is not assignable to declared type "CovariantTypeVarTuple[*tuple[object, ...]]" +  "CovariantTypeVarTuple[*tuple[int, ...]]" is not assignable to "CovariantTypeVarTuple[*tuple[object, ...]]" +    Type parameter "OutTs@CovariantTypeVarTuple" is invariant, but "*tuple[int, ...]" is not the same as "*tuple[object, ...]" (reportAssignmentType) +generics_typevartuple_variance.py:49:33 - error: "covariant" is unknown parameter to TypeVarTuple (reportGeneralTypeIssues) +generics_typevartuple_variance.py:49:49 - error: "contravariant" is unknown parameter to TypeVarTuple (reportGeneralTypeIssues) +generics_typevartuple_variance.py:50:33 - error: "covariant" is unknown parameter to TypeVarTuple (reportGeneralTypeIssues) +generics_typevartuple_variance.py:50:49 - error: "infer_variance" is unknown parameter to TypeVarTuple (reportGeneralTypeIssues) +generics_typevartuple_variance.py:51:33 - error: "covariant" is unknown parameter to TypeVarTuple (reportGeneralTypeIssues) +generics_typevartuple_variance.py:51:49 - error: "infer_variance" is unknown parameter to TypeVarTuple (reportGeneralTypeIssues) +generics_typevartuple_variance.py:61:45 - error: Type "InvariantTypeVarTupleOld[int]" is not assignable to declared type "InvariantTypeVarTupleOld[object]" +  "InvariantTypeVarTupleOld[int]" is not assignable to "InvariantTypeVarTupleOld[object]" +    Type parameter "Ts@InvariantTypeVarTupleOld" is invariant, but "*tuple[int]" is not the same as "*tuple[object]" (reportAssignmentType) +generics_typevartuple_variance.py:62:42 - error: Type "InvariantTypeVarTupleOld[object]" is not assignable to declared type "InvariantTypeVarTupleOld[int]" +  "InvariantTypeVarTupleOld[object]" is not assignable to "InvariantTypeVarTupleOld[int]" +    Type parameter "Ts@InvariantTypeVarTupleOld" is invariant, but "*tuple[object]" is not the same as "*tuple[int]" (reportAssignmentType) +generics_typevartuple_variance.py:66:29 - error: "contravariant" is unknown parameter to TypeVarTuple (reportGeneralTypeIssues) +generics_typevartuple_variance.py:76:52 - error: Type "ContravariantTypeVarTupleOld[int]" is not assignable to declared type "ContravariantTypeVarTupleOld[object]" +  "ContravariantTypeVarTupleOld[int]" is not assignable to "ContravariantTypeVarTupleOld[object]" +    Type parameter "InTs@ContravariantTypeVarTupleOld" is invariant, but "*tuple[int]" is not the same as "*tuple[object]" (reportAssignmentType) +generics_typevartuple_variance.py:77:49 - error: Type "ContravariantTypeVarTupleOld[object]" is not assignable to declared type "ContravariantTypeVarTupleOld[int]" +  "ContravariantTypeVarTupleOld[object]" is not assignable to "ContravariantTypeVarTupleOld[int]" +    Type parameter "InTs@ContravariantTypeVarTupleOld" is invariant, but "*tuple[object]" is not the same as "*tuple[int]" (reportAssignmentType) +generics_typevartuple_variance.py:80:31 - error: "covariant" is unknown parameter to TypeVarTuple (reportGeneralTypeIssues) +generics_typevartuple_variance.py:90:46 - error: Type "CovariantTypeVarTupleOld[object]" is not assignable to declared type "CovariantTypeVarTupleOld[int]" +  "CovariantTypeVarTupleOld[object]" is not assignable to "CovariantTypeVarTupleOld[int]" +    Type parameter "OutTs@CovariantTypeVarTupleOld" is invariant, but "*tuple[object]" is not the same as "*tuple[int]" (reportAssignmentType) +generics_typevartuple_variance.py:91:49 - error: Type "CovariantTypeVarTupleOld[int]" is not assignable to declared type "CovariantTypeVarTupleOld[object]" +  "CovariantTypeVarTupleOld[int]" is not assignable to "CovariantTypeVarTupleOld[object]" +    Type parameter "OutTs@CovariantTypeVarTupleOld" is invariant, but "*tuple[int]" is not the same as "*tuple[object]" (reportAssignmentType) +""" diff --git a/conformance/results/pyright/protocols_variance.toml b/conformance/results/pyright/protocols_variance.toml index 108fd9d99..5ea6133eb 100644 --- a/conformance/results/pyright/protocols_variance.toml +++ b/conformance/results/pyright/protocols_variance.toml @@ -1,15 +1,20 @@ -conformant = "Pass" +conformant = "Partial" +notes = """ +Doesn't support keyword arguments to ParamSpec +""" output = """ -protocols_variance.py:21:7 - warning: Type variable "T1" used in generic Protocol "AnotherBox" should be covariant (reportInvalidTypeVarUse) -protocols_variance.py:40:7 - warning: Type variable "T3" used in generic Protocol "Protocol2" should be contravariant (reportInvalidTypeVarUse) -protocols_variance.py:56:7 - warning: Type variable "T1" used in generic Protocol "Protocol4" should be contravariant (reportInvalidTypeVarUse) -protocols_variance.py:61:7 - warning: Type variable "T1_co" used in generic Protocol "Protocol5" should be contravariant (reportInvalidTypeVarUse) -protocols_variance.py:62:22 - error: Covariant type variable cannot be used in parameter type (reportGeneralTypeIssues) -protocols_variance.py:66:7 - warning: Type variable "T1" used in generic Protocol "Protocol6" should be covariant (reportInvalidTypeVarUse) -protocols_variance.py:71:7 - warning: Type variable "T1_contra" used in generic Protocol "Protocol7" should be covariant (reportInvalidTypeVarUse) -protocols_variance.py:72:21 - error: Contravariant type variable cannot be used in return type (reportGeneralTypeIssues) -protocols_variance.py:104:7 - warning: Type variable "T1" used in generic Protocol "Protocol12" should be covariant (reportInvalidTypeVarUse) +protocols_variance.py:15:20 - error: "contravariant" is unknown parameter to ParamSpec (reportGeneralTypeIssues) +protocols_variance.py:22:7 - warning: Type variable "T1" used in generic Protocol "AnotherBox" should be covariant (reportInvalidTypeVarUse) +protocols_variance.py:41:7 - warning: Type variable "T3" used in generic Protocol "Protocol2" should be contravariant (reportInvalidTypeVarUse) +protocols_variance.py:57:7 - warning: Type variable "T1" used in generic Protocol "Protocol4" should be contravariant (reportInvalidTypeVarUse) +protocols_variance.py:62:7 - warning: Type variable "T1_co" used in generic Protocol "Protocol5" should be contravariant (reportInvalidTypeVarUse) +protocols_variance.py:63:22 - error: Covariant type variable cannot be used in parameter type (reportGeneralTypeIssues) +protocols_variance.py:67:7 - warning: Type variable "T1" used in generic Protocol "Protocol6" should be covariant (reportInvalidTypeVarUse) +protocols_variance.py:72:7 - warning: Type variable "T1_contra" used in generic Protocol "Protocol7" should be covariant (reportInvalidTypeVarUse) +protocols_variance.py:73:21 - error: Contravariant type variable cannot be used in return type (reportGeneralTypeIssues) +protocols_variance.py:105:7 - warning: Type variable "T1" used in generic Protocol "Protocol12" should be covariant (reportInvalidTypeVarUse) """ -conformance_automated = "Pass" +conformance_automated = "Fail" errors_diff = """ +Line 15: Unexpected errors ['protocols_variance.py:15:20 - error: "contravariant" is unknown parameter to ParamSpec (reportGeneralTypeIssues)'] """ diff --git a/conformance/results/ty/generics_mixed_variance_inference.toml b/conformance/results/ty/generics_mixed_variance_inference.toml new file mode 100644 index 000000000..03796e1e0 --- /dev/null +++ b/conformance/results/ty/generics_mixed_variance_inference.toml @@ -0,0 +1,9 @@ +conformant = "Pass" +conformance_automated = "Pass" +errors_diff = """ +""" +output = """ +generics_mixed_variance_inference.py:13:22: error[invalid-assignment] Object of type `Mixed[bool, ()]` is not assignable to `Mixed[int, ()]` +generics_mixed_variance_inference.py:16:27: error[invalid-assignment] Object of type `Mixed[int, object, ()]` is not assignable to `Mixed[int, int, ()]` +generics_mixed_variance_inference.py:21:25: error[invalid-assignment] Object of type `Mixed[int, (bool, /)]` is not assignable to `Mixed[int, (int, /)]` +""" diff --git a/conformance/results/ty/generics_paramspec_variance.toml b/conformance/results/ty/generics_paramspec_variance.toml new file mode 100644 index 000000000..17232693d --- /dev/null +++ b/conformance/results/ty/generics_paramspec_variance.toml @@ -0,0 +1,40 @@ +conformant = "Partial" +notes = """ +Does not error when a ParamSpec is used in a position that violates its explicit variance. +""" +conformance_automated = "Fail" +errors_diff = """ +Line 64: Expected 1 errors +Line 79: Expected 1 errors +Line 81: Expected 1 errors +Line 110: Expected 1 errors +Line 121: Expected 1 errors +Line 58: Unexpected errors ['generics_paramspec_variance.py:58:1: error[invalid-assignment] Object of type `InitP[(*, a: int)]` is not assignable to attribute `t` of type `InitP[(a: int)]`'] +Line 60: Unexpected errors ['generics_paramspec_variance.py:60:1: error[invalid-assignment] Object of type `InitP[(a: int, /)]` is not assignable to attribute `t` of type `InitP[(a: int)]`'] +Line 83: Unexpected errors ['generics_paramspec_variance.py:83:4: error[invalid-type-form] Function calls are not allowed in type expressions', 'generics_paramspec_variance.py:83:4: error[missing-argument] No argument provided for required parameter `fn` of `OutitP.__init__`'] +Line 85: Unexpected errors ['generics_paramspec_variance.py:85:1: error[invalid-assignment] Object of type `OutitP[(a: int = 1)]` is not assignable to attribute `t` of type `OutitP[(a: int)]`'] +Line 91: Unexpected errors ['generics_paramspec_variance.py:91:15: error[mismatched-type-name] The name passed to `ParamSpec` must match the variable it is assigned to: Expected "P", got "InP"'] +""" +output = """ +generics_paramspec_variance.py:14:42: error[invalid-assignment] Object of type `InvariantParamSpec[(int, /)]` is not assignable to `InvariantParamSpec[(object, /)]` +generics_paramspec_variance.py:15:39: error[invalid-assignment] Object of type `InvariantParamSpec[(object, /)]` is not assignable to `InvariantParamSpec[(int, /)]` +generics_paramspec_variance.py:21:42: error[invalid-assignment] Object of type `ContravariantParamSpec[(int, /)]` is not assignable to `ContravariantParamSpec[(object, /)]` +generics_paramspec_variance.py:30:36: error[invalid-assignment] Object of type `CovariantParamSpec[(object, /)]` is not assignable to `CovariantParamSpec[(int, /)]` +generics_paramspec_variance.py:58:1: error[invalid-assignment] Object of type `InitP[(*, a: int)]` is not assignable to attribute `t` of type `InitP[(a: int)]` +generics_paramspec_variance.py:60:1: error[invalid-assignment] Object of type `InitP[(a: int, /)]` is not assignable to attribute `t` of type `InitP[(a: int)]` +generics_paramspec_variance.py:62:4: error[invalid-type-form] Function calls are not allowed in type expressions +generics_paramspec_variance.py:62:4: error[missing-argument] No argument provided for required parameter `fn` of `InitP.__init__` +generics_paramspec_variance.py:66:1: error[invalid-assignment] Object of type `InitP[(a: int, b: str)]` is not assignable to attribute `t` of type `InitP[(a: int)]` +generics_paramspec_variance.py:83:4: error[invalid-type-form] Function calls are not allowed in type expressions +generics_paramspec_variance.py:83:4: error[missing-argument] No argument provided for required parameter `fn` of `OutitP.__init__` +generics_paramspec_variance.py:85:1: error[invalid-assignment] Object of type `OutitP[(a: int = 1)]` is not assignable to attribute `t` of type `OutitP[(a: int)]` +generics_paramspec_variance.py:87:1: error[invalid-assignment] Object of type `OutitP[(a: int, b: str)]` is not assignable to attribute `t` of type `OutitP[(a: int)]` +generics_paramspec_variance.py:91:15: error[mismatched-type-name] The name passed to `ParamSpec` must match the variable it is assigned to: Expected "P", got "InP" +generics_paramspec_variance.py:93:9: error[invalid-paramspec] A `ParamSpec` cannot be both covariant and contravariant +generics_paramspec_variance.py:94:9: error[invalid-paramspec] A `ParamSpec` cannot specify variance when `infer_variance=True` +generics_paramspec_variance.py:95:9: error[invalid-paramspec] A `ParamSpec` cannot specify variance when `infer_variance=True` +generics_paramspec_variance.py:103:14: error[invalid-assignment] Object of type `InvariantParamSpecOld[(bool, /)]` is not assignable to `InvariantParamSpecOld[(int, /)]` +generics_paramspec_variance.py:104:14: error[invalid-assignment] Object of type `InvariantParamSpecOld[(object, /)]` is not assignable to `InvariantParamSpecOld[(int, /)]` +generics_paramspec_variance.py:114:49: error[invalid-assignment] Object of type `ContravariantParamSpecOld[(int, /)]` is not assignable to `ContravariantParamSpecOld[(object, /)]` +generics_paramspec_variance.py:127:43: error[invalid-assignment] Object of type `CovariantParamSpecOld[(object, /)]` is not assignable to `CovariantParamSpecOld[(int, /)]` +""" diff --git a/conformance/results/ty/generics_typevartuple_basic.toml b/conformance/results/ty/generics_typevartuple_basic.toml index 7fd82253b..ffb88837a 100644 --- a/conformance/results/ty/generics_typevartuple_basic.toml +++ b/conformance/results/ty/generics_typevartuple_basic.toml @@ -1,15 +1,15 @@ conformance_automated = "Pass" +conformant = "Pass" errors_diff = """ """ output = """ -generics_typevartuple_basic.py:42:34: error[invalid-argument-type] Argument to `Array.__init__` is incorrect: Expected `tuple[Height, Width]`, found `Height` -generics_typevartuple_basic.py:43:41: error[invalid-argument-type] Argument to `Array.__init__` is incorrect: Expected `tuple[Batch, Height, Width]`, found `tuple[Batch, Width]` -generics_typevartuple_basic.py:44:41: error[invalid-assignment] Object of type `Array[Time, Batch, Width, Height]` is not assignable to `Array[Time, Batch, Height, Width]` -generics_typevartuple_basic.py:52:14: error[invalid-generic-class] `TypeVarTuple` must be unpacked with `*` or `Unpack[]` when used as an argument to `Generic` -generics_typevartuple_basic.py:53:37: error[invalid-type-form] Bare TypeVarTuple `Shape` is not valid in this context in a parameter annotation -generics_typevartuple_basic.py:56:34: error[invalid-type-form] Bare TypeVarTuple `Shape` is not valid in this context in a return type annotation -generics_typevartuple_basic.py:59:24: error[invalid-type-form] Bare TypeVarTuple `Shape` is not valid in this context in a parameter annotation -generics_typevartuple_basic.py:65:27: error[invalid-legacy-type-variable] The `covariant` parameter of `typing.TypeVarTuple` was added in Python 3.15 +generics_typevartuple_basic.py:43:34: error[invalid-argument-type] Argument to `Array.__init__` is incorrect: Expected `tuple[Height, Width]`, found `Height` +generics_typevartuple_basic.py:44:41: error[invalid-argument-type] Argument to `Array.__init__` is incorrect: Expected `tuple[Batch, Height, Width]`, found `tuple[Batch, Width]` +generics_typevartuple_basic.py:45:41: error[invalid-assignment] Object of type `Array[Time, Batch, Width, Height]` is not assignable to `Array[Time, Batch, Height, Width]` +generics_typevartuple_basic.py:53:14: error[invalid-generic-class] `TypeVarTuple` must be unpacked with `*` or `Unpack[]` when used as an argument to `Generic` +generics_typevartuple_basic.py:54:37: error[invalid-type-form] Bare TypeVarTuple `Shape` is not valid in this context in a parameter annotation +generics_typevartuple_basic.py:57:34: error[invalid-type-form] Bare TypeVarTuple `Shape` is not valid in this context in a return type annotation +generics_typevartuple_basic.py:60:24: error[invalid-type-form] Bare TypeVarTuple `Shape` is not valid in this context in a parameter annotation generics_typevartuple_basic.py:66:7: error[invalid-legacy-type-variable] `TypeVarTuple` can only have one positional argument generics_typevartuple_basic.py:67:27: error[invalid-legacy-type-variable] The `bound` parameter of `typing.TypeVarTuple` was added in Python 3.15 generics_typevartuple_basic.py:91:15: error[invalid-argument-type] Argument to function `func2` is incorrect: Expected `tuple[Literal[0], Literal[0]]`, found `tuple[Literal[0]]` @@ -17,4 +17,5 @@ generics_typevartuple_basic.py:100:14: error[invalid-argument-type] Argument to generics_typevartuple_basic.py:100:17: error[invalid-argument-type] Argument to function `multiply` is incorrect: Expected `Array[Height | Width]`, found `Array[Width]` generics_typevartuple_basic.py:101:17: error[invalid-argument-type] Argument to function `multiply` is incorrect: Expected `Array[Height]`, found `Array[Height, Width]` generics_typevartuple_basic.py:107:14: error[invalid-generic-class] Only one `TypeVarTuple` parameter is allowed in a `Generic` subscription +generics_typevartuple_basic.py:111:20: error[invalid-type-form] Generic class `Array4` cannot have multiple `TypeVarTuple` type parameters: `Ts2` is an additional TypeVarTuple """ diff --git a/conformance/results/ty/generics_typevartuple_variance.toml b/conformance/results/ty/generics_typevartuple_variance.toml new file mode 100644 index 000000000..ed7025479 --- /dev/null +++ b/conformance/results/ty/generics_typevartuple_variance.toml @@ -0,0 +1,29 @@ +conformant = "Partial" +conformance_automated = "Fail" +notes = """ +Does not error when a ParamSpec is used in a position that violates its explicit variance. +""" +errors_diff = """ +Line 72: Expected 1 errors +Line 83: Expected 1 errors +""" +output = """ +generics_typevartuple_variance.py:14:45: error[invalid-assignment] Object of type `InvariantTypeVarTuple[int]` is not assignable to `InvariantTypeVarTuple[object]` +generics_typevartuple_variance.py:15:42: error[invalid-assignment] Object of type `InvariantTypeVarTuple[object]` is not assignable to `InvariantTypeVarTuple[int]` +generics_typevartuple_variance.py:17:64: error[invalid-assignment] Object of type `InvariantTypeVarTuple[*tuple[object, ...]]` is not assignable to `InvariantTypeVarTuple[*tuple[int, ...]]` +generics_typevartuple_variance.py:18:70: error[invalid-assignment] Object of type `InvariantTypeVarTuple[*tuple[int, ...]]` is not assignable to `InvariantTypeVarTuple[*tuple[object, ...]]` +generics_typevartuple_variance.py:26:53: error[invalid-assignment] Object of type `ContravariantTypeVarTuple[object, int]` is not assignable to `ContravariantTypeVarTuple[object, object]` +generics_typevartuple_variance.py:29:70: error[invalid-assignment] Object of type `ContravariantTypeVarTuple[*tuple[int, ...]]` is not assignable to `ContravariantTypeVarTuple[*tuple[object, ...]]` +generics_typevartuple_variance.py:38:39: error[invalid-assignment] Object of type `CovariantTypeVarTuple[object]` is not assignable to `CovariantTypeVarTuple[int]` +generics_typevartuple_variance.py:41:50: error[invalid-assignment] Object of type `CovariantTypeVarTuple[bool, object]` is not assignable to `CovariantTypeVarTuple[int, int]` +generics_typevartuple_variance.py:42:50: error[invalid-assignment] Object of type `CovariantTypeVarTuple[object, bool]` is not assignable to `CovariantTypeVarTuple[int, int]` +generics_typevartuple_variance.py:43:50: error[invalid-assignment] Object of type `CovariantTypeVarTuple[object, object]` is not assignable to `CovariantTypeVarTuple[int, int]` +generics_typevartuple_variance.py:44:61: error[invalid-assignment] Object of type `CovariantTypeVarTuple[*tuple[object, ...]]` is not assignable to `CovariantTypeVarTuple[*tuple[int, ...]]` +generics_typevartuple_variance.py:49:10: error[invalid-legacy-type-variable] A `TypeVarTuple` cannot be both covariant and contravariant +generics_typevartuple_variance.py:50:10: error[invalid-legacy-type-variable] A `TypeVarTuple` cannot specify variance when `infer_variance=True` +generics_typevartuple_variance.py:51:10: error[invalid-legacy-type-variable] A `TypeVarTuple` cannot specify variance when `infer_variance=True` +generics_typevartuple_variance.py:61:45: error[invalid-assignment] Object of type `InvariantTypeVarTupleOld[int]` is not assignable to `InvariantTypeVarTupleOld[object]` +generics_typevartuple_variance.py:62:42: error[invalid-assignment] Object of type `InvariantTypeVarTupleOld[object]` is not assignable to `InvariantTypeVarTupleOld[int]` +generics_typevartuple_variance.py:76:52: error[invalid-assignment] Object of type `ContravariantTypeVarTupleOld[int]` is not assignable to `ContravariantTypeVarTupleOld[object]` +generics_typevartuple_variance.py:90:46: error[invalid-assignment] Object of type `CovariantTypeVarTupleOld[object]` is not assignable to `CovariantTypeVarTupleOld[int]` +""" diff --git a/conformance/results/ty/protocols_variance.toml b/conformance/results/ty/protocols_variance.toml index 303056e98..7e595c1a9 100644 --- a/conformance/results/ty/protocols_variance.toml +++ b/conformance/results/ty/protocols_variance.toml @@ -1,13 +1,13 @@ conformance_automated = "Fail" conformant = "Unsupported" errors_diff = """ -Line 21: Expected 1 errors -Line 40: Expected 1 errors -Line 56: Expected 1 errors -Line 66: Expected 1 errors -Line 104: Expected 1 errors -Lines 61, 62: Expected error (tag 'covariant_in_input') -Lines 71, 72: Expected error (tag 'contravariant_in_output') +Line 22: Expected 1 errors +Line 41: Expected 1 errors +Line 57: Expected 1 errors +Line 67: Expected 1 errors +Line 105: Expected 1 errors +Lines 62, 63: Expected error (tag 'covariant_in_input') +Lines 72, 73: Expected error (tag 'contravariant_in_output') """ output = """ """ diff --git a/conformance/results/zuban/generics_mixed_variance_inference.toml b/conformance/results/zuban/generics_mixed_variance_inference.toml new file mode 100644 index 000000000..47432b050 --- /dev/null +++ b/conformance/results/zuban/generics_mixed_variance_inference.toml @@ -0,0 +1,11 @@ +conformant = "Unsupported" +conformance_automated = "Fail" +errors_diff = """ +Line 17: Unexpected errors ['generics_mixed_variance_inference.py:17: error: Incompatible types in assignment (expression has type "Mixed[int, bool, []]", variable has type "Mixed[int, int, []]") [assignment]'] +""" +output = """ +generics_mixed_variance_inference.py:13: error: Incompatible types in assignment (expression has type "Mixed[bool, []]", variable has type "Mixed[int, []]") [assignment] +generics_mixed_variance_inference.py:16: error: Incompatible types in assignment (expression has type "Mixed[int, object, []]", variable has type "Mixed[int, int, []]") [assignment] +generics_mixed_variance_inference.py:17: error: Incompatible types in assignment (expression has type "Mixed[int, bool, []]", variable has type "Mixed[int, int, []]") [assignment] +generics_mixed_variance_inference.py:21: error: Incompatible types in assignment (expression has type "Mixed[int, [bool]]", variable has type "Mixed[int, [int]]") [assignment] +""" diff --git a/conformance/results/zuban/generics_paramspec_variance.toml b/conformance/results/zuban/generics_paramspec_variance.toml new file mode 100644 index 000000000..3d524f697 --- /dev/null +++ b/conformance/results/zuban/generics_paramspec_variance.toml @@ -0,0 +1,46 @@ +conformant = "Unsupported" +conformance_automated = "Fail" +errors_diff = """ +Line 15: Expected 1 errors +Line 30: Expected 1 errors +Line 64: Expected 1 errors +Line 104: Expected 1 errors +Line 110: Expected 1 errors +Line 121: Expected 1 errors +Line 127: Expected 1 errors +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]'] +Line 58: Unexpected errors ['generics_paramspec_variance.py:58: error: Incompatible types in assignment (expression has type "InitP[[*, a: int]]", variable has type "InitP[[a: int]]") [assignment]'] +Line 60: Unexpected errors ['generics_paramspec_variance.py:60: error: Incompatible types in assignment (expression has type "InitP[[int]]", variable has type "InitP[[a: int]]") [assignment]'] +Line 83: Unexpected errors ['generics_paramspec_variance.py:83: error: Invalid type comment or annotation [valid-type]'] +Line 91: Unexpected errors ['generics_paramspec_variance.py:91: error: String argument 1 "InP" to ParamSpec(...) does not match variable name "P" [misc]'] +Line 92: Unexpected errors ['generics_paramspec_variance.py:92: error: The variance and bound arguments to ParamSpec do not have defined semantics yet [misc]'] +Line 117: Unexpected errors ['generics_paramspec_variance.py:117: error: The variance and bound arguments to ParamSpec do not have defined semantics yet [misc]'] +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]'] +""" +output = """ +generics_paramspec_variance.py:14: error: Incompatible types in assignment (expression has type "InvariantParamSpec[[int]]", variable has type "InvariantParamSpec[[object]]") [assignment] +generics_paramspec_variance.py:21: error: Incompatible types in assignment (expression has type "ContravariantParamSpec[[int]]", variable has type "ContravariantParamSpec[[object]]") [assignment] +generics_paramspec_variance.py:31: error: Incompatible types in assignment (expression has type "CovariantParamSpec[[int]]", variable has type "CovariantParamSpec[[object]]") [assignment] +generics_paramspec_variance.py:58: error: Incompatible types in assignment (expression has type "InitP[[*, a: int]]", variable has type "InitP[[a: int]]") [assignment] +generics_paramspec_variance.py:60: error: Incompatible types in assignment (expression has type "InitP[[int]]", variable has type "InitP[[a: int]]") [assignment] +generics_paramspec_variance.py:62: error: Invalid type comment or annotation [valid-type] +generics_paramspec_variance.py:66: error: Incompatible types in assignment (expression has type "InitP[[a: int, b: str]]", variable has type "InitP[[a: int]]") [assignment] +generics_paramspec_variance.py:79: error: Incompatible types in assignment (expression has type "OutitP[[*, a: int]]", variable has type "OutitP[[a: int]]") [assignment] +generics_paramspec_variance.py:81: error: Incompatible types in assignment (expression has type "OutitP[[int]]", variable has type "OutitP[[a: int]]") [assignment] +generics_paramspec_variance.py:83: error: Invalid type comment or annotation [valid-type] +generics_paramspec_variance.py:87: error: Incompatible types in assignment (expression has type "OutitP[[a: int, b: str]]", variable has type "OutitP[[a: int]]") [assignment] +generics_paramspec_variance.py:91: error: String argument 1 "InP" to ParamSpec(...) does not match variable name "P" [misc] +generics_paramspec_variance.py:92: error: The variance and bound arguments to ParamSpec do not have defined semantics yet [misc] +generics_paramspec_variance.py:93: error: The variance and bound arguments to ParamSpec do not have defined semantics yet [misc] +generics_paramspec_variance.py:93: error: The variance and bound arguments to ParamSpec do not have defined semantics yet [misc] +generics_paramspec_variance.py:94: error: String argument 1 "InvP1" to ParamSpec(...) does not match variable name "InvP2" [misc] +generics_paramspec_variance.py:94: error: The variance and bound arguments to ParamSpec do not have defined semantics yet [misc] +generics_paramspec_variance.py:94: error: Unexpected argument to "ParamSpec()" [misc] +generics_paramspec_variance.py:95: error: String argument 1 "InvP1" to ParamSpec(...) does not match variable name "InvP3" [misc] +generics_paramspec_variance.py:95: error: The variance and bound arguments to ParamSpec do not have defined semantics yet [misc] +generics_paramspec_variance.py:95: error: Unexpected argument to "ParamSpec()" [misc] +generics_paramspec_variance.py:103: error: Incompatible types in assignment (expression has type "InvariantParamSpecOld[[bool]]", variable has type "InvariantParamSpecOld[[int]]") [assignment] +generics_paramspec_variance.py:114: error: Incompatible types in assignment (expression has type "ContravariantParamSpecOld[[int]]", variable has type "ContravariantParamSpecOld[[object]]") [assignment] +generics_paramspec_variance.py:117: error: The variance and bound arguments to ParamSpec do not have defined semantics yet [misc] +generics_paramspec_variance.py:128: error: Incompatible types in assignment (expression has type "CovariantParamSpecOld[[int]]", variable has type "CovariantParamSpecOld[[object]]") [assignment] +""" diff --git a/conformance/results/zuban/generics_typevartuple_basic.toml b/conformance/results/zuban/generics_typevartuple_basic.toml index ca0cca722..b9ffa1e5a 100644 --- a/conformance/results/zuban/generics_typevartuple_basic.toml +++ b/conformance/results/zuban/generics_typevartuple_basic.toml @@ -2,18 +2,18 @@ conformance_automated = "Pass" errors_diff = """ """ output = """ -generics_typevartuple_basic.py:42: error: Argument 1 to "Array" has incompatible type "Height"; expected "tuple[Height, Width]" [arg-type] -generics_typevartuple_basic.py:43: error: Argument 1 to "Array" has incompatible type "tuple[Batch, Width]"; expected "tuple[Batch, Height, Width]" [arg-type] -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] -generics_typevartuple_basic.py:52: error: Free type variable expected in Generic[...] [misc] -generics_typevartuple_basic.py:53: error: TypeVarTuple "Shape" is only valid with an unpack [valid-type] -generics_typevartuple_basic.py:56: error: TypeVarTuple "Shape" is only valid with an unpack [valid-type] -generics_typevartuple_basic.py:59: error: TypeVarTuple "Shape" is only valid with an unpack [valid-type] -generics_typevartuple_basic.py:65: error: Unexpected keyword argument "covariant" for "TypeVarTuple" [call-arg] +generics_typevartuple_basic.py:43: error: Argument 1 to "Array" has incompatible type "Height"; expected "tuple[Height, Width]" [arg-type] +generics_typevartuple_basic.py:44: error: Argument 1 to "Array" has incompatible type "tuple[Batch, Width]"; expected "tuple[Batch, Height, Width]" [arg-type] +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] +generics_typevartuple_basic.py:53: error: Free type variable expected in Generic[...] [misc] +generics_typevartuple_basic.py:54: error: TypeVarTuple "Shape" is only valid with an unpack [valid-type] +generics_typevartuple_basic.py:57: error: TypeVarTuple "Shape" is only valid with an unpack [valid-type] +generics_typevartuple_basic.py:60: error: TypeVarTuple "Shape" is only valid with an unpack [valid-type] generics_typevartuple_basic.py:66: error: Too many positional arguments for "TypeVarTuple" [call-arg] generics_typevartuple_basic.py:67: error: Unexpected keyword argument "bound" for "TypeVarTuple" [call-arg] generics_typevartuple_basic.py:91: error: Argument 2 to "func2" has incompatible type "tuple[int]"; expected "tuple[int, int]" [arg-type] generics_typevartuple_basic.py:100: error: Argument 2 to "multiply" has incompatible type "Array[Width]"; expected "Array[Height]" [arg-type] generics_typevartuple_basic.py:101: error: Argument 2 to "multiply" has incompatible type "Array[Height, Width]"; expected "Array[Height]" [arg-type] generics_typevartuple_basic.py:107: error: Can only use one type var tuple in a class def [misc] +generics_typevartuple_basic.py:111: error: Can only use one TypeVarTuple in type params [misc] """ diff --git a/conformance/results/zuban/generics_typevartuple_variance.toml b/conformance/results/zuban/generics_typevartuple_variance.toml new file mode 100644 index 000000000..b3127ff2b --- /dev/null +++ b/conformance/results/zuban/generics_typevartuple_variance.toml @@ -0,0 +1,47 @@ +conformant = "Unsupported" +conformance_automated = "Fail" +errors_diff = """ +Line 72: Expected 1 errors +Line 83: Expected 1 errors +Line 27: Unexpected errors ['generics_typevartuple_variance.py:27: error: Incompatible types in assignment (expression has type "ContravariantTypeVarTuple[object]", variable has type "ContravariantTypeVarTuple[int]") [assignment]'] +Line 28: Unexpected errors ['generics_typevartuple_variance.py:28: error: Incompatible types in assignment (expression has type "ContravariantTypeVarTuple[Unpack[Tuple[object, ...]]]", variable has type "ContravariantTypeVarTuple[Unpack[Tuple[int, ...]]]") [assignment]'] +Line 39: Unexpected errors ['generics_typevartuple_variance.py:39: error: Incompatible types in assignment (expression has type "CovariantTypeVarTuple[int]", variable has type "CovariantTypeVarTuple[object]") [assignment]'] +Line 40: Unexpected errors ['generics_typevartuple_variance.py:40: error: Incompatible types in assignment (expression has type "CovariantTypeVarTuple[bool, bool]", variable has type "CovariantTypeVarTuple[int, int]") [assignment]'] +Line 45: Unexpected errors ['generics_typevartuple_variance.py:45: error: Incompatible types in assignment (expression has type "CovariantTypeVarTuple[Unpack[Tuple[int, ...]]]", variable has type "CovariantTypeVarTuple[Unpack[Tuple[object, ...]]]") [assignment]'] +Line 66: Unexpected errors ['generics_typevartuple_variance.py:66: error: Unexpected keyword argument "contravariant" for "TypeVarTuple" [call-arg]'] +Line 77: Unexpected errors ['generics_typevartuple_variance.py:77: error: Incompatible types in assignment (expression has type "ContravariantTypeVarTupleOld[object]", variable has type "ContravariantTypeVarTupleOld[int]") [assignment]'] +Line 80: Unexpected errors ['generics_typevartuple_variance.py:80: error: Unexpected keyword argument "covariant" for "TypeVarTuple" [call-arg]'] +Line 91: Unexpected errors ['generics_typevartuple_variance.py:91: error: Incompatible types in assignment (expression has type "CovariantTypeVarTupleOld[int]", variable has type "CovariantTypeVarTupleOld[object]") [assignment]'] +""" +output = """ +generics_typevartuple_variance.py:14: error: Incompatible types in assignment (expression has type "InvariantTypeVarTuple[int]", variable has type "InvariantTypeVarTuple[object]") [assignment] +generics_typevartuple_variance.py:15: error: Incompatible types in assignment (expression has type "InvariantTypeVarTuple[object]", variable has type "InvariantTypeVarTuple[int]") [assignment] +generics_typevartuple_variance.py:17: error: Incompatible types in assignment (expression has type "InvariantTypeVarTuple[Unpack[Tuple[object, ...]]]", variable has type "InvariantTypeVarTuple[Unpack[Tuple[int, ...]]]") [assignment] +generics_typevartuple_variance.py:18: error: Incompatible types in assignment (expression has type "InvariantTypeVarTuple[Unpack[Tuple[int, ...]]]", variable has type "InvariantTypeVarTuple[Unpack[Tuple[object, ...]]]") [assignment] +generics_typevartuple_variance.py:26: error: Incompatible types in assignment (expression has type "ContravariantTypeVarTuple[object, int]", variable has type "ContravariantTypeVarTuple[object, object]") [assignment] +generics_typevartuple_variance.py:27: error: Incompatible types in assignment (expression has type "ContravariantTypeVarTuple[object]", variable has type "ContravariantTypeVarTuple[int]") [assignment] +generics_typevartuple_variance.py:28: error: Incompatible types in assignment (expression has type "ContravariantTypeVarTuple[Unpack[Tuple[object, ...]]]", variable has type "ContravariantTypeVarTuple[Unpack[Tuple[int, ...]]]") [assignment] +generics_typevartuple_variance.py:29: error: Incompatible types in assignment (expression has type "ContravariantTypeVarTuple[Unpack[Tuple[int, ...]]]", variable has type "ContravariantTypeVarTuple[Unpack[Tuple[object, ...]]]") [assignment] +generics_typevartuple_variance.py:38: error: Incompatible types in assignment (expression has type "CovariantTypeVarTuple[object]", variable has type "CovariantTypeVarTuple[int]") [assignment] +generics_typevartuple_variance.py:39: error: Incompatible types in assignment (expression has type "CovariantTypeVarTuple[int]", variable has type "CovariantTypeVarTuple[object]") [assignment] +generics_typevartuple_variance.py:40: error: Incompatible types in assignment (expression has type "CovariantTypeVarTuple[bool, bool]", variable has type "CovariantTypeVarTuple[int, int]") [assignment] +generics_typevartuple_variance.py:41: error: Incompatible types in assignment (expression has type "CovariantTypeVarTuple[bool, object]", variable has type "CovariantTypeVarTuple[int, int]") [assignment] +generics_typevartuple_variance.py:42: error: Incompatible types in assignment (expression has type "CovariantTypeVarTuple[object, bool]", variable has type "CovariantTypeVarTuple[int, int]") [assignment] +generics_typevartuple_variance.py:43: error: Incompatible types in assignment (expression has type "CovariantTypeVarTuple[object, object]", variable has type "CovariantTypeVarTuple[int, int]") [assignment] +generics_typevartuple_variance.py:44: error: Incompatible types in assignment (expression has type "CovariantTypeVarTuple[Unpack[Tuple[object, ...]]]", variable has type "CovariantTypeVarTuple[Unpack[Tuple[int, ...]]]") [assignment] +generics_typevartuple_variance.py:45: error: Incompatible types in assignment (expression has type "CovariantTypeVarTuple[Unpack[Tuple[int, ...]]]", variable has type "CovariantTypeVarTuple[Unpack[Tuple[object, ...]]]") [assignment] +generics_typevartuple_variance.py:49: error: Unexpected keyword argument "covariant" for "TypeVarTuple" [call-arg] +generics_typevartuple_variance.py:49: error: Unexpected keyword argument "contravariant" for "TypeVarTuple" [call-arg] +generics_typevartuple_variance.py:50: error: Unexpected keyword argument "covariant" for "TypeVarTuple" [call-arg] +generics_typevartuple_variance.py:50: error: Unexpected keyword argument "infer_variance" for "TypeVarTuple" [call-arg] +generics_typevartuple_variance.py:51: error: Unexpected keyword argument "covariant" for "TypeVarTuple" [call-arg] +generics_typevartuple_variance.py:51: error: Unexpected keyword argument "infer_variance" for "TypeVarTuple" [call-arg] +generics_typevartuple_variance.py:61: error: Incompatible types in assignment (expression has type "InvariantTypeVarTupleOld[int]", variable has type "InvariantTypeVarTupleOld[object]") [assignment] +generics_typevartuple_variance.py:62: error: Incompatible types in assignment (expression has type "InvariantTypeVarTupleOld[object]", variable has type "InvariantTypeVarTupleOld[int]") [assignment] +generics_typevartuple_variance.py:66: error: Unexpected keyword argument "contravariant" for "TypeVarTuple" [call-arg] +generics_typevartuple_variance.py:76: error: Incompatible types in assignment (expression has type "ContravariantTypeVarTupleOld[int]", variable has type "ContravariantTypeVarTupleOld[object]") [assignment] +generics_typevartuple_variance.py:77: error: Incompatible types in assignment (expression has type "ContravariantTypeVarTupleOld[object]", variable has type "ContravariantTypeVarTupleOld[int]") [assignment] +generics_typevartuple_variance.py:80: error: Unexpected keyword argument "covariant" for "TypeVarTuple" [call-arg] +generics_typevartuple_variance.py:90: error: Incompatible types in assignment (expression has type "CovariantTypeVarTupleOld[object]", variable has type "CovariantTypeVarTupleOld[int]") [assignment] +generics_typevartuple_variance.py:91: error: Incompatible types in assignment (expression has type "CovariantTypeVarTupleOld[int]", variable has type "CovariantTypeVarTupleOld[object]") [assignment] +""" diff --git a/conformance/results/zuban/protocols_variance.toml b/conformance/results/zuban/protocols_variance.toml index ba95f1366..f6d041024 100644 --- a/conformance/results/zuban/protocols_variance.toml +++ b/conformance/results/zuban/protocols_variance.toml @@ -1,14 +1,20 @@ -conformance_automated = "Pass" +conformant = "Partial" +conformance_automated = "Fail" +notes = """ +Doesn't support keyword arguments to ParamSpec. +""" errors_diff = """ +Line 15: Unexpected errors ['protocols_variance.py:15: error: The variance and bound arguments to ParamSpec do not have defined semantics yet [misc]'] """ output = """ -protocols_variance.py:21: error: Invariant type variable "T1" used in protocol where Covariant one is expected [misc] -protocols_variance.py:40: error: Invariant type variable "T3" used in protocol where Contravariant one is expected [misc] -protocols_variance.py:56: error: Invariant type variable "T1" used in protocol where Contravariant one is expected [misc] -protocols_variance.py:61: error: Covariant type variable "T1_co" used in protocol where Contravariant one is expected [misc] -protocols_variance.py:62: error: Cannot use a covariant type variable as a parameter [type-var] -protocols_variance.py:66: error: Invariant type variable "T1" used in protocol where Covariant one is expected [misc] -protocols_variance.py:71: error: Contravariant type variable "T1_contra" used in protocol where Covariant one is expected [misc] -protocols_variance.py:72: error: Cannot use a contravariant type variable as return type [type-var] -protocols_variance.py:104: error: Invariant type variable "T1" used in protocol where Covariant one is expected [misc] +protocols_variance.py:15: error: The variance and bound arguments to ParamSpec do not have defined semantics yet [misc] +protocols_variance.py:22: error: Invariant type variable "T1" used in protocol where Covariant one is expected [misc] +protocols_variance.py:41: error: Invariant type variable "T3" used in protocol where Contravariant one is expected [misc] +protocols_variance.py:57: error: Invariant type variable "T1" used in protocol where Contravariant one is expected [misc] +protocols_variance.py:62: error: Covariant type variable "T1_co" used in protocol where Contravariant one is expected [misc] +protocols_variance.py:63: error: Cannot use a covariant type variable as a parameter [type-var] +protocols_variance.py:67: error: Invariant type variable "T1" used in protocol where Covariant one is expected [misc] +protocols_variance.py:72: error: Contravariant type variable "T1_contra" used in protocol where Covariant one is expected [misc] +protocols_variance.py:73: error: Cannot use a contravariant type variable as return type [type-var] +protocols_variance.py:105: error: Invariant type variable "T1" used in protocol where Covariant one is expected [misc] """ diff --git a/conformance/tests/generics_mixed_variance_inference.py b/conformance/tests/generics_mixed_variance_inference.py new file mode 100644 index 000000000..7bb3a4b3a --- /dev/null +++ b/conformance/tests/generics_mixed_variance_inference.py @@ -0,0 +1,21 @@ +""" +Tests variance inference for mixed type parameters. +""" + +# Specification: https://peps.python.org/pep-0695/#variance-inference + +class Mixed[T, *Ts, **P]: + def f(self, x: T, /, *args: P.args, **kwargs: P.kwargs) -> tuple[*Ts]: + raise NotImplementedError + +# T should be contra +_1: Mixed[int, []] = Mixed[object, []]() # OK +_2: Mixed[int, []] = Mixed[bool, []]() # E + +# Ts should be co +_3: Mixed[int, int, []] = Mixed[int, object, []]() # E +_4: Mixed[int, int, []] = Mixed[int, bool, []]() # OK + +# P should be contra +_5: Mixed[int, [int]] = Mixed[int, [object]]() # OK +_6: Mixed[int, [int]] = Mixed[int, [bool]]() # E diff --git a/conformance/tests/generics_paramspec_variance.py b/conformance/tests/generics_paramspec_variance.py new file mode 100644 index 000000000..b3da777bb --- /dev/null +++ b/conformance/tests/generics_paramspec_variance.py @@ -0,0 +1,128 @@ +""" +Tests variance of ParamSpec. +""" + +# Specification: https://typing.readthedocs.io/en/latest/spec/generics.html#semantics + + +from typing import Callable, Generic, ParamSpec + + +class InvariantParamSpec[**InOutP]: + a: Callable[InOutP, None] + +in_out_obj: InvariantParamSpec[object] = InvariantParamSpec[int]() # E +in_out_int: InvariantParamSpec[int] = InvariantParamSpec[object]() # E + + +class ContravariantParamSpec[**InP]: + def f(self, *args: InP.args, **kwargs: InP.kwargs): ... + +in_obj: ContravariantParamSpec[object] = ContravariantParamSpec[int]() # E +in_int: ContravariantParamSpec[int] = ContravariantParamSpec[object]() # OK + + +class CovariantParamSpec[**OutP]: + def f(self, fn: Callable[OutP, None]) -> None: + raise NotImplementedError + + +out_int: CovariantParamSpec[int] = CovariantParamSpec[object]() # E +out_obj: CovariantParamSpec[object] = CovariantParamSpec[int]() # OK + +# cases involving keyword-only, positional-only parameters, parameter names, defaults and differing callable arities +class Box[T]: + t: T + + def __init__(self, t: T): ... + + +def f(a: int): ... +def kw(*, a: int): ... +def pos(a: int, /): ... +def default(a: int = 1): ... +def arity(a: int, b: str): ... + + +class InitP[**P]: # contravariant + def __init__(self, fn: Callable[P, None]): ... + + def usage(self) -> Callable[P, None]: + """infer contravariance""" + raise NotImplementedError + + +box = Box(InitP(f)) + +kw_p = InitP(kw) +box.t = kw_p # OK +pos_p = InitP(pos) +box.t = pos_p # OK +names_p = InitP(f) +_: InitP[int]() = names_p # E +default_p = InitP(default) +box.t = default_p # E +arity_p = InitP(arity) +box.t = arity_p # E + + +class OutitP[**P]: # covariant + def __init__(self, fn: Callable[P, None]): ... + + def usage(self, fn: Callable[P, None]): + """infer covariance""" + + +box = Box(OutitP(f)) + +kw_p = OutitP(kw) +box.t = kw_p # E +pos_p = OutitP(pos) +box.t = pos_p # E +names_p = OutitP(f) +_: OutitP[int]() = names_p # OK +default_p = OutitP(default) +box.t = default_p # OK +arity_p = OutitP(arity) +box.t = arity_p # E + + +# old style +P = ParamSpec("InP") # OK +InP = ParamSpec("InP", contravariant=True) # OK +InvP1 = ParamSpec("InvP1", covariant=True, contravariant=True) # E +InvP2 = ParamSpec("InvP1", covariant=True, infer_variance=True) # E +InvP3 = ParamSpec("InvP1", contravariant=True, infer_variance=True) # E + +class InvariantParamSpecOld(Generic[P]): + def f(self, fn: Callable[InP, None]) -> Callable[InP, None]: # OK + raise NotImplementedError + +in_out_old: InvariantParamSpecOld[int] +in_out_old = InvariantParamSpecOld[int]() # OK +in_out_old = InvariantParamSpecOld[bool]() # E +in_out_old = InvariantParamSpecOld[object]() # E + +class ContravariantParamSpecOld(Generic[InP]): + def in_f(self) -> Callable[InP, None]: # OK + raise NotImplementedError + + def out_f(self, fn: Callable[InP, None]) -> None: # E + raise NotImplementedError + + +in_obj_old: ContravariantParamSpecOld[object] = ContravariantParamSpecOld[int]() # E +in_int_old: ContravariantParamSpecOld[int] = ContravariantParamSpecOld[object]() # OK + +OutP = ParamSpec("OutP", covariant=True) + + +class CovariantParamSpecOld(Generic[OutP]): + def in_f(self) -> Callable[OutP, None]: # E + raise NotImplementedError + def out_f(self, fn: Callable[OutP, None]) -> None: # OK + raise NotImplementedError + + +out_int_old: CovariantParamSpecOld[int] = CovariantParamSpecOld[object]() # E +out_obj_old: CovariantParamSpecOld[object] = CovariantParamSpecOld[int]() # OK diff --git a/conformance/tests/generics_typevartuple_basic.py b/conformance/tests/generics_typevartuple_basic.py index 47b493ff0..20dd6fdbf 100644 --- a/conformance/tests/generics_typevartuple_basic.py +++ b/conformance/tests/generics_typevartuple_basic.py @@ -7,6 +7,7 @@ from typing import Generic, NewType, TypeVarTuple, assert_type Ts = TypeVarTuple("Ts") +Ts1 = TypeVarTuple("Ts1") class Array1(Generic[*Ts]): @@ -60,9 +61,8 @@ def method1(*args: Shape) -> None: # E: not unpacked ... -# > TypeVarTuple does not yet support specification of variance, bounds, constraints. +# > TypeVarTuple does not yet support specification of bounds, constraints. -Ts1 = TypeVarTuple("Ts1", covariant=True) # E Ts2 = TypeVarTuple("Ts2", int, float) # E Ts3 = TypeVarTuple("Ts3", bound=int) # E @@ -104,5 +104,9 @@ def func3(x: Array[Height], y: Array[Width], z: Array[Height, Width]): # > Only a single type variable tuple may appear in a type parameter list. -class Array3(Generic[*Ts1, *Ts2]): # E +class Array3(Generic[*Ts, *Ts1]): # E + ... + + +class Array4[*Ts1, *Ts2]: # E ... diff --git a/conformance/tests/generics_typevartuple_variance.py b/conformance/tests/generics_typevartuple_variance.py new file mode 100644 index 000000000..262f37740 --- /dev/null +++ b/conformance/tests/generics_typevartuple_variance.py @@ -0,0 +1,91 @@ +""" +Tests variance of TypeVarTuple. +""" + +# Specification: https://typing.readthedocs.io/en/latest/spec/generics.html#semantics + + +from typing import Generic +from typing_extensions import TypeVarTuple + +class InvariantTypeVarTuple[*InOutTs]: + a: tuple[*InOutTs] + +in_out_obj: InvariantTypeVarTuple[object] = InvariantTypeVarTuple[int]() # E +in_out_int: InvariantTypeVarTuple[int] = InvariantTypeVarTuple[object]() # E +in_out_int = InvariantTypeVarTuple[int]() +in_out_variadic_int: InvariantTypeVarTuple[*tuple[int, ...]] = InvariantTypeVarTuple[*tuple[object, ...]]() # E +in_out_variadic_object: InvariantTypeVarTuple[*tuple[object, ...]] = InvariantTypeVarTuple[*tuple[int, ...]]() # E +in_out_empty: InvariantTypeVarTuple[()] = InvariantTypeVarTuple[()]() # OK + + +class ContravariantTypeVarTuple[*InTs]: + def f(self, t: tuple[*InTs]): + raise NotImplementedError + +in_obj: ContravariantTypeVarTuple[object, object] = ContravariantTypeVarTuple[object, int]() # E +in_int: ContravariantTypeVarTuple[int] = ContravariantTypeVarTuple[object]() # OK +in_variadic_int: ContravariantTypeVarTuple[*tuple[int, ...]] = ContravariantTypeVarTuple[*tuple[object, ...]]() # OK +in_variadic_object: ContravariantTypeVarTuple[*tuple[object, ...]] = ContravariantTypeVarTuple[*tuple[int, ...]]() # E +in_empty: ContravariantTypeVarTuple[()] = ContravariantTypeVarTuple[()]() # OK + + +class CovariantTypeVarTuple[*OutTs]: + def f(self) -> tuple[*OutTs]: + raise NotImplementedError + + +out_int: CovariantTypeVarTuple[int] = CovariantTypeVarTuple[object]() # E +out_obj: CovariantTypeVarTuple[object] = CovariantTypeVarTuple[int]() # OK +out_multiple1: CovariantTypeVarTuple[int, int] = CovariantTypeVarTuple[bool, bool]() # OK +out_multiple2: CovariantTypeVarTuple[int, int] = CovariantTypeVarTuple[bool, object]() # E +out_multiple3: CovariantTypeVarTuple[int, int] = CovariantTypeVarTuple[object, bool]() # E +out_multiple4: CovariantTypeVarTuple[int, int] = CovariantTypeVarTuple[object, object]() # E +out_variadic_int: CovariantTypeVarTuple[*tuple[int, ...]] = CovariantTypeVarTuple[*tuple[object, ...]]() # E +out_variadic_object: CovariantTypeVarTuple[*tuple[object, ...]] = CovariantTypeVarTuple[*tuple[int, ...]]() # OK +out_empty: CovariantTypeVarTuple[()] = CovariantTypeVarTuple[()]() # OK + +Ts = TypeVarTuple("Ts") # OK +InvTs1 = TypeVarTuple("InvTs1", covariant=True, contravariant=True) # E +InvTs2 = TypeVarTuple("InvTs2", covariant=True, infer_variance=True) # E +InvTs3 = TypeVarTuple("InvTs3", covariant=True, infer_variance=True) # E + +class InvariantTypeVarTupleOld(Generic[*Ts]): + def in_f(self, *args: *Ts) -> None: # OK + raise NotImplementedError + + def out_f(self) -> tuple[*Ts]: # OK + raise NotImplementedError + + +obj_old: InvariantTypeVarTupleOld[object] = InvariantTypeVarTupleOld[int]() # E +int_old: InvariantTypeVarTupleOld[int] = InvariantTypeVarTupleOld[object]() # E +int_old = InvariantTypeVarTupleOld[int]() + + +InTs = TypeVarTuple("InTs", contravariant=True) + +class ContravariantTypeVarTupleOld(Generic[*InTs]): + def in_f(self, *args: *InTs) -> None: # OK + raise NotImplementedError + + def out_f(self) -> tuple[*InTs]: # E + raise NotImplementedError + + +in_obj_old: ContravariantTypeVarTupleOld[object] = ContravariantTypeVarTupleOld[int]() # E +in_int_old: ContravariantTypeVarTupleOld[int] = ContravariantTypeVarTupleOld[object]() # OK + + +OutTs = TypeVarTuple("OutTs", covariant=True) + +class CovariantTypeVarTupleOld(Generic[*OutTs]): + def in_f(self, *args: *OutTs) -> None: # E + raise NotImplementedError + + def out_f(self) -> tuple[*OutTs]: # OK + raise NotImplementedError + + +out_int_old: CovariantTypeVarTupleOld[int] = CovariantTypeVarTupleOld[object]() # E +out_obj_old: CovariantTypeVarTupleOld[object] = CovariantTypeVarTupleOld[int]() # OK diff --git a/conformance/tests/protocols_variance.py b/conformance/tests/protocols_variance.py index 069ab8ecd..724692b60 100644 --- a/conformance/tests/protocols_variance.py +++ b/conformance/tests/protocols_variance.py @@ -4,14 +4,15 @@ # Specification: https://typing.readthedocs.io/en/latest/spec/protocol.html#generic-protocols -from typing import ParamSpec, Protocol, TypeVar +from typing import Protocol, TypeVar +from typing_extensions import ParamSpec T1 = TypeVar("T1") T2 = TypeVar("T2", bound=int) T3 = TypeVar("T3", bytes, str) T1_co = TypeVar("T1_co", covariant=True) T1_contra = TypeVar("T1_contra", contravariant=True) -P = ParamSpec("P") +P = ParamSpec("P", contravariant=True) R = TypeVar("R", covariant=True) # > Type checkers will warn if the inferred variance is different from the diff --git a/conformance/uv.lock b/conformance/uv.lock index b6f401d1b..c28f526d2 100644 --- a/conformance/uv.lock +++ b/conformance/uv.lock @@ -280,11 +280,11 @@ requires-dist = [ [[package]] name = "typing-extensions" -version = "4.15.0" +version = "4.16.0" source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/72/94/1a15dd82efb362ac84269196e94cf00f187f7ed21c242792a923cdb1c61f/typing_extensions-4.15.0.tar.gz", hash = "sha256:0cea48d173cc12fa28ecabc3b837ea3cf6f38c6d1136f85cbaaf598984861466", size = 109391, upload-time = "2025-08-25T13:49:26.313Z" } +sdist = { url = "https://files.pythonhosted.org/packages/f6/cc/6253133b5bb138fc3306cebfbda2c520f545d36b5be2c7255cc528bb45d6/typing_extensions-4.16.0.tar.gz", hash = "sha256:dc983d19a509c94dba722ee6abd33940f7c05a89e243c47e907eb4db6f1a43e5", size = 113555, upload-time = "2026-07-02T08:40:05.92Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/18/67/36e9267722cc04a6b9f15c7f3441c2363321a3ea07da7ae0c0707beb2a9c/typing_extensions-4.15.0-py3-none-any.whl", hash = "sha256:f0fa19c6845758ab08074a0cfa8b7aecb71c999ca73d62883bc25cc018c4e548", size = 44614, upload-time = "2025-08-25T13:49:24.86Z" }, + { url = "https://files.pythonhosted.org/packages/49/d3/b8441a820a491ddfc024b0b0cf0393375b75ea13866d9c66727e54c2fc80/typing_extensions-4.16.0-py3-none-any.whl", hash = "sha256:481caa481374e813c1b176ada14e97f1f67a4539ce9cfeb3f350d78d6370c2e8", size = 45571, upload-time = "2026-07-02T08:40:04.659Z" }, ] [[package]] diff --git a/docs/spec/generics.rst b/docs/spec/generics.rst index 7f6cbb925..e9447bd6f 100644 --- a/docs/spec/generics.rst +++ b/docs/spec/generics.rst @@ -678,8 +678,9 @@ Prior to 3.12, the ``ParamSpec`` constructor can be used. P = ParamSpec("WrongName") # Rejected because P =/= WrongName The runtime should accept ``bound``\ s and ``covariant`` and ``contravariant`` -arguments in the declaration just as ``typing.TypeVar`` does, but for now we -will defer the standardization of the semantics of those options to a later PEP. +arguments in the declaration just as ``typing.TypeVar`` does. + +We defer the standardization of the semantics of the ``bound`` option to a later PEP. .. _`paramspec_valid_use_locations`: @@ -1189,12 +1190,11 @@ for two reasons: * To improve readability: the star also functions as an explicit visual indicator that the type variable tuple is not a normal type variable. -Variance, Type Constraints and Type Bounds: Not Supported +Type Constraints and Type Bounds: Not Supported """"""""""""""""""""""""""""""""""""""""""""""""""""""""" ``TypeVarTuple`` does not currently support specification of: -* Variance (e.g. ``TypeVar('T', covariant=True)``) * Type constraints (``TypeVar('T', int, float)``) * Type bounds (``TypeVar('T', bound=ParentClass)``) @@ -2712,25 +2712,28 @@ The algorithm for computing the variance of a type parameter is as follows. For each type parameter in a generic class: -1. If the type parameter is variadic (``TypeVarTuple``) or a parameter -specification (``ParamSpec``), it is always considered invariant. No further -inference is needed. - -2. If the type parameter comes from a traditional ``TypeVar`` declaration and -is not specified as ``infer_variance`` (see below), its variance is specified -by the ``TypeVar`` constructor call. No further inference is needed. +1. If the type parameter comes from a traditional +``TypeVar``/``TypeVarTuple``/``ParamSpec`` declaration and is not constructed +with ``infer_variance=True`` (see below), its variance is specified by the +constructor call. No further inference is needed. -3. Create two specialized versions of the class. We'll refer to these as +2. Create two specialized versions of the class. We'll refer to these as ``upper`` and ``lower`` specializations. In both of these specializations, replace all type parameters other than the one being inferred by a dummy type instance (a concrete anonymous class that is assumed to meet the bounds or constraints of the type parameter). In the ``upper`` specialized class, -specialize the target type parameter with an ``object`` instance. This -specialization ignores the type parameter's upper bound or constraints. In the -``lower`` specialized class, specialize the target type parameter with itself -(i.e. the corresponding type argument is the type parameter itself). +specialize the target type parameter with: + +- an ``object`` instance for a type variable +- a ``*tuple[object, ...]`` value for a type variable tuple +- a "top signature" value for a parameter specification, i.e. a type that + represents the super type of every possible signature. + +This specialization ignores the type parameter's upper bound or constraints. +In the ``lower`` specialized class, specialize the target type parameter with +itself (i.e. the corresponding type argument is the type parameter itself). -4. Determine whether ``lower`` can be assigned to ``upper`` using normal +3. Determine whether ``lower`` can be assigned to ``upper`` using normal assignability rules. If so, the target type parameter is covariant. If not, determine whether ``upper`` can be assigned to ``lower``. If so, the target type parameter is contravariant. If neither of these combinations are @@ -2779,8 +2782,9 @@ Since ``lower`` is assignable to ``upper``, ``T3`` is covariant. Auto Variance For TypeVar ^^^^^^^^^^^^^^^^^^^^^^^^^ -The existing ``TypeVar`` class constructor accepts keyword parameters named -``covariant`` and ``contravariant``. If both of these are ``False``, the +The existing ``TypeVar``, ``TypeVarTuple`` and ``ParamSpec`` class constructors +accepts keyword parameters named ``covariant`` and ``contravariant``. +If both of these are ``False``, the type variable is assumed to be invariant. PEP 695 adds another keyword parameter named ``infer_variance`` indicating that a type checker should use inference to determine whether the type variable is invariant, covariant or From 5b4e8530094542188cb6250f51b4f37b2d88f33f Mon Sep 17 00:00:00 2001 From: kotlinisland <65446343+kotlinisland@users.noreply.github.com> Date: Thu, 13 Aug 2026 07:36:02 +1000 Subject: [PATCH 2/7] fixup! specify that type variable tuples and parameter specification should have variance --- conformance/pyproject.toml | 1 + .../mypy/generics_paramspec_variance.toml | 80 ++++++-------- .../mypy/generics_typevartuple_variance.toml | 68 +++++++----- .../generics_paramspec_variance.toml | 64 +++++------ .../generics_typevartuple_basic.toml | 2 +- .../generics_typevartuple_variance.toml | 74 ++++++++----- .../pyrefly/generics_paramspec_variance.toml | 73 ++++++------ .../generics_typevartuple_variance.toml | 90 ++++++++------- .../pyright/generics_paramspec_variance.toml | 93 +++++++++------- .../generics_typevartuple_variance.toml | 102 ++++++++++------- .../results/pyright/protocols_variance.toml | 2 +- conformance/results/results.html | 104 ++++++++++++++---- .../ty/generics_paramspec_variance.toml | 45 +++----- .../ty/generics_typevartuple_variance.toml | 40 ++++--- .../zuban/generics_paramspec_variance.toml | 69 ++++++------ .../zuban/generics_typevartuple_variance.toml | 90 ++++++++------- .../results/zuban/protocols_variance.toml | 2 +- .../tests/generics_paramspec_variance.py | 80 +++++++++----- .../tests/generics_typevartuple_variance.py | 28 ++++- conformance/uv.lock | 2 + docs/spec/generics.rst | 28 +++-- 21 files changed, 675 insertions(+), 462 deletions(-) diff --git a/conformance/pyproject.toml b/conformance/pyproject.toml index cc393c951..c2b42fa73 100644 --- a/conformance/pyproject.toml +++ b/conformance/pyproject.toml @@ -12,6 +12,7 @@ dependencies = [ "tomlkit", "ty", "types-markdown", + "typing-extensions>=4.16.0", "zuban", ] diff --git a/conformance/results/mypy/generics_paramspec_variance.toml b/conformance/results/mypy/generics_paramspec_variance.toml index d6c507362..3aa86da8f 100644 --- a/conformance/results/mypy/generics_paramspec_variance.toml +++ b/conformance/results/mypy/generics_paramspec_variance.toml @@ -3,58 +3,42 @@ conformance_automated = "Fail" errors_diff = """ Line 15: Expected 1 errors Line 30: Expected 1 errors -Line 64: Expected 1 errors -Line 110: Expected 1 errors -Line 121: Expected 1 errors -Line 127: Expected 1 errors +Line 90: Expected 1 errors +Line 111: Expected 1 errors +Line 117: Expected 1 errors +Line 126: Expected 1 errors +Line 132: Expected 1 errors +Line 151: Expected 1 errors 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]'] -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]'] -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]'] -Line 76: Unexpected errors ['generics_paramspec_variance.py:76: error: Argument 1 to "Box" has incompatible type "OutitP[[int]]"; expected "InitP[[int]]" [arg-type]'] -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]'] -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]'] -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]'] -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]'] -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]'] -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]'] -Line 91: Unexpected errors ['generics_paramspec_variance.py:91: error: String argument 1 "InP" to ParamSpec(...) does not match variable name "P" [misc]'] -Line 92: Unexpected errors ['generics_paramspec_variance.py:92: error: The variance and bound arguments to ParamSpec do not have defined semantics yet [misc]'] -Line 97: Unexpected errors ['generics_paramspec_variance.py:97: error: Free type variable expected in Generic[...] [misc]'] -Line 101: Unexpected errors ['generics_paramspec_variance.py:101: error: "InvariantParamSpecOld" expects no type arguments, but 1 given [type-arg]'] -Line 102: Unexpected errors ['generics_paramspec_variance.py:102: error: The type "type[InvariantParamSpecOld]" is not generic and not indexable [misc]'] -Line 117: Unexpected errors ['generics_paramspec_variance.py:117: error: The variance and bound arguments to ParamSpec do not have defined semantics yet [misc]'] -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]'] +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]'] +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]'] +Line 97: Unexpected errors ['generics_paramspec_variance.py:97: error: The variance and bound arguments to ParamSpec do not have defined semantics yet [misc]'] +Line 98: Unexpected errors ['generics_paramspec_variance.py:98: error: The variance and bound arguments to ParamSpec do not have defined semantics yet [misc]'] +Line 99: Unexpected errors ['generics_paramspec_variance.py:99: error: The variance and bound arguments to ParamSpec do not have defined semantics yet [misc]'] +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]'] +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]'] """ output = """ generics_paramspec_variance.py:14: error: Incompatible types in assignment (expression has type "InvariantParamSpec[[int]]", variable has type "InvariantParamSpec[[object]]") [assignment] generics_paramspec_variance.py:21: error: Incompatible types in assignment (expression has type "ContravariantParamSpec[[int]]", variable has type "ContravariantParamSpec[[object]]") [assignment] generics_paramspec_variance.py:31: error: Incompatible types in assignment (expression has type "CovariantParamSpec[[int]]", variable has type "CovariantParamSpec[[object]]") [assignment] -generics_paramspec_variance.py:58: error: Incompatible types in assignment (expression has type "InitP[[NamedArg(int, 'a')]]", variable has type "InitP[[int]]") [assignment] -generics_paramspec_variance.py:60: error: Incompatible types in assignment (expression has type "InitP[[int]]", variable has type "InitP[[Arg(int, 'a')]]") [assignment] -generics_paramspec_variance.py:62: error: Invalid type comment or annotation [valid-type] -generics_paramspec_variance.py:66: error: Incompatible types in assignment (expression has type "InitP[[int, str]]", variable has type "InitP[[int]]") [assignment] -generics_paramspec_variance.py:76: error: Argument 1 to "Box" has incompatible type "OutitP[[int]]"; expected "InitP[[int]]" [arg-type] -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] -generics_paramspec_variance.py:79: error: Incompatible types in assignment (expression has type "InitP[[NamedArg(int, 'a')]]", variable has type "InitP[[int]]") [assignment] -generics_paramspec_variance.py:80: error: Incompatible types in assignment (expression has type "OutitP[[int]]", variable has type "InitP[[int]]") [assignment] -generics_paramspec_variance.py:81: error: Incompatible types in assignment (expression has type "InitP[[int]]", variable has type "InitP[[Arg(int, 'a')]]") [assignment] -generics_paramspec_variance.py:82: error: Incompatible types in assignment (expression has type "OutitP[[int]]", variable has type "InitP[[int]]") [assignment] -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] -generics_paramspec_variance.py:84: error: Incompatible types in assignment (expression has type "OutitP[[int]]", variable has type "InitP[[int]]") [assignment] -generics_paramspec_variance.py:86: error: Incompatible types in assignment (expression has type "OutitP[[int, str]]", variable has type "InitP[[int, str]]") [assignment] -generics_paramspec_variance.py:87: error: Incompatible types in assignment (expression has type "InitP[[int, str]]", variable has type "InitP[[int]]") [assignment] -generics_paramspec_variance.py:91: error: String argument 1 "InP" to ParamSpec(...) does not match variable name "P" [misc] -generics_paramspec_variance.py:92: error: The variance and bound arguments to ParamSpec do not have defined semantics yet [misc] -generics_paramspec_variance.py:93: error: The variance and bound arguments to ParamSpec do not have defined semantics yet [misc] -generics_paramspec_variance.py:94: error: String argument 1 "InvP1" to ParamSpec(...) does not match variable name "InvP2" [misc] -generics_paramspec_variance.py:95: error: String argument 1 "InvP1" to ParamSpec(...) does not match variable name "InvP3" [misc] -generics_paramspec_variance.py:97: error: Free type variable expected in Generic[...] [misc] -generics_paramspec_variance.py:101: error: "InvariantParamSpecOld" expects no type arguments, but 1 given [type-arg] -generics_paramspec_variance.py:102: error: The type "type[InvariantParamSpecOld]" is not generic and not indexable [misc] -generics_paramspec_variance.py:103: error: The type "type[InvariantParamSpecOld]" is not generic and not indexable [misc] -generics_paramspec_variance.py:104: error: The type "type[InvariantParamSpecOld]" is not generic and not indexable [misc] -generics_paramspec_variance.py:114: error: Incompatible types in assignment (expression has type "ContravariantParamSpecOld[[int]]", variable has type "ContravariantParamSpecOld[[object]]") [assignment] -generics_paramspec_variance.py:117: error: The variance and bound arguments to ParamSpec do not have defined semantics yet [misc] -generics_paramspec_variance.py:128: error: Incompatible types in assignment (expression has type "CovariantParamSpecOld[[int]]", variable has type "CovariantParamSpecOld[[object]]") [assignment] +generics_paramspec_variance.py:61: error: Incompatible types in assignment (expression has type "InitP[[NamedArg(int, 'a')]]", variable has type "InitP[[int]]") [assignment] +generics_paramspec_variance.py:63: error: Incompatible types in assignment (expression has type "InitP[[int]]", variable has type "InitP[[Arg(int, 'a')]]") [assignment] +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] +generics_paramspec_variance.py:69: error: Incompatible types in assignment (expression has type "InitP[[int, str]]", variable has type "InitP[[int]]") [assignment] +generics_paramspec_variance.py:84: error: Incompatible types in assignment (expression has type "OutitP[[NamedArg(int, 'a')]]", variable has type "OutitP[[int]]") [assignment] +generics_paramspec_variance.py:86: error: Incompatible types in assignment (expression has type "OutitP[[int]]", variable has type "OutitP[[Arg(int, 'a')]]") [assignment] +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] +generics_paramspec_variance.py:92: error: Incompatible types in assignment (expression has type "OutitP[[int, str]]", variable has type "OutitP[[int]]") [assignment] +generics_paramspec_variance.py:97: error: The variance and bound arguments to ParamSpec do not have defined semantics yet [misc] +generics_paramspec_variance.py:98: error: The variance and bound arguments to ParamSpec do not have defined semantics yet [misc] +generics_paramspec_variance.py:99: error: The variance and bound arguments to ParamSpec do not have defined semantics yet [misc] +generics_paramspec_variance.py:100: error: The variance and bound arguments to ParamSpec do not have defined semantics yet [misc] +generics_paramspec_variance.py:101: error: The variance and bound arguments to ParamSpec do not have defined semantics yet [misc] +generics_paramspec_variance.py:102: error: The variance and bound arguments to ParamSpec do not have defined semantics yet [misc] +generics_paramspec_variance.py:110: error: Incompatible types in assignment (expression has type "InvariantParamSpecOld[[bool]]", variable has type "InvariantParamSpecOld[[int]]") [assignment] +generics_paramspec_variance.py:121: error: Incompatible types in assignment (expression has type "ContravariantParamSpecOld[[int]]", variable has type "ContravariantParamSpecOld[[object]]") [assignment] +generics_paramspec_variance.py:133: error: Incompatible types in assignment (expression has type "CovariantParamSpecOld[[int]]", variable has type "CovariantParamSpecOld[[object]]") [assignment] +generics_paramspec_variance.py:142: error: Incompatible types in assignment (expression has type "InferredContravariantParamSpecOld[[int]]", variable has type "InferredContravariantParamSpecOld[[object]]") [assignment] +generics_paramspec_variance.py:152: error: Incompatible types in assignment (expression has type "InferredCovariantParamSpecOld[[int]]", variable has type "InferredCovariantParamSpecOld[[object]]") [assignment] """ diff --git a/conformance/results/mypy/generics_typevartuple_variance.toml b/conformance/results/mypy/generics_typevartuple_variance.toml index ca2856d00..35d157ef1 100644 --- a/conformance/results/mypy/generics_typevartuple_variance.toml +++ b/conformance/results/mypy/generics_typevartuple_variance.toml @@ -3,37 +3,49 @@ conformance_automated = "Fail" errors_diff = """ Line 14: Expected 1 errors Line 18: Expected 1 errors -Line 26: Expected 1 errors -Line 29: Expected 1 errors -Line 61: Expected 1 errors -Line 72: Expected 1 errors -Line 76: Expected 1 errors +Line 21: Expected 1 errors +Line 28: Expected 1 errors +Line 31: Expected 1 errors +Line 34: Expected 1 errors +Line 68: Expected 1 errors +Line 79: Expected 1 errors Line 83: Expected 1 errors -Line 27: Unexpected errors ['generics_typevartuple_variance.py:27: error: Incompatible types in assignment (expression has type "ContravariantTypeVarTuple[object]", variable has type "ContravariantTypeVarTuple[int]") [assignment]'] -Line 28: Unexpected errors ['generics_typevartuple_variance.py:28: error: Incompatible types in assignment (expression has type "ContravariantTypeVarTuple[*tuple[object, ...]]", variable has type "ContravariantTypeVarTuple[*tuple[int, ...]]") [assignment]'] -Line 66: Unexpected errors ['generics_typevartuple_variance.py:66: error: Unexpected keyword argument "contravariant" for "TypeVarTuple" [misc]'] -Line 77: Unexpected errors ['generics_typevartuple_variance.py:77: error: Incompatible types in assignment (expression has type "ContravariantTypeVarTupleOld[object]", variable has type "ContravariantTypeVarTupleOld[int]") [assignment]'] -Line 80: Unexpected errors ['generics_typevartuple_variance.py:80: error: Unexpected keyword argument "covariant" for "TypeVarTuple" [misc]'] +Line 90: Expected 1 errors +Line 107: Expected 1 errors +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]'] +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]'] +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]'] +Line 55: Unexpected errors ['generics_typevartuple_variance.py:55: error: Unexpected keyword argument "infer_variance" for "TypeVarTuple" [misc]'] +Line 73: Unexpected errors ['generics_typevartuple_variance.py:73: error: Unexpected keyword argument "contravariant" for "TypeVarTuple" [misc]'] +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]'] +Line 87: Unexpected errors ['generics_typevartuple_variance.py:87: error: Unexpected keyword argument "covariant" for "TypeVarTuple" [misc]'] +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]'] """ output = """ generics_typevartuple_variance.py:15: error: Incompatible types in assignment (expression has type "InvariantTypeVarTuple[object]", variable has type "InvariantTypeVarTuple[int]") [assignment] generics_typevartuple_variance.py:17: error: Incompatible types in assignment (expression has type "InvariantTypeVarTuple[*tuple[object, ...]]", variable has type "InvariantTypeVarTuple[*tuple[int, ...]]") [assignment] -generics_typevartuple_variance.py:27: error: Incompatible types in assignment (expression has type "ContravariantTypeVarTuple[object]", variable has type "ContravariantTypeVarTuple[int]") [assignment] -generics_typevartuple_variance.py:28: error: Incompatible types in assignment (expression has type "ContravariantTypeVarTuple[*tuple[object, ...]]", variable has type "ContravariantTypeVarTuple[*tuple[int, ...]]") [assignment] -generics_typevartuple_variance.py:38: error: Incompatible types in assignment (expression has type "CovariantTypeVarTuple[object]", variable has type "CovariantTypeVarTuple[int]") [assignment] -generics_typevartuple_variance.py:41: error: Incompatible types in assignment (expression has type "CovariantTypeVarTuple[bool, object]", variable has type "CovariantTypeVarTuple[int, int]") [assignment] -generics_typevartuple_variance.py:42: error: Incompatible types in assignment (expression has type "CovariantTypeVarTuple[object, bool]", variable has type "CovariantTypeVarTuple[int, int]") [assignment] -generics_typevartuple_variance.py:43: error: Incompatible types in assignment (expression has type "CovariantTypeVarTuple[object, object]", variable has type "CovariantTypeVarTuple[int, int]") [assignment] -generics_typevartuple_variance.py:44: error: Incompatible types in assignment (expression has type "CovariantTypeVarTuple[*tuple[object, ...]]", variable has type "CovariantTypeVarTuple[*tuple[int, ...]]") [assignment] -generics_typevartuple_variance.py:49: error: Unexpected keyword argument "covariant" for "TypeVarTuple" [misc] -generics_typevartuple_variance.py:49: error: Unexpected keyword argument "contravariant" for "TypeVarTuple" [misc] -generics_typevartuple_variance.py:50: error: Unexpected keyword argument "covariant" for "TypeVarTuple" [misc] -generics_typevartuple_variance.py:50: error: Unexpected keyword argument "infer_variance" for "TypeVarTuple" [misc] -generics_typevartuple_variance.py:51: error: Unexpected keyword argument "covariant" for "TypeVarTuple" [misc] -generics_typevartuple_variance.py:51: error: Unexpected keyword argument "infer_variance" for "TypeVarTuple" [misc] -generics_typevartuple_variance.py:62: error: Incompatible types in assignment (expression has type "InvariantTypeVarTupleOld[object]", variable has type "InvariantTypeVarTupleOld[int]") [assignment] -generics_typevartuple_variance.py:66: error: Unexpected keyword argument "contravariant" for "TypeVarTuple" [misc] -generics_typevartuple_variance.py:77: error: Incompatible types in assignment (expression has type "ContravariantTypeVarTupleOld[object]", variable has type "ContravariantTypeVarTupleOld[int]") [assignment] -generics_typevartuple_variance.py:80: error: Unexpected keyword argument "covariant" for "TypeVarTuple" [misc] -generics_typevartuple_variance.py:90: error: Incompatible types in assignment (expression has type "CovariantTypeVarTupleOld[object]", variable has type "CovariantTypeVarTupleOld[int]") [assignment] +generics_typevartuple_variance.py:20: error: Incompatible types in assignment (expression has type "InvariantTypeVarTuple[*tuple[int, ...]]", variable has type "InvariantTypeVarTuple[int]") [assignment] +generics_typevartuple_variance.py:29: error: Incompatible types in assignment (expression has type "ContravariantTypeVarTuple[object]", variable has type "ContravariantTypeVarTuple[int]") [assignment] +generics_typevartuple_variance.py:30: error: Incompatible types in assignment (expression has type "ContravariantTypeVarTuple[*tuple[object, ...]]", variable has type "ContravariantTypeVarTuple[*tuple[int, ...]]") [assignment] +generics_typevartuple_variance.py:33: error: Incompatible types in assignment (expression has type "ContravariantTypeVarTuple[*tuple[int, ...]]", variable has type "ContravariantTypeVarTuple[int]") [assignment] +generics_typevartuple_variance.py:42: error: Incompatible types in assignment (expression has type "CovariantTypeVarTuple[object]", variable has type "CovariantTypeVarTuple[int]") [assignment] +generics_typevartuple_variance.py:45: error: Incompatible types in assignment (expression has type "CovariantTypeVarTuple[bool, object]", variable has type "CovariantTypeVarTuple[int, int]") [assignment] +generics_typevartuple_variance.py:46: error: Incompatible types in assignment (expression has type "CovariantTypeVarTuple[object, bool]", variable has type "CovariantTypeVarTuple[int, int]") [assignment] +generics_typevartuple_variance.py:47: error: Incompatible types in assignment (expression has type "CovariantTypeVarTuple[object, object]", variable has type "CovariantTypeVarTuple[int, int]") [assignment] +generics_typevartuple_variance.py:48: error: Incompatible types in assignment (expression has type "CovariantTypeVarTuple[*tuple[object, ...]]", variable has type "CovariantTypeVarTuple[*tuple[int, ...]]") [assignment] +generics_typevartuple_variance.py:51: error: Incompatible types in assignment (expression has type "CovariantTypeVarTuple[*tuple[int, ...]]", variable has type "CovariantTypeVarTuple[int]") [assignment] +generics_typevartuple_variance.py:55: error: Unexpected keyword argument "infer_variance" for "TypeVarTuple" [misc] +generics_typevartuple_variance.py:56: error: Unexpected keyword argument "covariant" for "TypeVarTuple" [misc] +generics_typevartuple_variance.py:56: error: Unexpected keyword argument "contravariant" for "TypeVarTuple" [misc] +generics_typevartuple_variance.py:57: error: Unexpected keyword argument "covariant" for "TypeVarTuple" [misc] +generics_typevartuple_variance.py:57: error: Unexpected keyword argument "infer_variance" for "TypeVarTuple" [misc] +generics_typevartuple_variance.py:58: error: Unexpected keyword argument "contravariant" for "TypeVarTuple" [misc] +generics_typevartuple_variance.py:58: error: Unexpected keyword argument "infer_variance" for "TypeVarTuple" [misc] +generics_typevartuple_variance.py:69: error: Incompatible types in assignment (expression has type "InvariantTypeVarTupleOld[object]", variable has type "InvariantTypeVarTupleOld[int]") [assignment] +generics_typevartuple_variance.py:73: error: Unexpected keyword argument "contravariant" for "TypeVarTuple" [misc] +generics_typevartuple_variance.py:84: error: Incompatible types in assignment (expression has type "ContravariantTypeVarTupleOld[object]", variable has type "ContravariantTypeVarTupleOld[int]") [assignment] +generics_typevartuple_variance.py:87: error: Unexpected keyword argument "covariant" for "TypeVarTuple" [misc] +generics_typevartuple_variance.py:97: error: Incompatible types in assignment (expression has type "CovariantTypeVarTupleOld[object]", variable has type "CovariantTypeVarTupleOld[int]") [assignment] +generics_typevartuple_variance.py:108: error: Incompatible types in assignment (expression has type "InferredContravariantTypeVarTupleOld[object]", variable has type "InferredContravariantTypeVarTupleOld[int]") [assignment] +generics_typevartuple_variance.py:116: error: Incompatible types in assignment (expression has type "InferredCovariantTypeVarTupleOld[object]", variable has type "InferredCovariantTypeVarTupleOld[int]") [assignment] """ diff --git a/conformance/results/pycroscope/generics_paramspec_variance.toml b/conformance/results/pycroscope/generics_paramspec_variance.toml index 3e4872f89..9a83d5184 100644 --- a/conformance/results/pycroscope/generics_paramspec_variance.toml +++ b/conformance/results/pycroscope/generics_paramspec_variance.toml @@ -1,19 +1,19 @@ conformant = "Unsupported" conformance_automated = "Fail" errors_diff = """ -Line 64: Expected 1 errors -Line 110: Expected 1 errors -Line 121: Expected 1 errors +Line 90: Expected 1 errors +Line 117: Expected 1 errors +Line 126: Expected 1 errors 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):'] Line 22: Unexpected errors ['./generics_paramspec_variance.py:22:38: Traceback (most recent call last):'] Line 31: Unexpected errors ['./generics_paramspec_variance.py:31:38: Traceback (most recent call last):'] -Line 58: Unexpected errors ["./generics_paramspec_variance.py:58:0: Incompatible types in assignment to attribute 't': expected ./generics_paramspec_variance.py.InitP~[(a: int) -> Any[unannotated]], got ./generics_paramspec_variance.py.InitP~[(*, a: int) -> Any[unannotated]] [incompatible_assignment]"] -Line 60: Unexpected errors ["./generics_paramspec_variance.py:60:0: Incompatible types in assignment to attribute 't': expected ./generics_paramspec_variance.py.InitP~[(a: int) -> Any[unannotated]], got ./generics_paramspec_variance.py.InitP~[(a: int, /) -> Any[unannotated]] [incompatible_assignment]"] -Line 83: Unexpected errors ['./generics_paramspec_variance.py:83:3: Traceback (most recent call last):', './generics_paramspec_variance.py:83:0: _ already declared [already_declared]'] -Line 91: Unexpected errors ["./generics_paramspec_variance.py:91:14: ParamSpec named 'InP' must be assigned to a variable with the same name [must_have_same_name]"] -Line 102: Unexpected errors ['./generics_paramspec_variance.py:102:13: Traceback (most recent call last):'] -Line 115: Unexpected errors ['./generics_paramspec_variance.py:115:45: Traceback (most recent call last):'] -Line 128: Unexpected errors ['./generics_paramspec_variance.py:128:45: Traceback (most recent call last):'] +Line 84: Unexpected errors ["./generics_paramspec_variance.py:84:0: Incompatible types in assignment to attribute 't': expected ./generics_paramspec_variance.py.OutitP~[(a: int) -> Any[unannotated]], got ./generics_paramspec_variance.py.OutitP~[(*, a: int) -> Any[unannotated]] [incompatible_assignment]"] +Line 86: Unexpected errors ["./generics_paramspec_variance.py:86:0: Incompatible types in assignment to attribute 't': expected ./generics_paramspec_variance.py.OutitP~[(a: int) -> Any[unannotated]], got ./generics_paramspec_variance.py.OutitP~[(a: int, /) -> Any[unannotated]] [incompatible_assignment]"] +Line 109: Unexpected errors ['./generics_paramspec_variance.py:109:13: Traceback (most recent call last):'] +Line 122: Unexpected errors ['./generics_paramspec_variance.py:122:45: Traceback (most recent call last):'] +Line 133: Unexpected errors ['./generics_paramspec_variance.py:133:45: Traceback (most recent call last):'] +Line 143: Unexpected errors ['./generics_paramspec_variance.py:143:59: Traceback (most recent call last):'] +Line 152: Unexpected errors ['./generics_paramspec_variance.py:152:59: Traceback (most recent call last):'] """ output = """ ./generics_paramspec_variance.py:14:41: Traceback (most recent call last): @@ -24,26 +24,26 @@ output = """ ./generics_paramspec_variance.py:22:38: Traceback (most recent call last): ./generics_paramspec_variance.py:30:35: Traceback (most recent call last): ./generics_paramspec_variance.py:31:38: Traceback (most recent call last): -./generics_paramspec_variance.py:58:0: Incompatible types in assignment to attribute 't': expected ./generics_paramspec_variance.py.InitP~[(a: int) -> Any[unannotated]], got ./generics_paramspec_variance.py.InitP~[(*, a: int) -> Any[unannotated]] [incompatible_assignment] -./generics_paramspec_variance.py:60:0: Incompatible types in assignment to attribute 't': expected ./generics_paramspec_variance.py.InitP~[(a: int) -> Any[unannotated]], got ./generics_paramspec_variance.py.InitP~[(a: int, /) -> Any[unannotated]] [incompatible_assignment] -./generics_paramspec_variance.py:62:3: Traceback (most recent call last): -./generics_paramspec_variance.py:66:0: Incompatible types in assignment to attribute 't': expected ./generics_paramspec_variance.py.InitP~[(a: int) -> Any[unannotated]], got ./generics_paramspec_variance.py.InitP~[(a: int, b: str) -> Any[unannotated]] [incompatible_assignment] -./generics_paramspec_variance.py:79:0: Incompatible types in assignment to attribute 't': expected ./generics_paramspec_variance.py.OutitP~[(a: int) -> Any[unannotated]], got ./generics_paramspec_variance.py.OutitP~[(*, a: int) -> Any[unannotated]] [incompatible_assignment] -./generics_paramspec_variance.py:81:0: Incompatible types in assignment to attribute 't': expected ./generics_paramspec_variance.py.OutitP~[(a: int) -> Any[unannotated]], got ./generics_paramspec_variance.py.OutitP~[(a: int, /) -> Any[unannotated]] [incompatible_assignment] -./generics_paramspec_variance.py:83:3: Traceback (most recent call last): -./generics_paramspec_variance.py:83:0: _ already declared [already_declared] -./generics_paramspec_variance.py:87:0: Incompatible types in assignment to attribute 't': expected ./generics_paramspec_variance.py.OutitP~[(a: int) -> Any[unannotated]], got ./generics_paramspec_variance.py.OutitP~[(a: int, b: str) -> Any[unannotated]] [incompatible_assignment] -./generics_paramspec_variance.py:91:14: ParamSpec named 'InP' must be assigned to a variable with the same name [must_have_same_name] -./generics_paramspec_variance.py:93:8: Error calling (name: str, /, *, bound: object = no argument given, covariant: bool = Literal[False], contravariant: bool = Literal[False], infer_variance: bool = Literal[False], default: object = no argument given) -> typing.ParamSpec (with impl): Bivariant types are not supported. [incompatible_call] -./generics_paramspec_variance.py:94:8: Error calling (name: str, /, *, bound: object = no argument given, covariant: bool = Literal[False], contravariant: bool = Literal[False], infer_variance: bool = Literal[False], default: object = no argument given) -> typing.ParamSpec (with impl): Variance cannot be specified with infer_variance. [incompatible_call] -./generics_paramspec_variance.py:94:18: ParamSpec named 'InvP1' must be assigned to a variable with the same name [must_have_same_name] -./generics_paramspec_variance.py:95:8: Error calling (name: str, /, *, bound: object = no argument given, covariant: bool = Literal[False], contravariant: bool = Literal[False], infer_variance: bool = Literal[False], default: object = no argument given) -> typing.ParamSpec (with impl): Variance cannot be specified with infer_variance. [incompatible_call] -./generics_paramspec_variance.py:95:18: ParamSpec named 'InvP1' must be assigned to a variable with the same name [must_have_same_name] -./generics_paramspec_variance.py:102:13: Traceback (most recent call last): -./generics_paramspec_variance.py:103:13: Traceback (most recent call last): -./generics_paramspec_variance.py:104:13: Traceback (most recent call last): -./generics_paramspec_variance.py:114:48: Traceback (most recent call last): -./generics_paramspec_variance.py:115:45: Traceback (most recent call last): -./generics_paramspec_variance.py:127:42: Traceback (most recent call last): -./generics_paramspec_variance.py:128:45: Traceback (most recent call last): +./generics_paramspec_variance.py:61:0: Incompatible types in assignment to attribute 't': expected ./generics_paramspec_variance.py.InitP~[(a: int) -> Any[unannotated]], got ./generics_paramspec_variance.py.InitP~[(*, a: int) -> Any[unannotated]] [incompatible_assignment] +./generics_paramspec_variance.py:63:0: Incompatible types in assignment to attribute 't': expected ./generics_paramspec_variance.py.InitP~[(a: int) -> Any[unannotated]], got ./generics_paramspec_variance.py.InitP~[(a: int, /) -> Any[unannotated]] [incompatible_assignment] +./generics_paramspec_variance.py:65:0: Incompatible types in assignment to attribute 't': expected ./generics_paramspec_variance.py.InitP~[(a: int) -> Any[unannotated]], got ./generics_paramspec_variance.py.InitP~[(b: int) -> Any[unannotated]] [incompatible_assignment] +./generics_paramspec_variance.py:69:0: Incompatible types in assignment to attribute 't': expected ./generics_paramspec_variance.py.InitP~[(a: int) -> Any[unannotated]], got ./generics_paramspec_variance.py.InitP~[(a: int, b: str) -> Any[unannotated]] [incompatible_assignment] +./generics_paramspec_variance.py:84:0: Incompatible types in assignment to attribute 't': expected ./generics_paramspec_variance.py.OutitP~[(a: int) -> Any[unannotated]], got ./generics_paramspec_variance.py.OutitP~[(*, a: int) -> Any[unannotated]] [incompatible_assignment] +./generics_paramspec_variance.py:86:0: Incompatible types in assignment to attribute 't': expected ./generics_paramspec_variance.py.OutitP~[(a: int) -> Any[unannotated]], got ./generics_paramspec_variance.py.OutitP~[(a: int, /) -> Any[unannotated]] [incompatible_assignment] +./generics_paramspec_variance.py:88:0: Incompatible types in assignment to attribute 't': expected ./generics_paramspec_variance.py.OutitP~[(a: int) -> Any[unannotated]], got ./generics_paramspec_variance.py.OutitP~[(b: int) -> Any[unannotated]] [incompatible_assignment] +./generics_paramspec_variance.py:92:0: Incompatible types in assignment to attribute 't': expected ./generics_paramspec_variance.py.OutitP~[(a: int) -> Any[unannotated]], got ./generics_paramspec_variance.py.OutitP~[(a: int, b: str) -> Any[unannotated]] [incompatible_assignment] +./generics_paramspec_variance.py:100:8: Error calling (name: str, /, *, bound: object = no argument given, covariant: bool = Literal[False], contravariant: bool = Literal[False], infer_variance: bool = Literal[False], default: object = no argument given) -> typing.ParamSpec (with impl): Bivariant types are not supported. [incompatible_call] +./generics_paramspec_variance.py:101:8: Error calling (name: str, /, *, bound: object = no argument given, covariant: bool = Literal[False], contravariant: bool = Literal[False], infer_variance: bool = Literal[False], default: object = no argument given) -> typing.ParamSpec (with impl): Variance cannot be specified with infer_variance. [incompatible_call] +./generics_paramspec_variance.py:102:8: Error calling (name: str, /, *, bound: object = no argument given, covariant: bool = Literal[False], contravariant: bool = Literal[False], infer_variance: bool = Literal[False], default: object = no argument given) -> typing.ParamSpec (with impl): Variance cannot be specified with infer_variance. [incompatible_call] +./generics_paramspec_variance.py:109:13: Traceback (most recent call last): +./generics_paramspec_variance.py:110:13: Traceback (most recent call last): +./generics_paramspec_variance.py:111:13: Traceback (most recent call last): +./generics_paramspec_variance.py:121:48: Traceback (most recent call last): +./generics_paramspec_variance.py:122:45: Traceback (most recent call last): +./generics_paramspec_variance.py:132:42: Traceback (most recent call last): +./generics_paramspec_variance.py:133:45: Traceback (most recent call last): +./generics_paramspec_variance.py:142:62: Traceback (most recent call last): +./generics_paramspec_variance.py:143:59: Traceback (most recent call last): +./generics_paramspec_variance.py:151:56: Traceback (most recent call last): +./generics_paramspec_variance.py:152:59: Traceback (most recent call last): """ diff --git a/conformance/results/pycroscope/generics_typevartuple_basic.toml b/conformance/results/pycroscope/generics_typevartuple_basic.toml index 7438d8115..6685db31f 100644 --- a/conformance/results/pycroscope/generics_typevartuple_basic.toml +++ b/conformance/results/pycroscope/generics_typevartuple_basic.toml @@ -1,7 +1,7 @@ conformant = "Partial" conformance_automated = "Fail" notes = """ -doesn't error when there are multiple type var tuples in a definition +Doesn't error when multiple type variable tuples appear in a PEP 695 type parameter list; only detects the `Generic[...]` form. """ errors_diff = """ Line 111: Expected 1 errors diff --git a/conformance/results/pycroscope/generics_typevartuple_variance.toml b/conformance/results/pycroscope/generics_typevartuple_variance.toml index 7788ce48a..f53bb15ad 100644 --- a/conformance/results/pycroscope/generics_typevartuple_variance.toml +++ b/conformance/results/pycroscope/generics_typevartuple_variance.toml @@ -1,40 +1,54 @@ conformant = "Unsupported" conformance_automated = "Fail" errors_diff = """ -Line 49: Expected 1 errors -Line 50: Expected 1 errors -Line 51: Expected 1 errors -Line 72: Expected 1 errors -Line 83: Expected 1 errors -Line 27: Unexpected errors ['./generics_typevartuple_variance.py:27:0: Incompatible assignment: expected generics_typevartuple_variance.ContravariantTypeVarTuple[int], got generics_typevartuple_variance.ContravariantTypeVarTuple[object] [incompatible_assignment]'] -Line 28: Unexpected errors ['./generics_typevartuple_variance.py:28:0: Incompatible assignment: expected generics_typevartuple_variance.ContravariantTypeVarTuple[*tuple[int, ...]], got generics_typevartuple_variance.ContravariantTypeVarTuple[tuple[object, ...]] [incompatible_assignment]'] -Line 39: Unexpected errors ['./generics_typevartuple_variance.py:39:0: Incompatible assignment: expected generics_typevartuple_variance.CovariantTypeVarTuple[object], got generics_typevartuple_variance.CovariantTypeVarTuple[int] [incompatible_assignment]'] -Line 40: Unexpected errors ['./generics_typevartuple_variance.py:40:0: Incompatible assignment: expected generics_typevartuple_variance.CovariantTypeVarTuple[int, int], got generics_typevartuple_variance.CovariantTypeVarTuple[bool, bool] [incompatible_assignment]'] -Line 45: Unexpected errors ['./generics_typevartuple_variance.py:45:0: Incompatible assignment: expected generics_typevartuple_variance.CovariantTypeVarTuple[*tuple[object, ...]], got generics_typevartuple_variance.CovariantTypeVarTuple[tuple[int, ...]] [incompatible_assignment]'] -Line 77: Unexpected errors ['./generics_typevartuple_variance.py:77:0: Incompatible assignment: expected generics_typevartuple_variance.ContravariantTypeVarTupleOld[int], got generics_typevartuple_variance.ContravariantTypeVarTupleOld[object] [incompatible_assignment]'] -Line 91: Unexpected errors ['./generics_typevartuple_variance.py:91:0: Incompatible assignment: expected generics_typevartuple_variance.CovariantTypeVarTupleOld[object], got generics_typevartuple_variance.CovariantTypeVarTupleOld[int] [incompatible_assignment]'] +Line 56: Expected 1 errors +Line 57: Expected 1 errors +Line 58: Expected 1 errors +Line 79: Expected 1 errors +Line 90: Expected 1 errors +Line 29: Unexpected errors ['./generics_typevartuple_variance.py:29:0: Incompatible assignment: expected generics_typevartuple_variance.ContravariantTypeVarTuple[int], got generics_typevartuple_variance.ContravariantTypeVarTuple[object] [incompatible_assignment]'] +Line 30: Unexpected errors ['./generics_typevartuple_variance.py:30:0: Incompatible assignment: expected generics_typevartuple_variance.ContravariantTypeVarTuple[*tuple[int, ...]], got generics_typevartuple_variance.ContravariantTypeVarTuple[tuple[object, ...]] [incompatible_assignment]'] +Line 33: Unexpected errors ['./generics_typevartuple_variance.py:33:0: Incompatible assignment: expected generics_typevartuple_variance.ContravariantTypeVarTuple[int], got generics_typevartuple_variance.ContravariantTypeVarTuple[tuple[int, ...]] [incompatible_assignment]'] +Line 43: Unexpected errors ['./generics_typevartuple_variance.py:43:0: Incompatible assignment: expected generics_typevartuple_variance.CovariantTypeVarTuple[object], got generics_typevartuple_variance.CovariantTypeVarTuple[int] [incompatible_assignment]'] +Line 44: Unexpected errors ['./generics_typevartuple_variance.py:44:0: Incompatible assignment: expected generics_typevartuple_variance.CovariantTypeVarTuple[int, int], got generics_typevartuple_variance.CovariantTypeVarTuple[bool, bool] [incompatible_assignment]'] +Line 49: Unexpected errors ['./generics_typevartuple_variance.py:49:0: Incompatible assignment: expected generics_typevartuple_variance.CovariantTypeVarTuple[*tuple[object, ...]], got generics_typevartuple_variance.CovariantTypeVarTuple[tuple[int, ...]] [incompatible_assignment]'] +Line 52: Unexpected errors ['./generics_typevartuple_variance.py:52:0: Incompatible assignment: expected generics_typevartuple_variance.CovariantTypeVarTuple[*tuple[int, ...]], got generics_typevartuple_variance.CovariantTypeVarTuple[int] [incompatible_assignment]'] +Line 84: Unexpected errors ['./generics_typevartuple_variance.py:84:0: Incompatible assignment: expected generics_typevartuple_variance.ContravariantTypeVarTupleOld[int], got generics_typevartuple_variance.ContravariantTypeVarTupleOld[object] [incompatible_assignment]'] +Line 98: Unexpected errors ['./generics_typevartuple_variance.py:98:0: Incompatible assignment: expected generics_typevartuple_variance.CovariantTypeVarTupleOld[object], got generics_typevartuple_variance.CovariantTypeVarTupleOld[int] [incompatible_assignment]'] +Line 108: Unexpected errors ['./generics_typevartuple_variance.py:108:0: Incompatible assignment: expected generics_typevartuple_variance.InferredContravariantTypeVarTupleOld[int], got generics_typevartuple_variance.InferredContravariantTypeVarTupleOld[object] [incompatible_assignment]'] +Line 117: Unexpected errors ['./generics_typevartuple_variance.py:117:0: Incompatible assignment: expected generics_typevartuple_variance.InferredCovariantTypeVarTupleOld[object], got generics_typevartuple_variance.InferredCovariantTypeVarTupleOld[int] [incompatible_assignment]'] """ output = """ ./generics_typevartuple_variance.py:14:0: Incompatible assignment: expected generics_typevartuple_variance.InvariantTypeVarTuple[object], got generics_typevartuple_variance.InvariantTypeVarTuple[int] [incompatible_assignment] ./generics_typevartuple_variance.py:15:0: Incompatible assignment: expected generics_typevartuple_variance.InvariantTypeVarTuple[int], got generics_typevartuple_variance.InvariantTypeVarTuple[object] [incompatible_assignment] ./generics_typevartuple_variance.py:17:0: Incompatible assignment: expected generics_typevartuple_variance.InvariantTypeVarTuple[*tuple[int, ...]], got generics_typevartuple_variance.InvariantTypeVarTuple[tuple[object, ...]] [incompatible_assignment] ./generics_typevartuple_variance.py:18:0: Incompatible assignment: expected generics_typevartuple_variance.InvariantTypeVarTuple[*tuple[object, ...]], got generics_typevartuple_variance.InvariantTypeVarTuple[tuple[int, ...]] [incompatible_assignment] -./generics_typevartuple_variance.py:26:0: Incompatible assignment: expected generics_typevartuple_variance.ContravariantTypeVarTuple[object, object], got generics_typevartuple_variance.ContravariantTypeVarTuple[object, int] [incompatible_assignment] -./generics_typevartuple_variance.py:27:0: Incompatible assignment: expected generics_typevartuple_variance.ContravariantTypeVarTuple[int], got generics_typevartuple_variance.ContravariantTypeVarTuple[object] [incompatible_assignment] -./generics_typevartuple_variance.py:28:0: Incompatible assignment: expected generics_typevartuple_variance.ContravariantTypeVarTuple[*tuple[int, ...]], got generics_typevartuple_variance.ContravariantTypeVarTuple[tuple[object, ...]] [incompatible_assignment] -./generics_typevartuple_variance.py:29:0: Incompatible assignment: expected generics_typevartuple_variance.ContravariantTypeVarTuple[*tuple[object, ...]], got generics_typevartuple_variance.ContravariantTypeVarTuple[tuple[int, ...]] [incompatible_assignment] -./generics_typevartuple_variance.py:38:0: Incompatible assignment: expected generics_typevartuple_variance.CovariantTypeVarTuple[int], got generics_typevartuple_variance.CovariantTypeVarTuple[object] [incompatible_assignment] -./generics_typevartuple_variance.py:39:0: Incompatible assignment: expected generics_typevartuple_variance.CovariantTypeVarTuple[object], got generics_typevartuple_variance.CovariantTypeVarTuple[int] [incompatible_assignment] -./generics_typevartuple_variance.py:40:0: Incompatible assignment: expected generics_typevartuple_variance.CovariantTypeVarTuple[int, int], got generics_typevartuple_variance.CovariantTypeVarTuple[bool, bool] [incompatible_assignment] -./generics_typevartuple_variance.py:41:0: Incompatible assignment: expected generics_typevartuple_variance.CovariantTypeVarTuple[int, int], got generics_typevartuple_variance.CovariantTypeVarTuple[bool, object] [incompatible_assignment] -./generics_typevartuple_variance.py:42:0: Incompatible assignment: expected generics_typevartuple_variance.CovariantTypeVarTuple[int, int], got generics_typevartuple_variance.CovariantTypeVarTuple[object, bool] [incompatible_assignment] -./generics_typevartuple_variance.py:43:0: Incompatible assignment: expected generics_typevartuple_variance.CovariantTypeVarTuple[int, int], got generics_typevartuple_variance.CovariantTypeVarTuple[object, object] [incompatible_assignment] -./generics_typevartuple_variance.py:44:0: Incompatible assignment: expected generics_typevartuple_variance.CovariantTypeVarTuple[*tuple[int, ...]], got generics_typevartuple_variance.CovariantTypeVarTuple[tuple[object, ...]] [incompatible_assignment] -./generics_typevartuple_variance.py:45:0: Incompatible assignment: expected generics_typevartuple_variance.CovariantTypeVarTuple[*tuple[object, ...]], got generics_typevartuple_variance.CovariantTypeVarTuple[tuple[int, ...]] [incompatible_assignment] -./generics_typevartuple_variance.py:61:0: Incompatible assignment: expected generics_typevartuple_variance.InvariantTypeVarTupleOld[object], got generics_typevartuple_variance.InvariantTypeVarTupleOld[int] [incompatible_assignment] -./generics_typevartuple_variance.py:62:0: Incompatible assignment: expected generics_typevartuple_variance.InvariantTypeVarTupleOld[int], got generics_typevartuple_variance.InvariantTypeVarTupleOld[object] [incompatible_assignment] -./generics_typevartuple_variance.py:76:0: Incompatible assignment: expected generics_typevartuple_variance.ContravariantTypeVarTupleOld[object], got generics_typevartuple_variance.ContravariantTypeVarTupleOld[int] [incompatible_assignment] -./generics_typevartuple_variance.py:77:0: Incompatible assignment: expected generics_typevartuple_variance.ContravariantTypeVarTupleOld[int], got generics_typevartuple_variance.ContravariantTypeVarTupleOld[object] [incompatible_assignment] -./generics_typevartuple_variance.py:90:0: Incompatible assignment: expected generics_typevartuple_variance.CovariantTypeVarTupleOld[int], got generics_typevartuple_variance.CovariantTypeVarTupleOld[object] [incompatible_assignment] -./generics_typevartuple_variance.py:91:0: Incompatible assignment: expected generics_typevartuple_variance.CovariantTypeVarTupleOld[object], got generics_typevartuple_variance.CovariantTypeVarTupleOld[int] [incompatible_assignment] +./generics_typevartuple_variance.py:20:0: Incompatible assignment: expected generics_typevartuple_variance.InvariantTypeVarTuple[int], got generics_typevartuple_variance.InvariantTypeVarTuple[tuple[int, ...]] [incompatible_assignment] +./generics_typevartuple_variance.py:21:0: Incompatible assignment: expected generics_typevartuple_variance.InvariantTypeVarTuple[*tuple[int, ...]], got generics_typevartuple_variance.InvariantTypeVarTuple[int] [incompatible_assignment] +./generics_typevartuple_variance.py:28:0: Incompatible assignment: expected generics_typevartuple_variance.ContravariantTypeVarTuple[object, object], got generics_typevartuple_variance.ContravariantTypeVarTuple[object, int] [incompatible_assignment] +./generics_typevartuple_variance.py:29:0: Incompatible assignment: expected generics_typevartuple_variance.ContravariantTypeVarTuple[int], got generics_typevartuple_variance.ContravariantTypeVarTuple[object] [incompatible_assignment] +./generics_typevartuple_variance.py:30:0: Incompatible assignment: expected generics_typevartuple_variance.ContravariantTypeVarTuple[*tuple[int, ...]], got generics_typevartuple_variance.ContravariantTypeVarTuple[tuple[object, ...]] [incompatible_assignment] +./generics_typevartuple_variance.py:31:0: Incompatible assignment: expected generics_typevartuple_variance.ContravariantTypeVarTuple[*tuple[object, ...]], got generics_typevartuple_variance.ContravariantTypeVarTuple[tuple[int, ...]] [incompatible_assignment] +./generics_typevartuple_variance.py:33:0: Incompatible assignment: expected generics_typevartuple_variance.ContravariantTypeVarTuple[int], got generics_typevartuple_variance.ContravariantTypeVarTuple[tuple[int, ...]] [incompatible_assignment] +./generics_typevartuple_variance.py:34:0: Incompatible assignment: expected generics_typevartuple_variance.ContravariantTypeVarTuple[*tuple[int, ...]], got generics_typevartuple_variance.ContravariantTypeVarTuple[int] [incompatible_assignment] +./generics_typevartuple_variance.py:42:0: Incompatible assignment: expected generics_typevartuple_variance.CovariantTypeVarTuple[int], got generics_typevartuple_variance.CovariantTypeVarTuple[object] [incompatible_assignment] +./generics_typevartuple_variance.py:43:0: Incompatible assignment: expected generics_typevartuple_variance.CovariantTypeVarTuple[object], got generics_typevartuple_variance.CovariantTypeVarTuple[int] [incompatible_assignment] +./generics_typevartuple_variance.py:44:0: Incompatible assignment: expected generics_typevartuple_variance.CovariantTypeVarTuple[int, int], got generics_typevartuple_variance.CovariantTypeVarTuple[bool, bool] [incompatible_assignment] +./generics_typevartuple_variance.py:45:0: Incompatible assignment: expected generics_typevartuple_variance.CovariantTypeVarTuple[int, int], got generics_typevartuple_variance.CovariantTypeVarTuple[bool, object] [incompatible_assignment] +./generics_typevartuple_variance.py:46:0: Incompatible assignment: expected generics_typevartuple_variance.CovariantTypeVarTuple[int, int], got generics_typevartuple_variance.CovariantTypeVarTuple[object, bool] [incompatible_assignment] +./generics_typevartuple_variance.py:47:0: Incompatible assignment: expected generics_typevartuple_variance.CovariantTypeVarTuple[int, int], got generics_typevartuple_variance.CovariantTypeVarTuple[object, object] [incompatible_assignment] +./generics_typevartuple_variance.py:48:0: Incompatible assignment: expected generics_typevartuple_variance.CovariantTypeVarTuple[*tuple[int, ...]], got generics_typevartuple_variance.CovariantTypeVarTuple[tuple[object, ...]] [incompatible_assignment] +./generics_typevartuple_variance.py:49:0: Incompatible assignment: expected generics_typevartuple_variance.CovariantTypeVarTuple[*tuple[object, ...]], got generics_typevartuple_variance.CovariantTypeVarTuple[tuple[int, ...]] [incompatible_assignment] +./generics_typevartuple_variance.py:51:0: Incompatible assignment: expected generics_typevartuple_variance.CovariantTypeVarTuple[int], got generics_typevartuple_variance.CovariantTypeVarTuple[tuple[int, ...]] [incompatible_assignment] +./generics_typevartuple_variance.py:52:0: Incompatible assignment: expected generics_typevartuple_variance.CovariantTypeVarTuple[*tuple[int, ...]], got generics_typevartuple_variance.CovariantTypeVarTuple[int] [incompatible_assignment] +./generics_typevartuple_variance.py:68:0: Incompatible assignment: expected generics_typevartuple_variance.InvariantTypeVarTupleOld[object], got generics_typevartuple_variance.InvariantTypeVarTupleOld[int] [incompatible_assignment] +./generics_typevartuple_variance.py:69:0: Incompatible assignment: expected generics_typevartuple_variance.InvariantTypeVarTupleOld[int], got generics_typevartuple_variance.InvariantTypeVarTupleOld[object] [incompatible_assignment] +./generics_typevartuple_variance.py:83:0: Incompatible assignment: expected generics_typevartuple_variance.ContravariantTypeVarTupleOld[object], got generics_typevartuple_variance.ContravariantTypeVarTupleOld[int] [incompatible_assignment] +./generics_typevartuple_variance.py:84:0: Incompatible assignment: expected generics_typevartuple_variance.ContravariantTypeVarTupleOld[int], got generics_typevartuple_variance.ContravariantTypeVarTupleOld[object] [incompatible_assignment] +./generics_typevartuple_variance.py:97:0: Incompatible assignment: expected generics_typevartuple_variance.CovariantTypeVarTupleOld[int], got generics_typevartuple_variance.CovariantTypeVarTupleOld[object] [incompatible_assignment] +./generics_typevartuple_variance.py:98:0: Incompatible assignment: expected generics_typevartuple_variance.CovariantTypeVarTupleOld[object], got generics_typevartuple_variance.CovariantTypeVarTupleOld[int] [incompatible_assignment] +./generics_typevartuple_variance.py:107:0: Incompatible assignment: expected generics_typevartuple_variance.InferredContravariantTypeVarTupleOld[object], got generics_typevartuple_variance.InferredContravariantTypeVarTupleOld[int] [incompatible_assignment] +./generics_typevartuple_variance.py:108:0: Incompatible assignment: expected generics_typevartuple_variance.InferredContravariantTypeVarTupleOld[int], got generics_typevartuple_variance.InferredContravariantTypeVarTupleOld[object] [incompatible_assignment] +./generics_typevartuple_variance.py:116:0: Incompatible assignment: expected generics_typevartuple_variance.InferredCovariantTypeVarTupleOld[int], got generics_typevartuple_variance.InferredCovariantTypeVarTupleOld[object] [incompatible_assignment] +./generics_typevartuple_variance.py:117:0: Incompatible assignment: expected generics_typevartuple_variance.InferredCovariantTypeVarTupleOld[object], got generics_typevartuple_variance.InferredCovariantTypeVarTupleOld[int] [incompatible_assignment] """ diff --git a/conformance/results/pyrefly/generics_paramspec_variance.toml b/conformance/results/pyrefly/generics_paramspec_variance.toml index b04a2ded0..f68f02249 100644 --- a/conformance/results/pyrefly/generics_paramspec_variance.toml +++ b/conformance/results/pyrefly/generics_paramspec_variance.toml @@ -4,43 +4,52 @@ errors_diff = """ Line 14: Expected 1 errors Line 21: Expected 1 errors Line 30: Expected 1 errors -Line 110: Expected 1 errors -Line 121: Expected 1 errors +Line 61: Expected 1 errors +Line 63: Expected 1 errors +Line 90: Expected 1 errors +Line 117: Expected 1 errors +Line 126: Expected 1 errors Line 22: Unexpected errors ['`ContravariantParamSpec[[object]]` is not assignable to `ContravariantParamSpec[[int]]` [bad-assignment]'] Line 31: Unexpected errors ['`CovariantParamSpec[[int]]` is not assignable to `CovariantParamSpec[[object]]` [bad-assignment]'] -Line 83: Unexpected errors ['Function call cannot be used in annotations [invalid-annotation]'] -Line 91: Unexpected errors ['ParamSpec must be assigned to a variable named `InP` [invalid-param-spec]'] -Line 92: Unexpected errors ['Unexpected keyword argument `contravariant` to ParamSpec [invalid-param-spec]'] -Line 115: Unexpected errors ['`ContravariantParamSpecOld[[object]]` is not assignable to `ContravariantParamSpecOld[[int]]` [bad-assignment]'] -Line 117: Unexpected errors ['Unexpected keyword argument `covariant` to ParamSpec [invalid-param-spec]'] -Line 128: Unexpected errors ['`CovariantParamSpecOld[[int]]` is not assignable to `CovariantParamSpecOld[[object]]` [bad-assignment]'] +Line 67: Unexpected errors ['`InitP[[a: int = 1]]` is not assignable to attribute `t` with type `InitP[[a: int]]` [bad-assignment]'] +Line 84: Unexpected errors ['`OutitP[[*, a: int]]` is not assignable to attribute `t` with type `OutitP[[a: int]]` [bad-assignment]'] +Line 86: Unexpected errors ['`OutitP[[a: int, /]]` is not assignable to attribute `t` with type `OutitP[[a: int]]` [bad-assignment]'] +Line 97: Unexpected errors ['Unexpected keyword argument `contravariant` to ParamSpec [invalid-param-spec]'] +Line 98: Unexpected errors ['Unexpected keyword argument `covariant` to ParamSpec [invalid-param-spec]'] +Line 99: Unexpected errors ['Unexpected keyword argument `infer_variance` to ParamSpec [invalid-param-spec]'] +Line 122: Unexpected errors ['`ContravariantParamSpecOld[[object]]` is not assignable to `ContravariantParamSpecOld[[int]]` [bad-assignment]'] +Line 133: Unexpected errors ['`CovariantParamSpecOld[[int]]` is not assignable to `CovariantParamSpecOld[[object]]` [bad-assignment]'] +Line 143: Unexpected errors ['`InferredContravariantParamSpecOld[[object]]` is not assignable to `InferredContravariantParamSpecOld[[int]]` [bad-assignment]'] +Line 152: Unexpected errors ['`InferredCovariantParamSpecOld[[int]]` is not assignable to `InferredCovariantParamSpecOld[[object]]` [bad-assignment]'] """ output = """ ERROR generics_paramspec_variance.py:15:39-67: `InvariantParamSpec[[object]]` is not assignable to `InvariantParamSpec[[int]]` [bad-assignment] ERROR generics_paramspec_variance.py:22:39-71: `ContravariantParamSpec[[object]]` is not assignable to `ContravariantParamSpec[[int]]` [bad-assignment] ERROR generics_paramspec_variance.py:31:39-64: `CovariantParamSpec[[int]]` is not assignable to `CovariantParamSpec[[object]]` [bad-assignment] -ERROR generics_paramspec_variance.py:62:4-16: Function call cannot be used in annotations [invalid-annotation] -ERROR generics_paramspec_variance.py:64:9-18: `InitP[[a: int = 1]]` is not assignable to attribute `t` with type `InitP[[a: int]]` [bad-assignment] -ERROR generics_paramspec_variance.py:66:9-16: `InitP[[a: int, b: str]]` is not assignable to attribute `t` with type `InitP[[a: int]]` [bad-assignment] -ERROR generics_paramspec_variance.py:79:9-13: `OutitP[[*, a: int]]` is not assignable to attribute `t` with type `OutitP[[a: int]]` [bad-assignment] -ERROR generics_paramspec_variance.py:81:9-14: `OutitP[[a: int, /]]` is not assignable to attribute `t` with type `OutitP[[a: int]]` [bad-assignment] -ERROR generics_paramspec_variance.py:83:4-17: Function call cannot be used in annotations [invalid-annotation] -ERROR generics_paramspec_variance.py:87:9-16: `OutitP[[a: int, b: str]]` is not assignable to attribute `t` with type `OutitP[[a: int]]` [bad-assignment] -ERROR generics_paramspec_variance.py:91:5-21: ParamSpec must be assigned to a variable named `InP` [invalid-param-spec] -ERROR generics_paramspec_variance.py:92:24-42: Unexpected keyword argument `contravariant` to ParamSpec [invalid-param-spec] -ERROR generics_paramspec_variance.py:93:28-42: Unexpected keyword argument `covariant` to ParamSpec [invalid-param-spec] -ERROR generics_paramspec_variance.py:93:44-62: Unexpected keyword argument `contravariant` to ParamSpec [invalid-param-spec] -ERROR generics_paramspec_variance.py:94:9-64: ParamSpec must be assigned to a variable named `InvP1` [invalid-param-spec] -ERROR generics_paramspec_variance.py:94:28-42: Unexpected keyword argument `covariant` to ParamSpec [invalid-param-spec] -ERROR generics_paramspec_variance.py:94:44-63: Unexpected keyword argument `infer_variance` to ParamSpec [invalid-param-spec] -ERROR generics_paramspec_variance.py:95:9-68: ParamSpec must be assigned to a variable named `InvP1` [invalid-param-spec] -ERROR generics_paramspec_variance.py:95:28-46: Unexpected keyword argument `contravariant` to ParamSpec [invalid-param-spec] -ERROR generics_paramspec_variance.py:95:48-67: Unexpected keyword argument `infer_variance` to ParamSpec [invalid-param-spec] -ERROR generics_paramspec_variance.py:103:14-43: `InvariantParamSpecOld[[bool]]` is not assignable to variable `in_out_old` with type `InvariantParamSpecOld[[int]]` [bad-assignment] -ERROR generics_paramspec_variance.py:104:14-45: `InvariantParamSpecOld[[object]]` is not assignable to variable `in_out_old` with type `InvariantParamSpecOld[[int]]` [bad-assignment] -ERROR generics_paramspec_variance.py:114:49-81: `ContravariantParamSpecOld[[int]]` is not assignable to `ContravariantParamSpecOld[[object]]` [bad-assignment] -ERROR generics_paramspec_variance.py:115:46-81: `ContravariantParamSpecOld[[object]]` is not assignable to `ContravariantParamSpecOld[[int]]` [bad-assignment] -ERROR generics_paramspec_variance.py:117:26-40: Unexpected keyword argument `covariant` to ParamSpec [invalid-param-spec] -ERROR generics_paramspec_variance.py:127:43-74: `CovariantParamSpecOld[[object]]` is not assignable to `CovariantParamSpecOld[[int]]` [bad-assignment] -ERROR generics_paramspec_variance.py:128:46-74: `CovariantParamSpecOld[[int]]` is not assignable to `CovariantParamSpecOld[[object]]` [bad-assignment] +ERROR generics_paramspec_variance.py:65:12-22: `InitP[[b: int]]` is not assignable to attribute `t` with type `InitP[[a: int]]` [bad-assignment] +ERROR generics_paramspec_variance.py:67:12-24: `InitP[[a: int = 1]]` is not assignable to attribute `t` with type `InitP[[a: int]]` [bad-assignment] +ERROR generics_paramspec_variance.py:69:12-22: `InitP[[a: int, b: str]]` is not assignable to attribute `t` with type `InitP[[a: int]]` [bad-assignment] +ERROR generics_paramspec_variance.py:84:13-21: `OutitP[[*, a: int]]` is not assignable to attribute `t` with type `OutitP[[a: int]]` [bad-assignment] +ERROR generics_paramspec_variance.py:86:13-22: `OutitP[[a: int, /]]` is not assignable to attribute `t` with type `OutitP[[a: int]]` [bad-assignment] +ERROR generics_paramspec_variance.py:88:13-24: `OutitP[[b: int]]` is not assignable to attribute `t` with type `OutitP[[a: int]]` [bad-assignment] +ERROR generics_paramspec_variance.py:92:13-24: `OutitP[[a: int, b: str]]` is not assignable to attribute `t` with type `OutitP[[a: int]]` [bad-assignment] +ERROR generics_paramspec_variance.py:97:24-42: Unexpected keyword argument `contravariant` to ParamSpec [invalid-param-spec] +ERROR generics_paramspec_variance.py:98:26-40: Unexpected keyword argument `covariant` to ParamSpec [invalid-param-spec] +ERROR generics_paramspec_variance.py:99:30-49: Unexpected keyword argument `infer_variance` to ParamSpec [invalid-param-spec] +ERROR generics_paramspec_variance.py:100:28-42: Unexpected keyword argument `covariant` to ParamSpec [invalid-param-spec] +ERROR generics_paramspec_variance.py:100:44-62: Unexpected keyword argument `contravariant` to ParamSpec [invalid-param-spec] +ERROR generics_paramspec_variance.py:101:28-42: Unexpected keyword argument `covariant` to ParamSpec [invalid-param-spec] +ERROR generics_paramspec_variance.py:101:44-63: Unexpected keyword argument `infer_variance` to ParamSpec [invalid-param-spec] +ERROR generics_paramspec_variance.py:102:28-46: Unexpected keyword argument `contravariant` to ParamSpec [invalid-param-spec] +ERROR generics_paramspec_variance.py:102:48-67: Unexpected keyword argument `infer_variance` to ParamSpec [invalid-param-spec] +ERROR generics_paramspec_variance.py:110:14-43: `InvariantParamSpecOld[[bool]]` is not assignable to variable `in_out_old` with type `InvariantParamSpecOld[[int]]` [bad-assignment] +ERROR generics_paramspec_variance.py:111:14-45: `InvariantParamSpecOld[[object]]` is not assignable to variable `in_out_old` with type `InvariantParamSpecOld[[int]]` [bad-assignment] +ERROR generics_paramspec_variance.py:121:49-81: `ContravariantParamSpecOld[[int]]` is not assignable to `ContravariantParamSpecOld[[object]]` [bad-assignment] +ERROR generics_paramspec_variance.py:122:46-81: `ContravariantParamSpecOld[[object]]` is not assignable to `ContravariantParamSpecOld[[int]]` [bad-assignment] +ERROR generics_paramspec_variance.py:132:43-74: `CovariantParamSpecOld[[object]]` is not assignable to `CovariantParamSpecOld[[int]]` [bad-assignment] +ERROR generics_paramspec_variance.py:133:46-74: `CovariantParamSpecOld[[int]]` is not assignable to `CovariantParamSpecOld[[object]]` [bad-assignment] +ERROR generics_paramspec_variance.py:142:63-103: `InferredContravariantParamSpecOld[[int]]` is not assignable to `InferredContravariantParamSpecOld[[object]]` [bad-assignment] +ERROR generics_paramspec_variance.py:143:60-103: `InferredContravariantParamSpecOld[[object]]` is not assignable to `InferredContravariantParamSpecOld[[int]]` [bad-assignment] +ERROR generics_paramspec_variance.py:151:57-96: `InferredCovariantParamSpecOld[[object]]` is not assignable to `InferredCovariantParamSpecOld[[int]]` [bad-assignment] +ERROR generics_paramspec_variance.py:152:60-96: `InferredCovariantParamSpecOld[[int]]` is not assignable to `InferredCovariantParamSpecOld[[object]]` [bad-assignment] """ diff --git a/conformance/results/pyrefly/generics_typevartuple_variance.toml b/conformance/results/pyrefly/generics_typevartuple_variance.toml index fb5185e8a..ef2eff062 100644 --- a/conformance/results/pyrefly/generics_typevartuple_variance.toml +++ b/conformance/results/pyrefly/generics_typevartuple_variance.toml @@ -1,47 +1,63 @@ conformant = "Unsupported" conformance_automated = "Fail" errors_diff = """ -Line 72: Expected 1 errors -Line 83: Expected 1 errors -Line 27: Unexpected errors ['`ContravariantTypeVarTuple[object]` is not assignable to `ContravariantTypeVarTuple[int]` [bad-assignment]'] -Line 28: Unexpected errors ['`ContravariantTypeVarTuple[*tuple[object, ...]]` is not assignable to `ContravariantTypeVarTuple[*tuple[int, ...]]` [bad-assignment]'] -Line 39: Unexpected errors ['`CovariantTypeVarTuple[int]` is not assignable to `CovariantTypeVarTuple[object]` [bad-assignment]'] -Line 40: Unexpected errors ['`CovariantTypeVarTuple[bool, bool]` is not assignable to `CovariantTypeVarTuple[int, int]` [bad-assignment]'] -Line 45: Unexpected errors ['`CovariantTypeVarTuple[*tuple[int, ...]]` is not assignable to `CovariantTypeVarTuple[*tuple[object, ...]]` [bad-assignment]'] -Line 66: Unexpected errors ['Unexpected keyword argument `contravariant` to TypeVarTuple [invalid-type-var-tuple]'] -Line 77: Unexpected errors ['`ContravariantTypeVarTupleOld[object]` is not assignable to `ContravariantTypeVarTupleOld[int]` [bad-assignment]'] -Line 80: Unexpected errors ['Unexpected keyword argument `covariant` to TypeVarTuple [invalid-type-var-tuple]'] -Line 91: Unexpected errors ['`CovariantTypeVarTupleOld[int]` is not assignable to `CovariantTypeVarTupleOld[object]` [bad-assignment]'] +Line 79: Expected 1 errors +Line 90: Expected 1 errors +Line 29: Unexpected errors ['`ContravariantTypeVarTuple[object]` is not assignable to `ContravariantTypeVarTuple[int]` [bad-assignment]'] +Line 30: Unexpected errors ['`ContravariantTypeVarTuple[*tuple[object, ...]]` is not assignable to `ContravariantTypeVarTuple[*tuple[int, ...]]` [bad-assignment]'] +Line 33: Unexpected errors ['`ContravariantTypeVarTuple[*tuple[int, ...]]` is not assignable to `ContravariantTypeVarTuple[int]` [bad-assignment]'] +Line 43: Unexpected errors ['`CovariantTypeVarTuple[int]` is not assignable to `CovariantTypeVarTuple[object]` [bad-assignment]'] +Line 44: Unexpected errors ['`CovariantTypeVarTuple[bool, bool]` is not assignable to `CovariantTypeVarTuple[int, int]` [bad-assignment]'] +Line 49: Unexpected errors ['`CovariantTypeVarTuple[*tuple[int, ...]]` is not assignable to `CovariantTypeVarTuple[*tuple[object, ...]]` [bad-assignment]'] +Line 52: Unexpected errors ['`CovariantTypeVarTuple[int]` is not assignable to `CovariantTypeVarTuple[*tuple[int, ...]]` [bad-assignment]'] +Line 55: Unexpected errors ['Unexpected keyword argument `infer_variance` to TypeVarTuple [invalid-type-var-tuple]'] +Line 73: Unexpected errors ['Unexpected keyword argument `contravariant` to TypeVarTuple [invalid-type-var-tuple]'] +Line 84: Unexpected errors ['`ContravariantTypeVarTupleOld[object]` is not assignable to `ContravariantTypeVarTupleOld[int]` [bad-assignment]'] +Line 87: Unexpected errors ['Unexpected keyword argument `covariant` to TypeVarTuple [invalid-type-var-tuple]'] +Line 98: Unexpected errors ['`CovariantTypeVarTupleOld[int]` is not assignable to `CovariantTypeVarTupleOld[object]` [bad-assignment]'] +Line 108: Unexpected errors ['`InferredContravariantTypeVarTupleOld[object]` is not assignable to `InferredContravariantTypeVarTupleOld[int]` [bad-assignment]'] +Line 117: Unexpected errors ['`InferredCovariantTypeVarTupleOld[int]` is not assignable to `InferredCovariantTypeVarTupleOld[object]` [bad-assignment]'] """ output = """ ERROR generics_typevartuple_variance.py:14:45-73: `InvariantTypeVarTuple[int]` is not assignable to `InvariantTypeVarTuple[object]` [bad-assignment] ERROR generics_typevartuple_variance.py:15:42-73: `InvariantTypeVarTuple[object]` is not assignable to `InvariantTypeVarTuple[int]` [bad-assignment] ERROR generics_typevartuple_variance.py:17:64-108: `InvariantTypeVarTuple[*tuple[object, ...]]` is not assignable to `InvariantTypeVarTuple[*tuple[int, ...]]` [bad-assignment] ERROR generics_typevartuple_variance.py:18:70-111: `InvariantTypeVarTuple[*tuple[int, ...]]` is not assignable to `InvariantTypeVarTuple[*tuple[object, ...]]` [bad-assignment] -ERROR generics_typevartuple_variance.py:26:53-93: `ContravariantTypeVarTuple[object, int]` is not assignable to `ContravariantTypeVarTuple[object, object]` [bad-assignment] -ERROR generics_typevartuple_variance.py:27:42-77: `ContravariantTypeVarTuple[object]` is not assignable to `ContravariantTypeVarTuple[int]` [bad-assignment] -ERROR generics_typevartuple_variance.py:28:64-112: `ContravariantTypeVarTuple[*tuple[object, ...]]` is not assignable to `ContravariantTypeVarTuple[*tuple[int, ...]]` [bad-assignment] -ERROR generics_typevartuple_variance.py:29:70-115: `ContravariantTypeVarTuple[*tuple[int, ...]]` is not assignable to `ContravariantTypeVarTuple[*tuple[object, ...]]` [bad-assignment] -ERROR generics_typevartuple_variance.py:38:39-70: `CovariantTypeVarTuple[object]` is not assignable to `CovariantTypeVarTuple[int]` [bad-assignment] -ERROR generics_typevartuple_variance.py:39:42-70: `CovariantTypeVarTuple[int]` is not assignable to `CovariantTypeVarTuple[object]` [bad-assignment] -ERROR generics_typevartuple_variance.py:40:50-86: `CovariantTypeVarTuple[bool, bool]` is not assignable to `CovariantTypeVarTuple[int, int]` [bad-assignment] -ERROR generics_typevartuple_variance.py:41:50-88: `CovariantTypeVarTuple[bool, object]` is not assignable to `CovariantTypeVarTuple[int, int]` [bad-assignment] -ERROR generics_typevartuple_variance.py:42:50-88: `CovariantTypeVarTuple[object, bool]` is not assignable to `CovariantTypeVarTuple[int, int]` [bad-assignment] -ERROR generics_typevartuple_variance.py:43:50-90: `CovariantTypeVarTuple[object, object]` is not assignable to `CovariantTypeVarTuple[int, int]` [bad-assignment] -ERROR generics_typevartuple_variance.py:44:61-105: `CovariantTypeVarTuple[*tuple[object, ...]]` is not assignable to `CovariantTypeVarTuple[*tuple[int, ...]]` [bad-assignment] -ERROR generics_typevartuple_variance.py:45:67-108: `CovariantTypeVarTuple[*tuple[int, ...]]` is not assignable to `CovariantTypeVarTuple[*tuple[object, ...]]` [bad-assignment] -ERROR generics_typevartuple_variance.py:49:33-47: Unexpected keyword argument `covariant` to TypeVarTuple [invalid-type-var-tuple] -ERROR generics_typevartuple_variance.py:49:49-67: Unexpected keyword argument `contravariant` to TypeVarTuple [invalid-type-var-tuple] -ERROR generics_typevartuple_variance.py:50:33-47: Unexpected keyword argument `covariant` to TypeVarTuple [invalid-type-var-tuple] -ERROR generics_typevartuple_variance.py:50:49-68: Unexpected keyword argument `infer_variance` to TypeVarTuple [invalid-type-var-tuple] -ERROR generics_typevartuple_variance.py:51:33-47: Unexpected keyword argument `covariant` to TypeVarTuple [invalid-type-var-tuple] -ERROR generics_typevartuple_variance.py:51:49-68: Unexpected keyword argument `infer_variance` to TypeVarTuple [invalid-type-var-tuple] -ERROR generics_typevartuple_variance.py:61:45-76: `InvariantTypeVarTupleOld[int]` is not assignable to `InvariantTypeVarTupleOld[object]` [bad-assignment] -ERROR generics_typevartuple_variance.py:62:42-76: `InvariantTypeVarTupleOld[object]` is not assignable to `InvariantTypeVarTupleOld[int]` [bad-assignment] -ERROR generics_typevartuple_variance.py:66:29-47: Unexpected keyword argument `contravariant` to TypeVarTuple [invalid-type-var-tuple] -ERROR generics_typevartuple_variance.py:76:52-87: `ContravariantTypeVarTupleOld[int]` is not assignable to `ContravariantTypeVarTupleOld[object]` [bad-assignment] -ERROR generics_typevartuple_variance.py:77:49-87: `ContravariantTypeVarTupleOld[object]` is not assignable to `ContravariantTypeVarTupleOld[int]` [bad-assignment] -ERROR generics_typevartuple_variance.py:80:31-45: Unexpected keyword argument `covariant` to TypeVarTuple [invalid-type-var-tuple] -ERROR generics_typevartuple_variance.py:90:46-80: `CovariantTypeVarTupleOld[object]` is not assignable to `CovariantTypeVarTupleOld[int]` [bad-assignment] -ERROR generics_typevartuple_variance.py:91:49-80: `CovariantTypeVarTupleOld[int]` is not assignable to `CovariantTypeVarTupleOld[object]` [bad-assignment] +ERROR generics_typevartuple_variance.py:20:58-99: `InvariantTypeVarTuple[*tuple[int, ...]]` is not assignable to `InvariantTypeVarTuple[int]` [bad-assignment] +ERROR generics_typevartuple_variance.py:21:71-99: `InvariantTypeVarTuple[int]` is not assignable to `InvariantTypeVarTuple[*tuple[int, ...]]` [bad-assignment] +ERROR generics_typevartuple_variance.py:28:53-93: `ContravariantTypeVarTuple[object, int]` is not assignable to `ContravariantTypeVarTuple[object, object]` [bad-assignment] +ERROR generics_typevartuple_variance.py:29:42-77: `ContravariantTypeVarTuple[object]` is not assignable to `ContravariantTypeVarTuple[int]` [bad-assignment] +ERROR generics_typevartuple_variance.py:30:64-112: `ContravariantTypeVarTuple[*tuple[object, ...]]` is not assignable to `ContravariantTypeVarTuple[*tuple[int, ...]]` [bad-assignment] +ERROR generics_typevartuple_variance.py:31:70-115: `ContravariantTypeVarTuple[*tuple[int, ...]]` is not assignable to `ContravariantTypeVarTuple[*tuple[object, ...]]` [bad-assignment] +ERROR generics_typevartuple_variance.py:33:58-103: `ContravariantTypeVarTuple[*tuple[int, ...]]` is not assignable to `ContravariantTypeVarTuple[int]` [bad-assignment] +ERROR generics_typevartuple_variance.py:34:71-103: `ContravariantTypeVarTuple[int]` is not assignable to `ContravariantTypeVarTuple[*tuple[int, ...]]` [bad-assignment] +ERROR generics_typevartuple_variance.py:42:39-70: `CovariantTypeVarTuple[object]` is not assignable to `CovariantTypeVarTuple[int]` [bad-assignment] +ERROR generics_typevartuple_variance.py:43:42-70: `CovariantTypeVarTuple[int]` is not assignable to `CovariantTypeVarTuple[object]` [bad-assignment] +ERROR generics_typevartuple_variance.py:44:50-86: `CovariantTypeVarTuple[bool, bool]` is not assignable to `CovariantTypeVarTuple[int, int]` [bad-assignment] +ERROR generics_typevartuple_variance.py:45:50-88: `CovariantTypeVarTuple[bool, object]` is not assignable to `CovariantTypeVarTuple[int, int]` [bad-assignment] +ERROR generics_typevartuple_variance.py:46:50-88: `CovariantTypeVarTuple[object, bool]` is not assignable to `CovariantTypeVarTuple[int, int]` [bad-assignment] +ERROR generics_typevartuple_variance.py:47:50-90: `CovariantTypeVarTuple[object, object]` is not assignable to `CovariantTypeVarTuple[int, int]` [bad-assignment] +ERROR generics_typevartuple_variance.py:48:61-105: `CovariantTypeVarTuple[*tuple[object, ...]]` is not assignable to `CovariantTypeVarTuple[*tuple[int, ...]]` [bad-assignment] +ERROR generics_typevartuple_variance.py:49:67-108: `CovariantTypeVarTuple[*tuple[int, ...]]` is not assignable to `CovariantTypeVarTuple[*tuple[object, ...]]` [bad-assignment] +ERROR generics_typevartuple_variance.py:51:55-96: `CovariantTypeVarTuple[*tuple[int, ...]]` is not assignable to `CovariantTypeVarTuple[int]` [bad-assignment] +ERROR generics_typevartuple_variance.py:52:68-96: `CovariantTypeVarTuple[int]` is not assignable to `CovariantTypeVarTuple[*tuple[int, ...]]` [bad-assignment] +ERROR generics_typevartuple_variance.py:55:35-54: Unexpected keyword argument `infer_variance` to TypeVarTuple [invalid-type-var-tuple] +ERROR generics_typevartuple_variance.py:56:33-47: Unexpected keyword argument `covariant` to TypeVarTuple [invalid-type-var-tuple] +ERROR generics_typevartuple_variance.py:56:49-67: Unexpected keyword argument `contravariant` to TypeVarTuple [invalid-type-var-tuple] +ERROR generics_typevartuple_variance.py:57:33-47: Unexpected keyword argument `covariant` to TypeVarTuple [invalid-type-var-tuple] +ERROR generics_typevartuple_variance.py:57:49-68: Unexpected keyword argument `infer_variance` to TypeVarTuple [invalid-type-var-tuple] +ERROR generics_typevartuple_variance.py:58:33-51: Unexpected keyword argument `contravariant` to TypeVarTuple [invalid-type-var-tuple] +ERROR generics_typevartuple_variance.py:58:53-72: Unexpected keyword argument `infer_variance` to TypeVarTuple [invalid-type-var-tuple] +ERROR generics_typevartuple_variance.py:68:45-76: `InvariantTypeVarTupleOld[int]` is not assignable to `InvariantTypeVarTupleOld[object]` [bad-assignment] +ERROR generics_typevartuple_variance.py:69:42-76: `InvariantTypeVarTupleOld[object]` is not assignable to `InvariantTypeVarTupleOld[int]` [bad-assignment] +ERROR generics_typevartuple_variance.py:73:29-47: Unexpected keyword argument `contravariant` to TypeVarTuple [invalid-type-var-tuple] +ERROR generics_typevartuple_variance.py:83:52-87: `ContravariantTypeVarTupleOld[int]` is not assignable to `ContravariantTypeVarTupleOld[object]` [bad-assignment] +ERROR generics_typevartuple_variance.py:84:49-87: `ContravariantTypeVarTupleOld[object]` is not assignable to `ContravariantTypeVarTupleOld[int]` [bad-assignment] +ERROR generics_typevartuple_variance.py:87:31-45: Unexpected keyword argument `covariant` to TypeVarTuple [invalid-type-var-tuple] +ERROR generics_typevartuple_variance.py:97:46-80: `CovariantTypeVarTupleOld[object]` is not assignable to `CovariantTypeVarTupleOld[int]` [bad-assignment] +ERROR generics_typevartuple_variance.py:98:49-80: `CovariantTypeVarTupleOld[int]` is not assignable to `CovariantTypeVarTupleOld[object]` [bad-assignment] +ERROR generics_typevartuple_variance.py:107:66-109: `InferredContravariantTypeVarTupleOld[int]` is not assignable to `InferredContravariantTypeVarTupleOld[object]` [bad-assignment] +ERROR generics_typevartuple_variance.py:108:63-109: `InferredContravariantTypeVarTupleOld[object]` is not assignable to `InferredContravariantTypeVarTupleOld[int]` [bad-assignment] +ERROR generics_typevartuple_variance.py:116:60-102: `InferredCovariantTypeVarTupleOld[object]` is not assignable to `InferredCovariantTypeVarTupleOld[int]` [bad-assignment] +ERROR generics_typevartuple_variance.py:117:63-102: `InferredCovariantTypeVarTupleOld[int]` is not assignable to `InferredCovariantTypeVarTupleOld[object]` [bad-assignment] """ diff --git a/conformance/results/pyright/generics_paramspec_variance.toml b/conformance/results/pyright/generics_paramspec_variance.toml index 8d1903d0b..f39f7d2aa 100644 --- a/conformance/results/pyright/generics_paramspec_variance.toml +++ b/conformance/results/pyright/generics_paramspec_variance.toml @@ -1,19 +1,20 @@ conformant = "Unsupported" conformance_automated = "Fail" errors_diff = """ -Line 64: Expected 1 errors -Line 110: Expected 1 errors -Line 121: Expected 1 errors +Line 90: Expected 1 errors +Line 117: Expected 1 errors +Line 126: Expected 1 errors Line 22: Unexpected errors ['generics_paramspec_variance.py:22:39 - error: Type "ContravariantParamSpec[(object)]" is not assignable to declared type "ContravariantParamSpec[(int)]"'] Line 31: Unexpected errors ['generics_paramspec_variance.py:31:39 - error: Type "CovariantParamSpec[(int)]" is not assignable to declared type "CovariantParamSpec[(object)]"'] -Line 58: Unexpected errors ['generics_paramspec_variance.py:58:9 - error: Cannot assign to attribute "t" for class "Box[InitP[(a: int)]]"'] -Line 60: Unexpected errors ['generics_paramspec_variance.py:60:9 - error: Cannot assign to attribute "t" for class "Box[InitP[(a: int)]]"'] -Line 83: Unexpected errors ['generics_paramspec_variance.py:83:4 - error: Argument missing for parameter "fn" (reportCallIssue)', 'generics_paramspec_variance.py:83:4 - error: Call expression not allowed in type expression (reportInvalidTypeForm)'] -Line 91: Unexpected errors ['generics_paramspec_variance.py:91:1 - error: ParamSpec must be assigned to a variable named "InP" (reportGeneralTypeIssues)'] -Line 92: Unexpected errors ['generics_paramspec_variance.py:92:24 - error: "contravariant" is unknown parameter to ParamSpec (reportGeneralTypeIssues)'] -Line 115: Unexpected errors ['generics_paramspec_variance.py:115:46 - error: Type "ContravariantParamSpecOld[(object)]" is not assignable to declared type "ContravariantParamSpecOld[(int)]"'] -Line 117: Unexpected errors ['generics_paramspec_variance.py:117:26 - error: "covariant" is unknown parameter to ParamSpec (reportGeneralTypeIssues)'] -Line 128: Unexpected errors ['generics_paramspec_variance.py:128:46 - error: Type "CovariantParamSpecOld[(int)]" is not assignable to declared type "CovariantParamSpecOld[(object)]"'] +Line 84: Unexpected errors ['generics_paramspec_variance.py:84:13 - error: Cannot assign to attribute "t" for class "Box[OutitP[(a: int)]]"'] +Line 86: Unexpected errors ['generics_paramspec_variance.py:86:13 - error: Cannot assign to attribute "t" for class "Box[OutitP[(a: int)]]"'] +Line 97: Unexpected errors ['generics_paramspec_variance.py:97:24 - error: "contravariant" is unknown parameter to ParamSpec (reportGeneralTypeIssues)'] +Line 98: Unexpected errors ['generics_paramspec_variance.py:98:26 - error: "covariant" is unknown parameter to ParamSpec (reportGeneralTypeIssues)'] +Line 99: Unexpected errors ['generics_paramspec_variance.py:99:30 - error: "infer_variance" is unknown parameter to ParamSpec (reportGeneralTypeIssues)'] +Line 122: Unexpected errors ['generics_paramspec_variance.py:122:46 - error: Type "ContravariantParamSpecOld[(object)]" is not assignable to declared type "ContravariantParamSpecOld[(int)]"'] +Line 133: Unexpected errors ['generics_paramspec_variance.py:133:46 - error: Type "CovariantParamSpecOld[(int)]" is not assignable to declared type "CovariantParamSpecOld[(object)]"'] +Line 143: Unexpected errors ['generics_paramspec_variance.py:143:60 - error: Type "InferredContravariantParamSpecOld[(object)]" is not assignable to declared type "InferredContravariantParamSpecOld[(int)]"'] +Line 152: Unexpected errors ['generics_paramspec_variance.py:152:60 - error: Type "InferredCovariantParamSpecOld[(int)]" is not assignable to declared type "InferredCovariantParamSpecOld[(object)]"'] """ output = """ generics_paramspec_variance.py:14:42 - error: Type "InvariantParamSpec[(int)]" is not assignable to declared type "InvariantParamSpec[(object)]" @@ -34,55 +35,67 @@ generics_paramspec_variance.py:30:36 - error: Type "CovariantParamSpec[(object)] generics_paramspec_variance.py:31:39 - error: Type "CovariantParamSpec[(int)]" is not assignable to declared type "CovariantParamSpec[(object)]"   "CovariantParamSpec[(int)]" is not assignable to "CovariantParamSpec[(object)]"     Type parameter "OutP@CovariantParamSpec" is invariant, but "(int)" is not the same as "(object)" (reportAssignmentType) -generics_paramspec_variance.py:58:9 - error: Cannot assign to attribute "t" for class "Box[InitP[(a: int)]]" +generics_paramspec_variance.py:61:12 - error: Cannot assign to attribute "t" for class "Box[InitP[(a: int)]]"   "InitP[(*, a: int)]" is not assignable to "InitP[(a: int)]"     Type parameter "P@InitP" is invariant, but "(*, a: int)" is not the same as "(a: int)" (reportAttributeAccessIssue) -generics_paramspec_variance.py:60:9 - error: Cannot assign to attribute "t" for class "Box[InitP[(a: int)]]" +generics_paramspec_variance.py:63:12 - error: Cannot assign to attribute "t" for class "Box[InitP[(a: int)]]"   "InitP[(a: int, /)]" is not assignable to "InitP[(a: int)]"     Type parameter "P@InitP" is invariant, but "(a: int, /)" is not the same as "(a: int)" (reportAttributeAccessIssue) -generics_paramspec_variance.py:62:4 - error: Argument missing for parameter "fn" (reportCallIssue) -generics_paramspec_variance.py:62:4 - error: Call expression not allowed in type expression (reportInvalidTypeForm) -generics_paramspec_variance.py:66:9 - error: Cannot assign to attribute "t" for class "Box[InitP[(a: int)]]" +generics_paramspec_variance.py:65:12 - error: Cannot assign to attribute "t" for class "Box[InitP[(a: int)]]" +  "InitP[(b: int)]" is not assignable to "InitP[(a: int)]" +    Type parameter "P@InitP" is invariant, but "(b: int)" is not the same as "(a: int)" (reportAttributeAccessIssue) +generics_paramspec_variance.py:69:12 - error: Cannot assign to attribute "t" for class "Box[InitP[(a: int)]]"   "InitP[(a: int, b: str)]" is not assignable to "InitP[(a: int)]"     Type parameter "P@InitP" is invariant, but "(a: int, b: str)" is not the same as "(a: int)" (reportAttributeAccessIssue) -generics_paramspec_variance.py:79:9 - error: Cannot assign to attribute "t" for class "Box[OutitP[(a: int)]]" +generics_paramspec_variance.py:84:13 - error: Cannot assign to attribute "t" for class "Box[OutitP[(a: int)]]"   "OutitP[(*, a: int)]" is not assignable to "OutitP[(a: int)]"     Type parameter "P@OutitP" is invariant, but "(*, a: int)" is not the same as "(a: int)" (reportAttributeAccessIssue) -generics_paramspec_variance.py:81:9 - error: Cannot assign to attribute "t" for class "Box[OutitP[(a: int)]]" +generics_paramspec_variance.py:86:13 - error: Cannot assign to attribute "t" for class "Box[OutitP[(a: int)]]"   "OutitP[(a: int, /)]" is not assignable to "OutitP[(a: int)]"     Type parameter "P@OutitP" is invariant, but "(a: int, /)" is not the same as "(a: int)" (reportAttributeAccessIssue) -generics_paramspec_variance.py:83:4 - error: Argument missing for parameter "fn" (reportCallIssue) -generics_paramspec_variance.py:83:4 - error: Call expression not allowed in type expression (reportInvalidTypeForm) -generics_paramspec_variance.py:87:9 - error: Cannot assign to attribute "t" for class "Box[OutitP[(a: int)]]" +generics_paramspec_variance.py:88:13 - error: Cannot assign to attribute "t" for class "Box[OutitP[(a: int)]]" +  "OutitP[(b: int)]" is not assignable to "OutitP[(a: int)]" +    Type parameter "P@OutitP" is invariant, but "(b: int)" is not the same as "(a: int)" (reportAttributeAccessIssue) +generics_paramspec_variance.py:92:13 - error: Cannot assign to attribute "t" for class "Box[OutitP[(a: int)]]"   "OutitP[(a: int, b: str)]" is not assignable to "OutitP[(a: int)]"     Type parameter "P@OutitP" is invariant, but "(a: int, b: str)" is not the same as "(a: int)" (reportAttributeAccessIssue) -generics_paramspec_variance.py:91:1 - error: ParamSpec must be assigned to a variable named "InP" (reportGeneralTypeIssues) -generics_paramspec_variance.py:92:24 - error: "contravariant" is unknown parameter to ParamSpec (reportGeneralTypeIssues) -generics_paramspec_variance.py:93:28 - error: "covariant" is unknown parameter to ParamSpec (reportGeneralTypeIssues) -generics_paramspec_variance.py:93:44 - error: "contravariant" is unknown parameter to ParamSpec (reportGeneralTypeIssues) -generics_paramspec_variance.py:94:1 - error: ParamSpec must be assigned to a variable named "InvP1" (reportGeneralTypeIssues) -generics_paramspec_variance.py:94:28 - error: "covariant" is unknown parameter to ParamSpec (reportGeneralTypeIssues) -generics_paramspec_variance.py:94:44 - error: "infer_variance" is unknown parameter to ParamSpec (reportGeneralTypeIssues) -generics_paramspec_variance.py:95:1 - error: ParamSpec must be assigned to a variable named "InvP1" (reportGeneralTypeIssues) -generics_paramspec_variance.py:95:28 - error: "contravariant" is unknown parameter to ParamSpec (reportGeneralTypeIssues) -generics_paramspec_variance.py:95:48 - error: "infer_variance" is unknown parameter to ParamSpec (reportGeneralTypeIssues) -generics_paramspec_variance.py:103:14 - error: Type "InvariantParamSpecOld[(bool)]" is not assignable to declared type "InvariantParamSpecOld[(int)]" +generics_paramspec_variance.py:97:24 - error: "contravariant" is unknown parameter to ParamSpec (reportGeneralTypeIssues) +generics_paramspec_variance.py:98:26 - error: "covariant" is unknown parameter to ParamSpec (reportGeneralTypeIssues) +generics_paramspec_variance.py:99:30 - error: "infer_variance" is unknown parameter to ParamSpec (reportGeneralTypeIssues) +generics_paramspec_variance.py:100:28 - error: "covariant" is unknown parameter to ParamSpec (reportGeneralTypeIssues) +generics_paramspec_variance.py:100:44 - error: "contravariant" is unknown parameter to ParamSpec (reportGeneralTypeIssues) +generics_paramspec_variance.py:101:28 - error: "covariant" is unknown parameter to ParamSpec (reportGeneralTypeIssues) +generics_paramspec_variance.py:101:44 - error: "infer_variance" is unknown parameter to ParamSpec (reportGeneralTypeIssues) +generics_paramspec_variance.py:102:28 - error: "contravariant" is unknown parameter to ParamSpec (reportGeneralTypeIssues) +generics_paramspec_variance.py:102:48 - error: "infer_variance" is unknown parameter to ParamSpec (reportGeneralTypeIssues) +generics_paramspec_variance.py:110:14 - error: Type "InvariantParamSpecOld[(bool)]" is not assignable to declared type "InvariantParamSpecOld[(int)]"   "InvariantParamSpecOld[(bool)]" is not assignable to "InvariantParamSpecOld[(int)]" -    Type parameter "InP@InvariantParamSpecOld" is invariant, but "(bool)" is not the same as "(int)" (reportAssignmentType) -generics_paramspec_variance.py:104:14 - error: Type "InvariantParamSpecOld[(object)]" is not assignable to declared type "InvariantParamSpecOld[(int)]" +    Type parameter "P@InvariantParamSpecOld" is invariant, but "(bool)" is not the same as "(int)" (reportAssignmentType) +generics_paramspec_variance.py:111:14 - error: Type "InvariantParamSpecOld[(object)]" is not assignable to declared type "InvariantParamSpecOld[(int)]"   "InvariantParamSpecOld[(object)]" is not assignable to "InvariantParamSpecOld[(int)]" -    Type parameter "InP@InvariantParamSpecOld" is invariant, but "(object)" is not the same as "(int)" (reportAssignmentType) -generics_paramspec_variance.py:114:49 - error: Type "ContravariantParamSpecOld[(int)]" is not assignable to declared type "ContravariantParamSpecOld[(object)]" +    Type parameter "P@InvariantParamSpecOld" is invariant, but "(object)" is not the same as "(int)" (reportAssignmentType) +generics_paramspec_variance.py:121:49 - error: Type "ContravariantParamSpecOld[(int)]" is not assignable to declared type "ContravariantParamSpecOld[(object)]"   "ContravariantParamSpecOld[(int)]" is not assignable to "ContravariantParamSpecOld[(object)]"     Type parameter "InP@ContravariantParamSpecOld" is invariant, but "(int)" is not the same as "(object)" (reportAssignmentType) -generics_paramspec_variance.py:115:46 - error: Type "ContravariantParamSpecOld[(object)]" is not assignable to declared type "ContravariantParamSpecOld[(int)]" +generics_paramspec_variance.py:122:46 - error: Type "ContravariantParamSpecOld[(object)]" is not assignable to declared type "ContravariantParamSpecOld[(int)]"   "ContravariantParamSpecOld[(object)]" is not assignable to "ContravariantParamSpecOld[(int)]"     Type parameter "InP@ContravariantParamSpecOld" is invariant, but "(object)" is not the same as "(int)" (reportAssignmentType) -generics_paramspec_variance.py:117:26 - error: "covariant" is unknown parameter to ParamSpec (reportGeneralTypeIssues) -generics_paramspec_variance.py:127:43 - error: Type "CovariantParamSpecOld[(object)]" is not assignable to declared type "CovariantParamSpecOld[(int)]" +generics_paramspec_variance.py:132:43 - error: Type "CovariantParamSpecOld[(object)]" is not assignable to declared type "CovariantParamSpecOld[(int)]"   "CovariantParamSpecOld[(object)]" is not assignable to "CovariantParamSpecOld[(int)]"     Type parameter "OutP@CovariantParamSpecOld" is invariant, but "(object)" is not the same as "(int)" (reportAssignmentType) -generics_paramspec_variance.py:128:46 - error: Type "CovariantParamSpecOld[(int)]" is not assignable to declared type "CovariantParamSpecOld[(object)]" +generics_paramspec_variance.py:133:46 - error: Type "CovariantParamSpecOld[(int)]" is not assignable to declared type "CovariantParamSpecOld[(object)]"   "CovariantParamSpecOld[(int)]" is not assignable to "CovariantParamSpecOld[(object)]"     Type parameter "OutP@CovariantParamSpecOld" is invariant, but "(int)" is not the same as "(object)" (reportAssignmentType) +generics_paramspec_variance.py:142:63 - error: Type "InferredContravariantParamSpecOld[(int)]" is not assignable to declared type "InferredContravariantParamSpecOld[(object)]" +  "InferredContravariantParamSpecOld[(int)]" is not assignable to "InferredContravariantParamSpecOld[(object)]" +    Type parameter "InferP@InferredContravariantParamSpecOld" is invariant, but "(int)" is not the same as "(object)" (reportAssignmentType) +generics_paramspec_variance.py:143:60 - error: Type "InferredContravariantParamSpecOld[(object)]" is not assignable to declared type "InferredContravariantParamSpecOld[(int)]" +  "InferredContravariantParamSpecOld[(object)]" is not assignable to "InferredContravariantParamSpecOld[(int)]" +    Type parameter "InferP@InferredContravariantParamSpecOld" is invariant, but "(object)" is not the same as "(int)" (reportAssignmentType) +generics_paramspec_variance.py:151:57 - error: Type "InferredCovariantParamSpecOld[(object)]" is not assignable to declared type "InferredCovariantParamSpecOld[(int)]" +  "InferredCovariantParamSpecOld[(object)]" is not assignable to "InferredCovariantParamSpecOld[(int)]" +    Type parameter "InferP@InferredCovariantParamSpecOld" is invariant, but "(object)" is not the same as "(int)" (reportAssignmentType) +generics_paramspec_variance.py:152:60 - error: Type "InferredCovariantParamSpecOld[(int)]" is not assignable to declared type "InferredCovariantParamSpecOld[(object)]" +  "InferredCovariantParamSpecOld[(int)]" is not assignable to "InferredCovariantParamSpecOld[(object)]" +    Type parameter "InferP@InferredCovariantParamSpecOld" is invariant, but "(int)" is not the same as "(object)" (reportAssignmentType) """ diff --git a/conformance/results/pyright/generics_typevartuple_variance.toml b/conformance/results/pyright/generics_typevartuple_variance.toml index 0d7578e7c..3bfb0f7c7 100644 --- a/conformance/results/pyright/generics_typevartuple_variance.toml +++ b/conformance/results/pyright/generics_typevartuple_variance.toml @@ -1,17 +1,23 @@ conformant = "Unsupported" conformance_automated = "Fail" errors_diff = """ -Line 72: Expected 1 errors -Line 83: Expected 1 errors -Line 27: Unexpected errors ['generics_typevartuple_variance.py:27:42 - error: Type "ContravariantTypeVarTuple[object]" is not assignable to declared type "ContravariantTypeVarTuple[int]"'] -Line 28: Unexpected errors ['generics_typevartuple_variance.py:28:64 - error: Type "ContravariantTypeVarTuple[*tuple[object, ...]]" is not assignable to declared type "ContravariantTypeVarTuple[*tuple[int, ...]]"'] -Line 39: Unexpected errors ['generics_typevartuple_variance.py:39:42 - error: Type "CovariantTypeVarTuple[int]" is not assignable to declared type "CovariantTypeVarTuple[object]"'] -Line 40: Unexpected errors ['generics_typevartuple_variance.py:40:50 - error: Type "CovariantTypeVarTuple[bool, bool]" is not assignable to declared type "CovariantTypeVarTuple[int, int]"'] -Line 45: Unexpected errors ['generics_typevartuple_variance.py:45:67 - error: Type "CovariantTypeVarTuple[*tuple[int, ...]]" is not assignable to declared type "CovariantTypeVarTuple[*tuple[object, ...]]"'] -Line 66: Unexpected errors ['generics_typevartuple_variance.py:66:29 - error: "contravariant" is unknown parameter to TypeVarTuple (reportGeneralTypeIssues)'] -Line 77: Unexpected errors ['generics_typevartuple_variance.py:77:49 - error: Type "ContravariantTypeVarTupleOld[object]" is not assignable to declared type "ContravariantTypeVarTupleOld[int]"'] -Line 80: Unexpected errors ['generics_typevartuple_variance.py:80:31 - error: "covariant" is unknown parameter to TypeVarTuple (reportGeneralTypeIssues)'] -Line 91: Unexpected errors ['generics_typevartuple_variance.py:91:49 - error: Type "CovariantTypeVarTupleOld[int]" is not assignable to declared type "CovariantTypeVarTupleOld[object]"'] +Line 21: Expected 1 errors +Line 34: Expected 1 errors +Line 79: Expected 1 errors +Line 90: Expected 1 errors +Line 29: Unexpected errors ['generics_typevartuple_variance.py:29:42 - error: Type "ContravariantTypeVarTuple[object]" is not assignable to declared type "ContravariantTypeVarTuple[int]"'] +Line 30: Unexpected errors ['generics_typevartuple_variance.py:30:64 - error: Type "ContravariantTypeVarTuple[*tuple[object, ...]]" is not assignable to declared type "ContravariantTypeVarTuple[*tuple[int, ...]]"'] +Line 33: Unexpected errors ['generics_typevartuple_variance.py:33:58 - error: Type "ContravariantTypeVarTuple[*tuple[int, ...]]" is not assignable to declared type "ContravariantTypeVarTuple[int]"'] +Line 43: Unexpected errors ['generics_typevartuple_variance.py:43:42 - error: Type "CovariantTypeVarTuple[int]" is not assignable to declared type "CovariantTypeVarTuple[object]"'] +Line 44: Unexpected errors ['generics_typevartuple_variance.py:44:50 - error: Type "CovariantTypeVarTuple[bool, bool]" is not assignable to declared type "CovariantTypeVarTuple[int, int]"'] +Line 49: Unexpected errors ['generics_typevartuple_variance.py:49:67 - error: Type "CovariantTypeVarTuple[*tuple[int, ...]]" is not assignable to declared type "CovariantTypeVarTuple[*tuple[object, ...]]"'] +Line 55: Unexpected errors ['generics_typevartuple_variance.py:55:35 - error: "infer_variance" is unknown parameter to TypeVarTuple (reportGeneralTypeIssues)'] +Line 73: Unexpected errors ['generics_typevartuple_variance.py:73:29 - error: "contravariant" is unknown parameter to TypeVarTuple (reportGeneralTypeIssues)'] +Line 84: Unexpected errors ['generics_typevartuple_variance.py:84:49 - error: Type "ContravariantTypeVarTupleOld[object]" is not assignable to declared type "ContravariantTypeVarTupleOld[int]"'] +Line 87: Unexpected errors ['generics_typevartuple_variance.py:87:31 - error: "covariant" is unknown parameter to TypeVarTuple (reportGeneralTypeIssues)'] +Line 98: Unexpected errors ['generics_typevartuple_variance.py:98:49 - error: Type "CovariantTypeVarTupleOld[int]" is not assignable to declared type "CovariantTypeVarTupleOld[object]"'] +Line 108: Unexpected errors ['generics_typevartuple_variance.py:108:63 - error: Type "InferredContravariantTypeVarTupleOld[object]" is not assignable to declared type "InferredContravariantTypeVarTupleOld[int]"'] +Line 117: Unexpected errors ['generics_typevartuple_variance.py:117:63 - error: Type "InferredCovariantTypeVarTupleOld[int]" is not assignable to declared type "InferredCovariantTypeVarTupleOld[object]"'] """ output = """ generics_typevartuple_variance.py:14:45 - error: Type "InvariantTypeVarTuple[int]" is not assignable to declared type "InvariantTypeVarTuple[object]" @@ -26,66 +32,88 @@ generics_typevartuple_variance.py:17:64 - error: Type "InvariantTypeVarTuple[*tu generics_typevartuple_variance.py:18:70 - error: Type "InvariantTypeVarTuple[*tuple[int, ...]]" is not assignable to declared type "InvariantTypeVarTuple[*tuple[object, ...]]"   "InvariantTypeVarTuple[*tuple[int, ...]]" is not assignable to "InvariantTypeVarTuple[*tuple[object, ...]]"     Type parameter "InOutTs@InvariantTypeVarTuple" is invariant, but "*tuple[int, ...]" is not the same as "*tuple[object, ...]" (reportAssignmentType) -generics_typevartuple_variance.py:26:53 - error: Type "ContravariantTypeVarTuple[object, int]" is not assignable to declared type "ContravariantTypeVarTuple[object, object]" +generics_typevartuple_variance.py:20:58 - error: Type "InvariantTypeVarTuple[*tuple[int, ...]]" is not assignable to declared type "InvariantTypeVarTuple[int]" +  "InvariantTypeVarTuple[*tuple[int, ...]]" is not assignable to "InvariantTypeVarTuple[int]" +    Type parameter "InOutTs@InvariantTypeVarTuple" is invariant, but "*tuple[int, ...]" is not the same as "*tuple[int]" (reportAssignmentType) +generics_typevartuple_variance.py:28:53 - error: Type "ContravariantTypeVarTuple[object, int]" is not assignable to declared type "ContravariantTypeVarTuple[object, object]"   "ContravariantTypeVarTuple[object, int]" is not assignable to "ContravariantTypeVarTuple[object, object]"     Type parameter "InTs@ContravariantTypeVarTuple" is invariant, but "*tuple[object, int]" is not the same as "*tuple[object, object]" (reportAssignmentType) -generics_typevartuple_variance.py:27:42 - error: Type "ContravariantTypeVarTuple[object]" is not assignable to declared type "ContravariantTypeVarTuple[int]" +generics_typevartuple_variance.py:29:42 - error: Type "ContravariantTypeVarTuple[object]" is not assignable to declared type "ContravariantTypeVarTuple[int]"   "ContravariantTypeVarTuple[object]" is not assignable to "ContravariantTypeVarTuple[int]"     Type parameter "InTs@ContravariantTypeVarTuple" is invariant, but "*tuple[object]" is not the same as "*tuple[int]" (reportAssignmentType) -generics_typevartuple_variance.py:28:64 - error: Type "ContravariantTypeVarTuple[*tuple[object, ...]]" is not assignable to declared type "ContravariantTypeVarTuple[*tuple[int, ...]]" +generics_typevartuple_variance.py:30:64 - error: Type "ContravariantTypeVarTuple[*tuple[object, ...]]" is not assignable to declared type "ContravariantTypeVarTuple[*tuple[int, ...]]"   "ContravariantTypeVarTuple[*tuple[object, ...]]" is not assignable to "ContravariantTypeVarTuple[*tuple[int, ...]]"     Type parameter "InTs@ContravariantTypeVarTuple" is invariant, but "*tuple[object, ...]" is not the same as "*tuple[int, ...]" (reportAssignmentType) -generics_typevartuple_variance.py:29:70 - error: Type "ContravariantTypeVarTuple[*tuple[int, ...]]" is not assignable to declared type "ContravariantTypeVarTuple[*tuple[object, ...]]" +generics_typevartuple_variance.py:31:70 - error: Type "ContravariantTypeVarTuple[*tuple[int, ...]]" is not assignable to declared type "ContravariantTypeVarTuple[*tuple[object, ...]]"   "ContravariantTypeVarTuple[*tuple[int, ...]]" is not assignable to "ContravariantTypeVarTuple[*tuple[object, ...]]"     Type parameter "InTs@ContravariantTypeVarTuple" is invariant, but "*tuple[int, ...]" is not the same as "*tuple[object, ...]" (reportAssignmentType) -generics_typevartuple_variance.py:38:39 - error: Type "CovariantTypeVarTuple[object]" is not assignable to declared type "CovariantTypeVarTuple[int]" +generics_typevartuple_variance.py:33:58 - error: Type "ContravariantTypeVarTuple[*tuple[int, ...]]" is not assignable to declared type "ContravariantTypeVarTuple[int]" +  "ContravariantTypeVarTuple[*tuple[int, ...]]" is not assignable to "ContravariantTypeVarTuple[int]" +    Type parameter "InTs@ContravariantTypeVarTuple" is invariant, but "*tuple[int, ...]" is not the same as "*tuple[int]" (reportAssignmentType) +generics_typevartuple_variance.py:42:39 - error: Type "CovariantTypeVarTuple[object]" is not assignable to declared type "CovariantTypeVarTuple[int]"   "CovariantTypeVarTuple[object]" is not assignable to "CovariantTypeVarTuple[int]"     Type parameter "OutTs@CovariantTypeVarTuple" is invariant, but "*tuple[object]" is not the same as "*tuple[int]" (reportAssignmentType) -generics_typevartuple_variance.py:39:42 - error: Type "CovariantTypeVarTuple[int]" is not assignable to declared type "CovariantTypeVarTuple[object]" +generics_typevartuple_variance.py:43:42 - error: Type "CovariantTypeVarTuple[int]" is not assignable to declared type "CovariantTypeVarTuple[object]"   "CovariantTypeVarTuple[int]" is not assignable to "CovariantTypeVarTuple[object]"     Type parameter "OutTs@CovariantTypeVarTuple" is invariant, but "*tuple[int]" is not the same as "*tuple[object]" (reportAssignmentType) -generics_typevartuple_variance.py:40:50 - error: Type "CovariantTypeVarTuple[bool, bool]" is not assignable to declared type "CovariantTypeVarTuple[int, int]" +generics_typevartuple_variance.py:44:50 - error: Type "CovariantTypeVarTuple[bool, bool]" is not assignable to declared type "CovariantTypeVarTuple[int, int]"   "CovariantTypeVarTuple[bool, bool]" is not assignable to "CovariantTypeVarTuple[int, int]"     Type parameter "OutTs@CovariantTypeVarTuple" is invariant, but "*tuple[bool, bool]" is not the same as "*tuple[int, int]" (reportAssignmentType) -generics_typevartuple_variance.py:41:50 - error: Type "CovariantTypeVarTuple[bool, object]" is not assignable to declared type "CovariantTypeVarTuple[int, int]" +generics_typevartuple_variance.py:45:50 - error: Type "CovariantTypeVarTuple[bool, object]" is not assignable to declared type "CovariantTypeVarTuple[int, int]"   "CovariantTypeVarTuple[bool, object]" is not assignable to "CovariantTypeVarTuple[int, int]"     Type parameter "OutTs@CovariantTypeVarTuple" is invariant, but "*tuple[bool, object]" is not the same as "*tuple[int, int]" (reportAssignmentType) -generics_typevartuple_variance.py:42:50 - error: Type "CovariantTypeVarTuple[object, bool]" is not assignable to declared type "CovariantTypeVarTuple[int, int]" +generics_typevartuple_variance.py:46:50 - error: Type "CovariantTypeVarTuple[object, bool]" is not assignable to declared type "CovariantTypeVarTuple[int, int]"   "CovariantTypeVarTuple[object, bool]" is not assignable to "CovariantTypeVarTuple[int, int]"     Type parameter "OutTs@CovariantTypeVarTuple" is invariant, but "*tuple[object, bool]" is not the same as "*tuple[int, int]" (reportAssignmentType) -generics_typevartuple_variance.py:43:50 - error: Type "CovariantTypeVarTuple[object, object]" is not assignable to declared type "CovariantTypeVarTuple[int, int]" +generics_typevartuple_variance.py:47:50 - error: Type "CovariantTypeVarTuple[object, object]" is not assignable to declared type "CovariantTypeVarTuple[int, int]"   "CovariantTypeVarTuple[object, object]" is not assignable to "CovariantTypeVarTuple[int, int]"     Type parameter "OutTs@CovariantTypeVarTuple" is invariant, but "*tuple[object, object]" is not the same as "*tuple[int, int]" (reportAssignmentType) -generics_typevartuple_variance.py:44:61 - error: Type "CovariantTypeVarTuple[*tuple[object, ...]]" is not assignable to declared type "CovariantTypeVarTuple[*tuple[int, ...]]" +generics_typevartuple_variance.py:48:61 - error: Type "CovariantTypeVarTuple[*tuple[object, ...]]" is not assignable to declared type "CovariantTypeVarTuple[*tuple[int, ...]]"   "CovariantTypeVarTuple[*tuple[object, ...]]" is not assignable to "CovariantTypeVarTuple[*tuple[int, ...]]"     Type parameter "OutTs@CovariantTypeVarTuple" is invariant, but "*tuple[object, ...]" is not the same as "*tuple[int, ...]" (reportAssignmentType) -generics_typevartuple_variance.py:45:67 - error: Type "CovariantTypeVarTuple[*tuple[int, ...]]" is not assignable to declared type "CovariantTypeVarTuple[*tuple[object, ...]]" +generics_typevartuple_variance.py:49:67 - error: Type "CovariantTypeVarTuple[*tuple[int, ...]]" is not assignable to declared type "CovariantTypeVarTuple[*tuple[object, ...]]"   "CovariantTypeVarTuple[*tuple[int, ...]]" is not assignable to "CovariantTypeVarTuple[*tuple[object, ...]]"     Type parameter "OutTs@CovariantTypeVarTuple" is invariant, but "*tuple[int, ...]" is not the same as "*tuple[object, ...]" (reportAssignmentType) -generics_typevartuple_variance.py:49:33 - error: "covariant" is unknown parameter to TypeVarTuple (reportGeneralTypeIssues) -generics_typevartuple_variance.py:49:49 - error: "contravariant" is unknown parameter to TypeVarTuple (reportGeneralTypeIssues) -generics_typevartuple_variance.py:50:33 - error: "covariant" is unknown parameter to TypeVarTuple (reportGeneralTypeIssues) -generics_typevartuple_variance.py:50:49 - error: "infer_variance" is unknown parameter to TypeVarTuple (reportGeneralTypeIssues) -generics_typevartuple_variance.py:51:33 - error: "covariant" is unknown parameter to TypeVarTuple (reportGeneralTypeIssues) -generics_typevartuple_variance.py:51:49 - error: "infer_variance" is unknown parameter to TypeVarTuple (reportGeneralTypeIssues) -generics_typevartuple_variance.py:61:45 - error: Type "InvariantTypeVarTupleOld[int]" is not assignable to declared type "InvariantTypeVarTupleOld[object]" +generics_typevartuple_variance.py:51:55 - error: Type "CovariantTypeVarTuple[*tuple[int, ...]]" is not assignable to declared type "CovariantTypeVarTuple[int]" +  "CovariantTypeVarTuple[*tuple[int, ...]]" is not assignable to "CovariantTypeVarTuple[int]" +    Type parameter "OutTs@CovariantTypeVarTuple" is invariant, but "*tuple[int, ...]" is not the same as "*tuple[int]" (reportAssignmentType) +generics_typevartuple_variance.py:55:35 - error: "infer_variance" is unknown parameter to TypeVarTuple (reportGeneralTypeIssues) +generics_typevartuple_variance.py:56:33 - error: "covariant" is unknown parameter to TypeVarTuple (reportGeneralTypeIssues) +generics_typevartuple_variance.py:56:49 - error: "contravariant" is unknown parameter to TypeVarTuple (reportGeneralTypeIssues) +generics_typevartuple_variance.py:57:33 - error: "covariant" is unknown parameter to TypeVarTuple (reportGeneralTypeIssues) +generics_typevartuple_variance.py:57:49 - error: "infer_variance" is unknown parameter to TypeVarTuple (reportGeneralTypeIssues) +generics_typevartuple_variance.py:58:33 - error: "contravariant" is unknown parameter to TypeVarTuple (reportGeneralTypeIssues) +generics_typevartuple_variance.py:58:53 - error: "infer_variance" is unknown parameter to TypeVarTuple (reportGeneralTypeIssues) +generics_typevartuple_variance.py:68:45 - error: Type "InvariantTypeVarTupleOld[int]" is not assignable to declared type "InvariantTypeVarTupleOld[object]"   "InvariantTypeVarTupleOld[int]" is not assignable to "InvariantTypeVarTupleOld[object]"     Type parameter "Ts@InvariantTypeVarTupleOld" is invariant, but "*tuple[int]" is not the same as "*tuple[object]" (reportAssignmentType) -generics_typevartuple_variance.py:62:42 - error: Type "InvariantTypeVarTupleOld[object]" is not assignable to declared type "InvariantTypeVarTupleOld[int]" +generics_typevartuple_variance.py:69:42 - error: Type "InvariantTypeVarTupleOld[object]" is not assignable to declared type "InvariantTypeVarTupleOld[int]"   "InvariantTypeVarTupleOld[object]" is not assignable to "InvariantTypeVarTupleOld[int]"     Type parameter "Ts@InvariantTypeVarTupleOld" is invariant, but "*tuple[object]" is not the same as "*tuple[int]" (reportAssignmentType) -generics_typevartuple_variance.py:66:29 - error: "contravariant" is unknown parameter to TypeVarTuple (reportGeneralTypeIssues) -generics_typevartuple_variance.py:76:52 - error: Type "ContravariantTypeVarTupleOld[int]" is not assignable to declared type "ContravariantTypeVarTupleOld[object]" +generics_typevartuple_variance.py:73:29 - error: "contravariant" is unknown parameter to TypeVarTuple (reportGeneralTypeIssues) +generics_typevartuple_variance.py:83:52 - error: Type "ContravariantTypeVarTupleOld[int]" is not assignable to declared type "ContravariantTypeVarTupleOld[object]"   "ContravariantTypeVarTupleOld[int]" is not assignable to "ContravariantTypeVarTupleOld[object]"     Type parameter "InTs@ContravariantTypeVarTupleOld" is invariant, but "*tuple[int]" is not the same as "*tuple[object]" (reportAssignmentType) -generics_typevartuple_variance.py:77:49 - error: Type "ContravariantTypeVarTupleOld[object]" is not assignable to declared type "ContravariantTypeVarTupleOld[int]" +generics_typevartuple_variance.py:84:49 - error: Type "ContravariantTypeVarTupleOld[object]" is not assignable to declared type "ContravariantTypeVarTupleOld[int]"   "ContravariantTypeVarTupleOld[object]" is not assignable to "ContravariantTypeVarTupleOld[int]"     Type parameter "InTs@ContravariantTypeVarTupleOld" is invariant, but "*tuple[object]" is not the same as "*tuple[int]" (reportAssignmentType) -generics_typevartuple_variance.py:80:31 - error: "covariant" is unknown parameter to TypeVarTuple (reportGeneralTypeIssues) -generics_typevartuple_variance.py:90:46 - error: Type "CovariantTypeVarTupleOld[object]" is not assignable to declared type "CovariantTypeVarTupleOld[int]" +generics_typevartuple_variance.py:87:31 - error: "covariant" is unknown parameter to TypeVarTuple (reportGeneralTypeIssues) +generics_typevartuple_variance.py:97:46 - error: Type "CovariantTypeVarTupleOld[object]" is not assignable to declared type "CovariantTypeVarTupleOld[int]"   "CovariantTypeVarTupleOld[object]" is not assignable to "CovariantTypeVarTupleOld[int]"     Type parameter "OutTs@CovariantTypeVarTupleOld" is invariant, but "*tuple[object]" is not the same as "*tuple[int]" (reportAssignmentType) -generics_typevartuple_variance.py:91:49 - error: Type "CovariantTypeVarTupleOld[int]" is not assignable to declared type "CovariantTypeVarTupleOld[object]" +generics_typevartuple_variance.py:98:49 - error: Type "CovariantTypeVarTupleOld[int]" is not assignable to declared type "CovariantTypeVarTupleOld[object]"   "CovariantTypeVarTupleOld[int]" is not assignable to "CovariantTypeVarTupleOld[object]"     Type parameter "OutTs@CovariantTypeVarTupleOld" is invariant, but "*tuple[int]" is not the same as "*tuple[object]" (reportAssignmentType) +generics_typevartuple_variance.py:107:66 - error: Type "InferredContravariantTypeVarTupleOld[int]" is not assignable to declared type "InferredContravariantTypeVarTupleOld[object]" +  "InferredContravariantTypeVarTupleOld[int]" is not assignable to "InferredContravariantTypeVarTupleOld[object]" +    Type parameter "InferTs@InferredContravariantTypeVarTupleOld" is invariant, but "*tuple[int]" is not the same as "*tuple[object]" (reportAssignmentType) +generics_typevartuple_variance.py:108:63 - error: Type "InferredContravariantTypeVarTupleOld[object]" is not assignable to declared type "InferredContravariantTypeVarTupleOld[int]" +  "InferredContravariantTypeVarTupleOld[object]" is not assignable to "InferredContravariantTypeVarTupleOld[int]" +    Type parameter "InferTs@InferredContravariantTypeVarTupleOld" is invariant, but "*tuple[object]" is not the same as "*tuple[int]" (reportAssignmentType) +generics_typevartuple_variance.py:116:60 - error: Type "InferredCovariantTypeVarTupleOld[object]" is not assignable to declared type "InferredCovariantTypeVarTupleOld[int]" +  "InferredCovariantTypeVarTupleOld[object]" is not assignable to "InferredCovariantTypeVarTupleOld[int]" +    Type parameter "InferTs@InferredCovariantTypeVarTupleOld" is invariant, but "*tuple[object]" is not the same as "*tuple[int]" (reportAssignmentType) +generics_typevartuple_variance.py:117:63 - error: Type "InferredCovariantTypeVarTupleOld[int]" is not assignable to declared type "InferredCovariantTypeVarTupleOld[object]" +  "InferredCovariantTypeVarTupleOld[int]" is not assignable to "InferredCovariantTypeVarTupleOld[object]" +    Type parameter "InferTs@InferredCovariantTypeVarTupleOld" is invariant, but "*tuple[int]" is not the same as "*tuple[object]" (reportAssignmentType) """ diff --git a/conformance/results/pyright/protocols_variance.toml b/conformance/results/pyright/protocols_variance.toml index 5ea6133eb..761d7d473 100644 --- a/conformance/results/pyright/protocols_variance.toml +++ b/conformance/results/pyright/protocols_variance.toml @@ -1,6 +1,6 @@ conformant = "Partial" notes = """ -Doesn't support keyword arguments to ParamSpec +Doesn't support variance keyword arguments to ParamSpec. """ output = """ protocols_variance.py:15:20 - error: "contravariant" is unknown parameter to ParamSpec (reportGeneralTypeIssues) diff --git a/conformance/results/results.html b/conformance/results/results.html index 6f89d20e3..76874ae97 100644 --- a/conformance/results/results.html +++ b/conformance/results/results.html @@ -610,6 +610,15 @@

Python Type System Conformance Test Results

Pass Pass + + generics_mixed_variance_inference + Pass + Unsupported + Unsupported + Unsupported + Pass + Unsupported + generics_paramspec_basic Pass @@ -651,6 +660,20 @@

Python Type System Conformance Test Results

Pass Pass + + generics_paramspec_variance + Unsupported + Unsupported + Unsupported + Unsupported + + Partial +
    +
  • Does not error when a ParamSpec is used in a position that violates its explicit variance.
  • +
+ + Unsupported + generics_scoping Pass @@ -827,7 +850,12 @@

Python Type System Conformance Test Results

  • Does not enforce that tuples captured by TypeVarTuple are same length.
  • - Pass + + Partial +
      +
    • Doesn't error when multiple type variable tuples appear in a PEP 695 type parameter list; only detects the Generic[...] form.
    • +
    + Pass Partial @@ -894,6 +922,20 @@

    Python Type System Conformance Test Results

    Pass Pass + + generics_typevartuple_variance + Unsupported + Unsupported + Unsupported + Unsupported + + Partial +
      +
    • Does not error when a TypeVarTuple is used in a position that violates its explicit variance.
    • +
    + + Unsupported + generics_upper_bound @@ -947,12 +989,12 @@

    Python Type System Conformance Test Results

    - 22.5 / 30 • 75.0% - 28.5 / 30 • 95.0% - 30 / 30 • 100.0% - 28.5 / 30 • 95.0% - 27 / 30 • 90.0% - 29.5 / 30 • 98.3% + 23.5 / 33 • 71.2% + 28 / 33 • 84.8% + 30 / 33 • 90.9% + 28.5 / 33 • 86.4% + 29 / 33 • 87.9% + 29.5 / 33 • 89.4% @@ -1459,21 +1501,41 @@

    Python Type System Conformance Test Results

    protocols_variance + + Partial +
      +
    • False report of ParamSpec variance keywords.
    • +
    + Pass - Pass - Pass - Pass + + Partial +
      +
    • Doesn't support variance keywords to ParamSpec
    • +
    + + + Partial +
      +
    • Doesn't support variance keyword arguments to ParamSpec.
    • +
    + Unsupported - Pass + + Partial +
      +
    • False report of ParamSpec variance keywords.
    • +
    + + 9.5 / 11 • 86.4% 10 / 11 • 90.9% - 10 / 11 • 90.9% - 11 / 11 • 100.0% - 11 / 11 • 100.0% + 10.5 / 11 • 95.5% + 10.5 / 11 • 95.5% 6.5 / 11 • 59.1% - 11 / 11 • 100.0% + 10.5 / 11 • 95.5% @@ -2645,12 +2707,12 @@

    Python Type System Conformance Test Results

    - 108 / 142 • 76.1% - 130 / 142 • 91.5% - 141 / 142 • 99.3% - 136 / 142 • 95.8% - 126 / 142 • 88.7% - 140 / 142 • 98.6% + 108.5 / 145 • 74.8% + 129.5 / 145 • 89.3% + 140.5 / 145 • 96.9% + 135.5 / 145 • 93.4% + 128 / 145 • 88.3% + 139.5 / 145 • 96.2% diff --git a/conformance/results/ty/generics_paramspec_variance.toml b/conformance/results/ty/generics_paramspec_variance.toml index 17232693d..ea6750cbf 100644 --- a/conformance/results/ty/generics_paramspec_variance.toml +++ b/conformance/results/ty/generics_paramspec_variance.toml @@ -4,37 +4,28 @@ Does not error when a ParamSpec is used in a position that violates its explicit """ conformance_automated = "Fail" errors_diff = """ -Line 64: Expected 1 errors -Line 79: Expected 1 errors -Line 81: Expected 1 errors -Line 110: Expected 1 errors -Line 121: Expected 1 errors -Line 58: Unexpected errors ['generics_paramspec_variance.py:58:1: error[invalid-assignment] Object of type `InitP[(*, a: int)]` is not assignable to attribute `t` of type `InitP[(a: int)]`'] -Line 60: Unexpected errors ['generics_paramspec_variance.py:60:1: error[invalid-assignment] Object of type `InitP[(a: int, /)]` is not assignable to attribute `t` of type `InitP[(a: int)]`'] -Line 83: Unexpected errors ['generics_paramspec_variance.py:83:4: error[invalid-type-form] Function calls are not allowed in type expressions', 'generics_paramspec_variance.py:83:4: error[missing-argument] No argument provided for required parameter `fn` of `OutitP.__init__`'] -Line 85: Unexpected errors ['generics_paramspec_variance.py:85:1: error[invalid-assignment] Object of type `OutitP[(a: int = 1)]` is not assignable to attribute `t` of type `OutitP[(a: int)]`'] -Line 91: Unexpected errors ['generics_paramspec_variance.py:91:15: error[mismatched-type-name] The name passed to `ParamSpec` must match the variable it is assigned to: Expected "P", got "InP"'] +Line 117: Expected 1 errors +Line 126: Expected 1 errors """ output = """ generics_paramspec_variance.py:14:42: error[invalid-assignment] Object of type `InvariantParamSpec[(int, /)]` is not assignable to `InvariantParamSpec[(object, /)]` generics_paramspec_variance.py:15:39: error[invalid-assignment] Object of type `InvariantParamSpec[(object, /)]` is not assignable to `InvariantParamSpec[(int, /)]` generics_paramspec_variance.py:21:42: error[invalid-assignment] Object of type `ContravariantParamSpec[(int, /)]` is not assignable to `ContravariantParamSpec[(object, /)]` generics_paramspec_variance.py:30:36: error[invalid-assignment] Object of type `CovariantParamSpec[(object, /)]` is not assignable to `CovariantParamSpec[(int, /)]` -generics_paramspec_variance.py:58:1: error[invalid-assignment] Object of type `InitP[(*, a: int)]` is not assignable to attribute `t` of type `InitP[(a: int)]` -generics_paramspec_variance.py:60:1: error[invalid-assignment] Object of type `InitP[(a: int, /)]` is not assignable to attribute `t` of type `InitP[(a: int)]` -generics_paramspec_variance.py:62:4: error[invalid-type-form] Function calls are not allowed in type expressions -generics_paramspec_variance.py:62:4: error[missing-argument] No argument provided for required parameter `fn` of `InitP.__init__` -generics_paramspec_variance.py:66:1: error[invalid-assignment] Object of type `InitP[(a: int, b: str)]` is not assignable to attribute `t` of type `InitP[(a: int)]` -generics_paramspec_variance.py:83:4: error[invalid-type-form] Function calls are not allowed in type expressions -generics_paramspec_variance.py:83:4: error[missing-argument] No argument provided for required parameter `fn` of `OutitP.__init__` -generics_paramspec_variance.py:85:1: error[invalid-assignment] Object of type `OutitP[(a: int = 1)]` is not assignable to attribute `t` of type `OutitP[(a: int)]` -generics_paramspec_variance.py:87:1: error[invalid-assignment] Object of type `OutitP[(a: int, b: str)]` is not assignable to attribute `t` of type `OutitP[(a: int)]` -generics_paramspec_variance.py:91:15: error[mismatched-type-name] The name passed to `ParamSpec` must match the variable it is assigned to: Expected "P", got "InP" -generics_paramspec_variance.py:93:9: error[invalid-paramspec] A `ParamSpec` cannot be both covariant and contravariant -generics_paramspec_variance.py:94:9: error[invalid-paramspec] A `ParamSpec` cannot specify variance when `infer_variance=True` -generics_paramspec_variance.py:95:9: error[invalid-paramspec] A `ParamSpec` cannot specify variance when `infer_variance=True` -generics_paramspec_variance.py:103:14: error[invalid-assignment] Object of type `InvariantParamSpecOld[(bool, /)]` is not assignable to `InvariantParamSpecOld[(int, /)]` -generics_paramspec_variance.py:104:14: error[invalid-assignment] Object of type `InvariantParamSpecOld[(object, /)]` is not assignable to `InvariantParamSpecOld[(int, /)]` -generics_paramspec_variance.py:114:49: error[invalid-assignment] Object of type `ContravariantParamSpecOld[(int, /)]` is not assignable to `ContravariantParamSpecOld[(object, /)]` -generics_paramspec_variance.py:127:43: error[invalid-assignment] Object of type `CovariantParamSpecOld[(object, /)]` is not assignable to `CovariantParamSpecOld[(int, /)]` +generics_paramspec_variance.py:61:1: error[invalid-assignment] Object of type `InitP[(*, a: int)]` is not assignable to attribute `t` of type `InitP[(a: int)]` +generics_paramspec_variance.py:63:1: error[invalid-assignment] Object of type `InitP[(a: int, /)]` is not assignable to attribute `t` of type `InitP[(a: int)]` +generics_paramspec_variance.py:65:1: error[invalid-assignment] Object of type `InitP[(b: int)]` is not assignable to attribute `t` of type `InitP[(a: int)]` +generics_paramspec_variance.py:69:1: error[invalid-assignment] Object of type `InitP[(a: int, b: str)]` is not assignable to attribute `t` of type `InitP[(a: int)]` +generics_paramspec_variance.py:88:1: error[invalid-assignment] Object of type `OutitP[(b: int)]` is not assignable to attribute `t` of type `OutitP[(a: int)]` +generics_paramspec_variance.py:90:1: error[invalid-assignment] Object of type `OutitP[(a: int = 1)]` is not assignable to attribute `t` of type `OutitP[(a: int)]` +generics_paramspec_variance.py:92:1: error[invalid-assignment] Object of type `OutitP[(a: int, b: str)]` is not assignable to attribute `t` of type `OutitP[(a: int)]` +generics_paramspec_variance.py:100:9: error[invalid-paramspec] A `ParamSpec` cannot be both covariant and contravariant +generics_paramspec_variance.py:101:9: error[invalid-paramspec] A `ParamSpec` cannot specify variance when `infer_variance=True` +generics_paramspec_variance.py:102:9: error[invalid-paramspec] A `ParamSpec` cannot specify variance when `infer_variance=True` +generics_paramspec_variance.py:110:14: error[invalid-assignment] Object of type `InvariantParamSpecOld[(bool, /)]` is not assignable to `InvariantParamSpecOld[(int, /)]` +generics_paramspec_variance.py:111:14: error[invalid-assignment] Object of type `InvariantParamSpecOld[(object, /)]` is not assignable to `InvariantParamSpecOld[(int, /)]` +generics_paramspec_variance.py:121:49: error[invalid-assignment] Object of type `ContravariantParamSpecOld[(int, /)]` is not assignable to `ContravariantParamSpecOld[(object, /)]` +generics_paramspec_variance.py:132:43: error[invalid-assignment] Object of type `CovariantParamSpecOld[(object, /)]` is not assignable to `CovariantParamSpecOld[(int, /)]` +generics_paramspec_variance.py:142:63: error[invalid-assignment] Object of type `InferredContravariantParamSpecOld[(int, /)]` is not assignable to `InferredContravariantParamSpecOld[(object, /)]` +generics_paramspec_variance.py:151:57: error[invalid-assignment] Object of type `InferredCovariantParamSpecOld[(object, /)]` is not assignable to `InferredCovariantParamSpecOld[(int, /)]` """ diff --git a/conformance/results/ty/generics_typevartuple_variance.toml b/conformance/results/ty/generics_typevartuple_variance.toml index ed7025479..a09b5fa8e 100644 --- a/conformance/results/ty/generics_typevartuple_variance.toml +++ b/conformance/results/ty/generics_typevartuple_variance.toml @@ -1,29 +1,35 @@ conformant = "Partial" conformance_automated = "Fail" notes = """ -Does not error when a ParamSpec is used in a position that violates its explicit variance. +Does not error when a TypeVarTuple is used in a position that violates its explicit variance. """ errors_diff = """ -Line 72: Expected 1 errors -Line 83: Expected 1 errors +Line 79: Expected 1 errors +Line 90: Expected 1 errors """ output = """ generics_typevartuple_variance.py:14:45: error[invalid-assignment] Object of type `InvariantTypeVarTuple[int]` is not assignable to `InvariantTypeVarTuple[object]` generics_typevartuple_variance.py:15:42: error[invalid-assignment] Object of type `InvariantTypeVarTuple[object]` is not assignable to `InvariantTypeVarTuple[int]` generics_typevartuple_variance.py:17:64: error[invalid-assignment] Object of type `InvariantTypeVarTuple[*tuple[object, ...]]` is not assignable to `InvariantTypeVarTuple[*tuple[int, ...]]` generics_typevartuple_variance.py:18:70: error[invalid-assignment] Object of type `InvariantTypeVarTuple[*tuple[int, ...]]` is not assignable to `InvariantTypeVarTuple[*tuple[object, ...]]` -generics_typevartuple_variance.py:26:53: error[invalid-assignment] Object of type `ContravariantTypeVarTuple[object, int]` is not assignable to `ContravariantTypeVarTuple[object, object]` -generics_typevartuple_variance.py:29:70: error[invalid-assignment] Object of type `ContravariantTypeVarTuple[*tuple[int, ...]]` is not assignable to `ContravariantTypeVarTuple[*tuple[object, ...]]` -generics_typevartuple_variance.py:38:39: error[invalid-assignment] Object of type `CovariantTypeVarTuple[object]` is not assignable to `CovariantTypeVarTuple[int]` -generics_typevartuple_variance.py:41:50: error[invalid-assignment] Object of type `CovariantTypeVarTuple[bool, object]` is not assignable to `CovariantTypeVarTuple[int, int]` -generics_typevartuple_variance.py:42:50: error[invalid-assignment] Object of type `CovariantTypeVarTuple[object, bool]` is not assignable to `CovariantTypeVarTuple[int, int]` -generics_typevartuple_variance.py:43:50: error[invalid-assignment] Object of type `CovariantTypeVarTuple[object, object]` is not assignable to `CovariantTypeVarTuple[int, int]` -generics_typevartuple_variance.py:44:61: error[invalid-assignment] Object of type `CovariantTypeVarTuple[*tuple[object, ...]]` is not assignable to `CovariantTypeVarTuple[*tuple[int, ...]]` -generics_typevartuple_variance.py:49:10: error[invalid-legacy-type-variable] A `TypeVarTuple` cannot be both covariant and contravariant -generics_typevartuple_variance.py:50:10: error[invalid-legacy-type-variable] A `TypeVarTuple` cannot specify variance when `infer_variance=True` -generics_typevartuple_variance.py:51:10: error[invalid-legacy-type-variable] A `TypeVarTuple` cannot specify variance when `infer_variance=True` -generics_typevartuple_variance.py:61:45: error[invalid-assignment] Object of type `InvariantTypeVarTupleOld[int]` is not assignable to `InvariantTypeVarTupleOld[object]` -generics_typevartuple_variance.py:62:42: error[invalid-assignment] Object of type `InvariantTypeVarTupleOld[object]` is not assignable to `InvariantTypeVarTupleOld[int]` -generics_typevartuple_variance.py:76:52: error[invalid-assignment] Object of type `ContravariantTypeVarTupleOld[int]` is not assignable to `ContravariantTypeVarTupleOld[object]` -generics_typevartuple_variance.py:90:46: error[invalid-assignment] Object of type `CovariantTypeVarTupleOld[object]` is not assignable to `CovariantTypeVarTupleOld[int]` +generics_typevartuple_variance.py:20:58: error[invalid-assignment] Object of type `InvariantTypeVarTuple[*tuple[int, ...]]` is not assignable to `InvariantTypeVarTuple[int]` +generics_typevartuple_variance.py:21:71: error[invalid-assignment] Object of type `InvariantTypeVarTuple[int]` is not assignable to `InvariantTypeVarTuple[*tuple[int, ...]]` +generics_typevartuple_variance.py:28:53: error[invalid-assignment] Object of type `ContravariantTypeVarTuple[object, int]` is not assignable to `ContravariantTypeVarTuple[object, object]` +generics_typevartuple_variance.py:31:70: error[invalid-assignment] Object of type `ContravariantTypeVarTuple[*tuple[int, ...]]` is not assignable to `ContravariantTypeVarTuple[*tuple[object, ...]]` +generics_typevartuple_variance.py:34:71: error[invalid-assignment] Object of type `ContravariantTypeVarTuple[int]` is not assignable to `ContravariantTypeVarTuple[*tuple[int, ...]]` +generics_typevartuple_variance.py:42:39: error[invalid-assignment] Object of type `CovariantTypeVarTuple[object]` is not assignable to `CovariantTypeVarTuple[int]` +generics_typevartuple_variance.py:45:50: error[invalid-assignment] Object of type `CovariantTypeVarTuple[bool, object]` is not assignable to `CovariantTypeVarTuple[int, int]` +generics_typevartuple_variance.py:46:50: error[invalid-assignment] Object of type `CovariantTypeVarTuple[object, bool]` is not assignable to `CovariantTypeVarTuple[int, int]` +generics_typevartuple_variance.py:47:50: error[invalid-assignment] Object of type `CovariantTypeVarTuple[object, object]` is not assignable to `CovariantTypeVarTuple[int, int]` +generics_typevartuple_variance.py:48:61: error[invalid-assignment] Object of type `CovariantTypeVarTuple[*tuple[object, ...]]` is not assignable to `CovariantTypeVarTuple[*tuple[int, ...]]` +generics_typevartuple_variance.py:51:55: error[invalid-assignment] Object of type `CovariantTypeVarTuple[*tuple[int, ...]]` is not assignable to `CovariantTypeVarTuple[int]` +generics_typevartuple_variance.py:56:10: error[invalid-legacy-type-variable] A `TypeVarTuple` cannot be both covariant and contravariant +generics_typevartuple_variance.py:57:10: error[invalid-legacy-type-variable] A `TypeVarTuple` cannot specify variance when `infer_variance=True` +generics_typevartuple_variance.py:58:10: error[invalid-legacy-type-variable] A `TypeVarTuple` cannot specify variance when `infer_variance=True` +generics_typevartuple_variance.py:68:45: error[invalid-assignment] Object of type `InvariantTypeVarTupleOld[int]` is not assignable to `InvariantTypeVarTupleOld[object]` +generics_typevartuple_variance.py:69:42: error[invalid-assignment] Object of type `InvariantTypeVarTupleOld[object]` is not assignable to `InvariantTypeVarTupleOld[int]` +generics_typevartuple_variance.py:83:52: error[invalid-assignment] Object of type `ContravariantTypeVarTupleOld[int]` is not assignable to `ContravariantTypeVarTupleOld[object]` +generics_typevartuple_variance.py:97:46: error[invalid-assignment] Object of type `CovariantTypeVarTupleOld[object]` is not assignable to `CovariantTypeVarTupleOld[int]` +generics_typevartuple_variance.py:107:66: error[invalid-assignment] Object of type `InferredContravariantTypeVarTupleOld[int]` is not assignable to `InferredContravariantTypeVarTupleOld[object]` +generics_typevartuple_variance.py:116:60: error[invalid-assignment] Object of type `InferredCovariantTypeVarTupleOld[object]` is not assignable to `InferredCovariantTypeVarTupleOld[int]` """ diff --git a/conformance/results/zuban/generics_paramspec_variance.toml b/conformance/results/zuban/generics_paramspec_variance.toml index 3d524f697..9cf305fb1 100644 --- a/conformance/results/zuban/generics_paramspec_variance.toml +++ b/conformance/results/zuban/generics_paramspec_variance.toml @@ -3,44 +3,45 @@ conformance_automated = "Fail" errors_diff = """ Line 15: Expected 1 errors Line 30: Expected 1 errors -Line 64: Expected 1 errors -Line 104: Expected 1 errors -Line 110: Expected 1 errors -Line 121: Expected 1 errors -Line 127: Expected 1 errors +Line 90: Expected 1 errors +Line 111: Expected 1 errors +Line 117: Expected 1 errors +Line 126: Expected 1 errors +Line 132: Expected 1 errors +Line 151: Expected 1 errors 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]'] -Line 58: Unexpected errors ['generics_paramspec_variance.py:58: error: Incompatible types in assignment (expression has type "InitP[[*, a: int]]", variable has type "InitP[[a: int]]") [assignment]'] -Line 60: Unexpected errors ['generics_paramspec_variance.py:60: error: Incompatible types in assignment (expression has type "InitP[[int]]", variable has type "InitP[[a: int]]") [assignment]'] -Line 83: Unexpected errors ['generics_paramspec_variance.py:83: error: Invalid type comment or annotation [valid-type]'] -Line 91: Unexpected errors ['generics_paramspec_variance.py:91: error: String argument 1 "InP" to ParamSpec(...) does not match variable name "P" [misc]'] -Line 92: Unexpected errors ['generics_paramspec_variance.py:92: error: The variance and bound arguments to ParamSpec do not have defined semantics yet [misc]'] -Line 117: Unexpected errors ['generics_paramspec_variance.py:117: error: The variance and bound arguments to ParamSpec do not have defined semantics yet [misc]'] -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]'] +Line 84: Unexpected errors ['generics_paramspec_variance.py:84: error: Incompatible types in assignment (expression has type "OutitP[[*, a: int]]", variable has type "OutitP[[a: int]]") [assignment]'] +Line 86: Unexpected errors ['generics_paramspec_variance.py:86: error: Incompatible types in assignment (expression has type "OutitP[[int]]", variable has type "OutitP[[a: int]]") [assignment]'] +Line 97: Unexpected errors ['generics_paramspec_variance.py:97: error: The variance and bound arguments to ParamSpec do not have defined semantics yet [misc]'] +Line 98: Unexpected errors ['generics_paramspec_variance.py:98: error: The variance and bound arguments to ParamSpec do not have defined semantics yet [misc]'] +Line 99: Unexpected errors ['generics_paramspec_variance.py:99: error: Unexpected argument to "ParamSpec()" [misc]'] +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]'] +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]'] """ output = """ generics_paramspec_variance.py:14: error: Incompatible types in assignment (expression has type "InvariantParamSpec[[int]]", variable has type "InvariantParamSpec[[object]]") [assignment] generics_paramspec_variance.py:21: error: Incompatible types in assignment (expression has type "ContravariantParamSpec[[int]]", variable has type "ContravariantParamSpec[[object]]") [assignment] generics_paramspec_variance.py:31: error: Incompatible types in assignment (expression has type "CovariantParamSpec[[int]]", variable has type "CovariantParamSpec[[object]]") [assignment] -generics_paramspec_variance.py:58: error: Incompatible types in assignment (expression has type "InitP[[*, a: int]]", variable has type "InitP[[a: int]]") [assignment] -generics_paramspec_variance.py:60: error: Incompatible types in assignment (expression has type "InitP[[int]]", variable has type "InitP[[a: int]]") [assignment] -generics_paramspec_variance.py:62: error: Invalid type comment or annotation [valid-type] -generics_paramspec_variance.py:66: error: Incompatible types in assignment (expression has type "InitP[[a: int, b: str]]", variable has type "InitP[[a: int]]") [assignment] -generics_paramspec_variance.py:79: error: Incompatible types in assignment (expression has type "OutitP[[*, a: int]]", variable has type "OutitP[[a: int]]") [assignment] -generics_paramspec_variance.py:81: error: Incompatible types in assignment (expression has type "OutitP[[int]]", variable has type "OutitP[[a: int]]") [assignment] -generics_paramspec_variance.py:83: error: Invalid type comment or annotation [valid-type] -generics_paramspec_variance.py:87: error: Incompatible types in assignment (expression has type "OutitP[[a: int, b: str]]", variable has type "OutitP[[a: int]]") [assignment] -generics_paramspec_variance.py:91: error: String argument 1 "InP" to ParamSpec(...) does not match variable name "P" [misc] -generics_paramspec_variance.py:92: error: The variance and bound arguments to ParamSpec do not have defined semantics yet [misc] -generics_paramspec_variance.py:93: error: The variance and bound arguments to ParamSpec do not have defined semantics yet [misc] -generics_paramspec_variance.py:93: error: The variance and bound arguments to ParamSpec do not have defined semantics yet [misc] -generics_paramspec_variance.py:94: error: String argument 1 "InvP1" to ParamSpec(...) does not match variable name "InvP2" [misc] -generics_paramspec_variance.py:94: error: The variance and bound arguments to ParamSpec do not have defined semantics yet [misc] -generics_paramspec_variance.py:94: error: Unexpected argument to "ParamSpec()" [misc] -generics_paramspec_variance.py:95: error: String argument 1 "InvP1" to ParamSpec(...) does not match variable name "InvP3" [misc] -generics_paramspec_variance.py:95: error: The variance and bound arguments to ParamSpec do not have defined semantics yet [misc] -generics_paramspec_variance.py:95: error: Unexpected argument to "ParamSpec()" [misc] -generics_paramspec_variance.py:103: error: Incompatible types in assignment (expression has type "InvariantParamSpecOld[[bool]]", variable has type "InvariantParamSpecOld[[int]]") [assignment] -generics_paramspec_variance.py:114: error: Incompatible types in assignment (expression has type "ContravariantParamSpecOld[[int]]", variable has type "ContravariantParamSpecOld[[object]]") [assignment] -generics_paramspec_variance.py:117: error: The variance and bound arguments to ParamSpec do not have defined semantics yet [misc] -generics_paramspec_variance.py:128: error: Incompatible types in assignment (expression has type "CovariantParamSpecOld[[int]]", variable has type "CovariantParamSpecOld[[object]]") [assignment] +generics_paramspec_variance.py:61: error: Incompatible types in assignment (expression has type "InitP[[*, a: int]]", variable has type "InitP[[a: int]]") [assignment] +generics_paramspec_variance.py:63: error: Incompatible types in assignment (expression has type "InitP[[int]]", variable has type "InitP[[a: int]]") [assignment] +generics_paramspec_variance.py:65: error: Incompatible types in assignment (expression has type "InitP[[b: int]]", variable has type "InitP[[a: int]]") [assignment] +generics_paramspec_variance.py:69: error: Incompatible types in assignment (expression has type "InitP[[a: int, b: str]]", variable has type "InitP[[a: int]]") [assignment] +generics_paramspec_variance.py:84: error: Incompatible types in assignment (expression has type "OutitP[[*, a: int]]", variable has type "OutitP[[a: int]]") [assignment] +generics_paramspec_variance.py:86: error: Incompatible types in assignment (expression has type "OutitP[[int]]", variable has type "OutitP[[a: int]]") [assignment] +generics_paramspec_variance.py:88: error: Incompatible types in assignment (expression has type "OutitP[[b: int]]", variable has type "OutitP[[a: int]]") [assignment] +generics_paramspec_variance.py:92: error: Incompatible types in assignment (expression has type "OutitP[[a: int, b: str]]", variable has type "OutitP[[a: int]]") [assignment] +generics_paramspec_variance.py:97: error: The variance and bound arguments to ParamSpec do not have defined semantics yet [misc] +generics_paramspec_variance.py:98: error: The variance and bound arguments to ParamSpec do not have defined semantics yet [misc] +generics_paramspec_variance.py:99: error: Unexpected argument to "ParamSpec()" [misc] +generics_paramspec_variance.py:100: error: The variance and bound arguments to ParamSpec do not have defined semantics yet [misc] +generics_paramspec_variance.py:100: error: The variance and bound arguments to ParamSpec do not have defined semantics yet [misc] +generics_paramspec_variance.py:101: error: The variance and bound arguments to ParamSpec do not have defined semantics yet [misc] +generics_paramspec_variance.py:101: error: Unexpected argument to "ParamSpec()" [misc] +generics_paramspec_variance.py:102: error: The variance and bound arguments to ParamSpec do not have defined semantics yet [misc] +generics_paramspec_variance.py:102: error: Unexpected argument to "ParamSpec()" [misc] +generics_paramspec_variance.py:110: error: Incompatible types in assignment (expression has type "InvariantParamSpecOld[[bool]]", variable has type "InvariantParamSpecOld[[int]]") [assignment] +generics_paramspec_variance.py:121: error: Incompatible types in assignment (expression has type "ContravariantParamSpecOld[[int]]", variable has type "ContravariantParamSpecOld[[object]]") [assignment] +generics_paramspec_variance.py:133: error: Incompatible types in assignment (expression has type "CovariantParamSpecOld[[int]]", variable has type "CovariantParamSpecOld[[object]]") [assignment] +generics_paramspec_variance.py:142: error: Incompatible types in assignment (expression has type "InferredContravariantParamSpecOld[[int]]", variable has type "InferredContravariantParamSpecOld[[object]]") [assignment] +generics_paramspec_variance.py:152: error: Incompatible types in assignment (expression has type "InferredCovariantParamSpecOld[[int]]", variable has type "InferredCovariantParamSpecOld[[object]]") [assignment] """ diff --git a/conformance/results/zuban/generics_typevartuple_variance.toml b/conformance/results/zuban/generics_typevartuple_variance.toml index b3127ff2b..c4092867e 100644 --- a/conformance/results/zuban/generics_typevartuple_variance.toml +++ b/conformance/results/zuban/generics_typevartuple_variance.toml @@ -1,47 +1,63 @@ conformant = "Unsupported" conformance_automated = "Fail" errors_diff = """ -Line 72: Expected 1 errors -Line 83: Expected 1 errors -Line 27: Unexpected errors ['generics_typevartuple_variance.py:27: error: Incompatible types in assignment (expression has type "ContravariantTypeVarTuple[object]", variable has type "ContravariantTypeVarTuple[int]") [assignment]'] -Line 28: Unexpected errors ['generics_typevartuple_variance.py:28: error: Incompatible types in assignment (expression has type "ContravariantTypeVarTuple[Unpack[Tuple[object, ...]]]", variable has type "ContravariantTypeVarTuple[Unpack[Tuple[int, ...]]]") [assignment]'] -Line 39: Unexpected errors ['generics_typevartuple_variance.py:39: error: Incompatible types in assignment (expression has type "CovariantTypeVarTuple[int]", variable has type "CovariantTypeVarTuple[object]") [assignment]'] -Line 40: Unexpected errors ['generics_typevartuple_variance.py:40: error: Incompatible types in assignment (expression has type "CovariantTypeVarTuple[bool, bool]", variable has type "CovariantTypeVarTuple[int, int]") [assignment]'] -Line 45: Unexpected errors ['generics_typevartuple_variance.py:45: error: Incompatible types in assignment (expression has type "CovariantTypeVarTuple[Unpack[Tuple[int, ...]]]", variable has type "CovariantTypeVarTuple[Unpack[Tuple[object, ...]]]") [assignment]'] -Line 66: Unexpected errors ['generics_typevartuple_variance.py:66: error: Unexpected keyword argument "contravariant" for "TypeVarTuple" [call-arg]'] -Line 77: Unexpected errors ['generics_typevartuple_variance.py:77: error: Incompatible types in assignment (expression has type "ContravariantTypeVarTupleOld[object]", variable has type "ContravariantTypeVarTupleOld[int]") [assignment]'] -Line 80: Unexpected errors ['generics_typevartuple_variance.py:80: error: Unexpected keyword argument "covariant" for "TypeVarTuple" [call-arg]'] -Line 91: Unexpected errors ['generics_typevartuple_variance.py:91: error: Incompatible types in assignment (expression has type "CovariantTypeVarTupleOld[int]", variable has type "CovariantTypeVarTupleOld[object]") [assignment]'] +Line 79: Expected 1 errors +Line 90: Expected 1 errors +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]'] +Line 30: Unexpected errors ['generics_typevartuple_variance.py:30: error: Incompatible types in assignment (expression has type "ContravariantTypeVarTuple[Unpack[Tuple[object, ...]]]", variable has type "ContravariantTypeVarTuple[Unpack[Tuple[int, ...]]]") [assignment]'] +Line 33: Unexpected errors ['generics_typevartuple_variance.py:33: error: Incompatible types in assignment (expression has type "ContravariantTypeVarTuple[Unpack[Tuple[int, ...]]]", variable has type "ContravariantTypeVarTuple[int]") [assignment]'] +Line 43: Unexpected errors ['generics_typevartuple_variance.py:43: error: Incompatible types in assignment (expression has type "CovariantTypeVarTuple[int]", variable has type "CovariantTypeVarTuple[object]") [assignment]'] +Line 44: Unexpected errors ['generics_typevartuple_variance.py:44: error: Incompatible types in assignment (expression has type "CovariantTypeVarTuple[bool, bool]", variable has type "CovariantTypeVarTuple[int, int]") [assignment]'] +Line 49: Unexpected errors ['generics_typevartuple_variance.py:49: error: Incompatible types in assignment (expression has type "CovariantTypeVarTuple[Unpack[Tuple[int, ...]]]", variable has type "CovariantTypeVarTuple[Unpack[Tuple[object, ...]]]") [assignment]'] +Line 52: Unexpected errors ['generics_typevartuple_variance.py:52: error: Incompatible types in assignment (expression has type "CovariantTypeVarTuple[int]", variable has type "CovariantTypeVarTuple[Unpack[Tuple[int, ...]]]") [assignment]'] +Line 55: Unexpected errors ['generics_typevartuple_variance.py:55: error: Unexpected keyword argument "infer_variance" for "TypeVarTuple" [call-arg]'] +Line 73: Unexpected errors ['generics_typevartuple_variance.py:73: error: Unexpected keyword argument "contravariant" for "TypeVarTuple" [call-arg]'] +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]'] +Line 87: Unexpected errors ['generics_typevartuple_variance.py:87: error: Unexpected keyword argument "covariant" for "TypeVarTuple" [call-arg]'] +Line 98: Unexpected errors ['generics_typevartuple_variance.py:98: error: Incompatible types in assignment (expression has type "CovariantTypeVarTupleOld[int]", variable has type "CovariantTypeVarTupleOld[object]") [assignment]'] +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]'] +Line 117: Unexpected errors ['generics_typevartuple_variance.py:117: error: Incompatible types in assignment (expression has type "InferredCovariantTypeVarTupleOld[int]", variable has type "InferredCovariantTypeVarTupleOld[object]") [assignment]'] """ output = """ generics_typevartuple_variance.py:14: error: Incompatible types in assignment (expression has type "InvariantTypeVarTuple[int]", variable has type "InvariantTypeVarTuple[object]") [assignment] generics_typevartuple_variance.py:15: error: Incompatible types in assignment (expression has type "InvariantTypeVarTuple[object]", variable has type "InvariantTypeVarTuple[int]") [assignment] generics_typevartuple_variance.py:17: error: Incompatible types in assignment (expression has type "InvariantTypeVarTuple[Unpack[Tuple[object, ...]]]", variable has type "InvariantTypeVarTuple[Unpack[Tuple[int, ...]]]") [assignment] generics_typevartuple_variance.py:18: error: Incompatible types in assignment (expression has type "InvariantTypeVarTuple[Unpack[Tuple[int, ...]]]", variable has type "InvariantTypeVarTuple[Unpack[Tuple[object, ...]]]") [assignment] -generics_typevartuple_variance.py:26: error: Incompatible types in assignment (expression has type "ContravariantTypeVarTuple[object, int]", variable has type "ContravariantTypeVarTuple[object, object]") [assignment] -generics_typevartuple_variance.py:27: error: Incompatible types in assignment (expression has type "ContravariantTypeVarTuple[object]", variable has type "ContravariantTypeVarTuple[int]") [assignment] -generics_typevartuple_variance.py:28: error: Incompatible types in assignment (expression has type "ContravariantTypeVarTuple[Unpack[Tuple[object, ...]]]", variable has type "ContravariantTypeVarTuple[Unpack[Tuple[int, ...]]]") [assignment] -generics_typevartuple_variance.py:29: error: Incompatible types in assignment (expression has type "ContravariantTypeVarTuple[Unpack[Tuple[int, ...]]]", variable has type "ContravariantTypeVarTuple[Unpack[Tuple[object, ...]]]") [assignment] -generics_typevartuple_variance.py:38: error: Incompatible types in assignment (expression has type "CovariantTypeVarTuple[object]", variable has type "CovariantTypeVarTuple[int]") [assignment] -generics_typevartuple_variance.py:39: error: Incompatible types in assignment (expression has type "CovariantTypeVarTuple[int]", variable has type "CovariantTypeVarTuple[object]") [assignment] -generics_typevartuple_variance.py:40: error: Incompatible types in assignment (expression has type "CovariantTypeVarTuple[bool, bool]", variable has type "CovariantTypeVarTuple[int, int]") [assignment] -generics_typevartuple_variance.py:41: error: Incompatible types in assignment (expression has type "CovariantTypeVarTuple[bool, object]", variable has type "CovariantTypeVarTuple[int, int]") [assignment] -generics_typevartuple_variance.py:42: error: Incompatible types in assignment (expression has type "CovariantTypeVarTuple[object, bool]", variable has type "CovariantTypeVarTuple[int, int]") [assignment] -generics_typevartuple_variance.py:43: error: Incompatible types in assignment (expression has type "CovariantTypeVarTuple[object, object]", variable has type "CovariantTypeVarTuple[int, int]") [assignment] -generics_typevartuple_variance.py:44: error: Incompatible types in assignment (expression has type "CovariantTypeVarTuple[Unpack[Tuple[object, ...]]]", variable has type "CovariantTypeVarTuple[Unpack[Tuple[int, ...]]]") [assignment] -generics_typevartuple_variance.py:45: error: Incompatible types in assignment (expression has type "CovariantTypeVarTuple[Unpack[Tuple[int, ...]]]", variable has type "CovariantTypeVarTuple[Unpack[Tuple[object, ...]]]") [assignment] -generics_typevartuple_variance.py:49: error: Unexpected keyword argument "covariant" for "TypeVarTuple" [call-arg] -generics_typevartuple_variance.py:49: error: Unexpected keyword argument "contravariant" for "TypeVarTuple" [call-arg] -generics_typevartuple_variance.py:50: error: Unexpected keyword argument "covariant" for "TypeVarTuple" [call-arg] -generics_typevartuple_variance.py:50: error: Unexpected keyword argument "infer_variance" for "TypeVarTuple" [call-arg] -generics_typevartuple_variance.py:51: error: Unexpected keyword argument "covariant" for "TypeVarTuple" [call-arg] -generics_typevartuple_variance.py:51: error: Unexpected keyword argument "infer_variance" for "TypeVarTuple" [call-arg] -generics_typevartuple_variance.py:61: error: Incompatible types in assignment (expression has type "InvariantTypeVarTupleOld[int]", variable has type "InvariantTypeVarTupleOld[object]") [assignment] -generics_typevartuple_variance.py:62: error: Incompatible types in assignment (expression has type "InvariantTypeVarTupleOld[object]", variable has type "InvariantTypeVarTupleOld[int]") [assignment] -generics_typevartuple_variance.py:66: error: Unexpected keyword argument "contravariant" for "TypeVarTuple" [call-arg] -generics_typevartuple_variance.py:76: error: Incompatible types in assignment (expression has type "ContravariantTypeVarTupleOld[int]", variable has type "ContravariantTypeVarTupleOld[object]") [assignment] -generics_typevartuple_variance.py:77: error: Incompatible types in assignment (expression has type "ContravariantTypeVarTupleOld[object]", variable has type "ContravariantTypeVarTupleOld[int]") [assignment] -generics_typevartuple_variance.py:80: error: Unexpected keyword argument "covariant" for "TypeVarTuple" [call-arg] -generics_typevartuple_variance.py:90: error: Incompatible types in assignment (expression has type "CovariantTypeVarTupleOld[object]", variable has type "CovariantTypeVarTupleOld[int]") [assignment] -generics_typevartuple_variance.py:91: error: Incompatible types in assignment (expression has type "CovariantTypeVarTupleOld[int]", variable has type "CovariantTypeVarTupleOld[object]") [assignment] +generics_typevartuple_variance.py:20: error: Incompatible types in assignment (expression has type "InvariantTypeVarTuple[Unpack[Tuple[int, ...]]]", variable has type "InvariantTypeVarTuple[int]") [assignment] +generics_typevartuple_variance.py:21: error: Incompatible types in assignment (expression has type "InvariantTypeVarTuple[int]", variable has type "InvariantTypeVarTuple[Unpack[Tuple[int, ...]]]") [assignment] +generics_typevartuple_variance.py:28: error: Incompatible types in assignment (expression has type "ContravariantTypeVarTuple[object, int]", variable has type "ContravariantTypeVarTuple[object, object]") [assignment] +generics_typevartuple_variance.py:29: error: Incompatible types in assignment (expression has type "ContravariantTypeVarTuple[object]", variable has type "ContravariantTypeVarTuple[int]") [assignment] +generics_typevartuple_variance.py:30: error: Incompatible types in assignment (expression has type "ContravariantTypeVarTuple[Unpack[Tuple[object, ...]]]", variable has type "ContravariantTypeVarTuple[Unpack[Tuple[int, ...]]]") [assignment] +generics_typevartuple_variance.py:31: error: Incompatible types in assignment (expression has type "ContravariantTypeVarTuple[Unpack[Tuple[int, ...]]]", variable has type "ContravariantTypeVarTuple[Unpack[Tuple[object, ...]]]") [assignment] +generics_typevartuple_variance.py:33: error: Incompatible types in assignment (expression has type "ContravariantTypeVarTuple[Unpack[Tuple[int, ...]]]", variable has type "ContravariantTypeVarTuple[int]") [assignment] +generics_typevartuple_variance.py:34: error: Incompatible types in assignment (expression has type "ContravariantTypeVarTuple[int]", variable has type "ContravariantTypeVarTuple[Unpack[Tuple[int, ...]]]") [assignment] +generics_typevartuple_variance.py:42: error: Incompatible types in assignment (expression has type "CovariantTypeVarTuple[object]", variable has type "CovariantTypeVarTuple[int]") [assignment] +generics_typevartuple_variance.py:43: error: Incompatible types in assignment (expression has type "CovariantTypeVarTuple[int]", variable has type "CovariantTypeVarTuple[object]") [assignment] +generics_typevartuple_variance.py:44: error: Incompatible types in assignment (expression has type "CovariantTypeVarTuple[bool, bool]", variable has type "CovariantTypeVarTuple[int, int]") [assignment] +generics_typevartuple_variance.py:45: error: Incompatible types in assignment (expression has type "CovariantTypeVarTuple[bool, object]", variable has type "CovariantTypeVarTuple[int, int]") [assignment] +generics_typevartuple_variance.py:46: error: Incompatible types in assignment (expression has type "CovariantTypeVarTuple[object, bool]", variable has type "CovariantTypeVarTuple[int, int]") [assignment] +generics_typevartuple_variance.py:47: error: Incompatible types in assignment (expression has type "CovariantTypeVarTuple[object, object]", variable has type "CovariantTypeVarTuple[int, int]") [assignment] +generics_typevartuple_variance.py:48: error: Incompatible types in assignment (expression has type "CovariantTypeVarTuple[Unpack[Tuple[object, ...]]]", variable has type "CovariantTypeVarTuple[Unpack[Tuple[int, ...]]]") [assignment] +generics_typevartuple_variance.py:49: error: Incompatible types in assignment (expression has type "CovariantTypeVarTuple[Unpack[Tuple[int, ...]]]", variable has type "CovariantTypeVarTuple[Unpack[Tuple[object, ...]]]") [assignment] +generics_typevartuple_variance.py:51: error: Incompatible types in assignment (expression has type "CovariantTypeVarTuple[Unpack[Tuple[int, ...]]]", variable has type "CovariantTypeVarTuple[int]") [assignment] +generics_typevartuple_variance.py:52: error: Incompatible types in assignment (expression has type "CovariantTypeVarTuple[int]", variable has type "CovariantTypeVarTuple[Unpack[Tuple[int, ...]]]") [assignment] +generics_typevartuple_variance.py:55: error: Unexpected keyword argument "infer_variance" for "TypeVarTuple" [call-arg] +generics_typevartuple_variance.py:56: error: Unexpected keyword argument "covariant" for "TypeVarTuple" [call-arg] +generics_typevartuple_variance.py:56: error: Unexpected keyword argument "contravariant" for "TypeVarTuple" [call-arg] +generics_typevartuple_variance.py:57: error: Unexpected keyword argument "covariant" for "TypeVarTuple" [call-arg] +generics_typevartuple_variance.py:57: error: Unexpected keyword argument "infer_variance" for "TypeVarTuple" [call-arg] +generics_typevartuple_variance.py:58: error: Unexpected keyword argument "contravariant" for "TypeVarTuple" [call-arg] +generics_typevartuple_variance.py:58: error: Unexpected keyword argument "infer_variance" for "TypeVarTuple" [call-arg] +generics_typevartuple_variance.py:68: error: Incompatible types in assignment (expression has type "InvariantTypeVarTupleOld[int]", variable has type "InvariantTypeVarTupleOld[object]") [assignment] +generics_typevartuple_variance.py:69: error: Incompatible types in assignment (expression has type "InvariantTypeVarTupleOld[object]", variable has type "InvariantTypeVarTupleOld[int]") [assignment] +generics_typevartuple_variance.py:73: error: Unexpected keyword argument "contravariant" for "TypeVarTuple" [call-arg] +generics_typevartuple_variance.py:83: error: Incompatible types in assignment (expression has type "ContravariantTypeVarTupleOld[int]", variable has type "ContravariantTypeVarTupleOld[object]") [assignment] +generics_typevartuple_variance.py:84: error: Incompatible types in assignment (expression has type "ContravariantTypeVarTupleOld[object]", variable has type "ContravariantTypeVarTupleOld[int]") [assignment] +generics_typevartuple_variance.py:87: error: Unexpected keyword argument "covariant" for "TypeVarTuple" [call-arg] +generics_typevartuple_variance.py:97: error: Incompatible types in assignment (expression has type "CovariantTypeVarTupleOld[object]", variable has type "CovariantTypeVarTupleOld[int]") [assignment] +generics_typevartuple_variance.py:98: error: Incompatible types in assignment (expression has type "CovariantTypeVarTupleOld[int]", variable has type "CovariantTypeVarTupleOld[object]") [assignment] +generics_typevartuple_variance.py:107: error: Incompatible types in assignment (expression has type "InferredContravariantTypeVarTupleOld[int]", variable has type "InferredContravariantTypeVarTupleOld[object]") [assignment] +generics_typevartuple_variance.py:108: error: Incompatible types in assignment (expression has type "InferredContravariantTypeVarTupleOld[object]", variable has type "InferredContravariantTypeVarTupleOld[int]") [assignment] +generics_typevartuple_variance.py:116: error: Incompatible types in assignment (expression has type "InferredCovariantTypeVarTupleOld[object]", variable has type "InferredCovariantTypeVarTupleOld[int]") [assignment] +generics_typevartuple_variance.py:117: error: Incompatible types in assignment (expression has type "InferredCovariantTypeVarTupleOld[int]", variable has type "InferredCovariantTypeVarTupleOld[object]") [assignment] """ diff --git a/conformance/results/zuban/protocols_variance.toml b/conformance/results/zuban/protocols_variance.toml index f6d041024..5aac24487 100644 --- a/conformance/results/zuban/protocols_variance.toml +++ b/conformance/results/zuban/protocols_variance.toml @@ -1,7 +1,7 @@ conformant = "Partial" conformance_automated = "Fail" notes = """ -Doesn't support keyword arguments to ParamSpec. +False report of ParamSpec variance keywords. """ errors_diff = """ Line 15: Unexpected errors ['protocols_variance.py:15: error: The variance and bound arguments to ParamSpec do not have defined semantics yet [misc]'] diff --git a/conformance/tests/generics_paramspec_variance.py b/conformance/tests/generics_paramspec_variance.py index b3da777bb..5aa017bb8 100644 --- a/conformance/tests/generics_paramspec_variance.py +++ b/conformance/tests/generics_paramspec_variance.py @@ -40,6 +40,7 @@ def __init__(self, t: T): ... def f(a: int): ... def kw(*, a: int): ... def pos(a: int, /): ... +def names(b: int): ... def default(a: int = 1): ... def arity(a: int, b: str): ... @@ -52,18 +53,20 @@ def usage(self) -> Callable[P, None]: raise NotImplementedError -box = Box(InitP(f)) +# `InitP` produces a `Callable[P, None]`, so a replacement is only safe if it +# accepts every call form that `InitP[(a: int)]` accepts. +in_box = Box(InitP(f)) -kw_p = InitP(kw) -box.t = kw_p # OK -pos_p = InitP(pos) -box.t = pos_p # OK -names_p = InitP(f) -_: InitP[int]() = names_p # E -default_p = InitP(default) -box.t = default_p # E -arity_p = InitP(arity) -box.t = arity_p # E +in_kw_p = InitP(kw) +in_box.t = in_kw_p # E +in_pos_p = InitP(pos) +in_box.t = in_pos_p # E +in_names_p = InitP(names) +in_box.t = in_names_p # E +in_default_p = InitP(default) +in_box.t = in_default_p # OK +in_arity_p = InitP(arity) +in_box.t = in_arity_p # E class OutitP[**P]: # covariant @@ -73,29 +76,33 @@ def usage(self, fn: Callable[P, None]): """infer covariance""" -box = Box(OutitP(f)) +# `OutitP` consumes a `Callable[P, None]`, so the safe direction is reversed: a +# replacement is only safe if `Callable[(a: int), None]` can be passed to it. +out_box = Box(OutitP(f)) -kw_p = OutitP(kw) -box.t = kw_p # E -pos_p = OutitP(pos) -box.t = pos_p # E -names_p = OutitP(f) -_: OutitP[int]() = names_p # OK -default_p = OutitP(default) -box.t = default_p # OK -arity_p = OutitP(arity) -box.t = arity_p # E +out_kw_p = OutitP(kw) +out_box.t = out_kw_p # OK +out_pos_p = OutitP(pos) +out_box.t = out_pos_p # OK +out_names_p = OutitP(names) +out_box.t = out_names_p # E +out_default_p = OutitP(default) +out_box.t = out_default_p # E +out_arity_p = OutitP(arity) +out_box.t = out_arity_p # E # old style -P = ParamSpec("InP") # OK +P = ParamSpec("P") # OK InP = ParamSpec("InP", contravariant=True) # OK +OutP = ParamSpec("OutP", covariant=True) # OK +InferP = ParamSpec("InferP", infer_variance=True) # OK InvP1 = ParamSpec("InvP1", covariant=True, contravariant=True) # E -InvP2 = ParamSpec("InvP1", covariant=True, infer_variance=True) # E -InvP3 = ParamSpec("InvP1", contravariant=True, infer_variance=True) # E +InvP2 = ParamSpec("InvP2", covariant=True, infer_variance=True) # E +InvP3 = ParamSpec("InvP3", contravariant=True, infer_variance=True) # E class InvariantParamSpecOld(Generic[P]): - def f(self, fn: Callable[InP, None]) -> Callable[InP, None]: # OK + def f(self, fn: Callable[P, None]) -> Callable[P, None]: # OK raise NotImplementedError in_out_old: InvariantParamSpecOld[int] @@ -114,8 +121,6 @@ def out_f(self, fn: Callable[InP, None]) -> None: # E in_obj_old: ContravariantParamSpecOld[object] = ContravariantParamSpecOld[int]() # E in_int_old: ContravariantParamSpecOld[int] = ContravariantParamSpecOld[object]() # OK -OutP = ParamSpec("OutP", covariant=True) - class CovariantParamSpecOld(Generic[OutP]): def in_f(self) -> Callable[OutP, None]: # E @@ -126,3 +131,22 @@ def out_f(self, fn: Callable[OutP, None]) -> None: # OK out_int_old: CovariantParamSpecOld[int] = CovariantParamSpecOld[object]() # E out_obj_old: CovariantParamSpecOld[object] = CovariantParamSpecOld[int]() # OK + + +# `infer_variance=True` on a traditional `ParamSpec` +class InferredContravariantParamSpecOld(Generic[InferP]): + def in_f(self) -> Callable[InferP, None]: # OK + raise NotImplementedError + + +infer_in_obj_old: InferredContravariantParamSpecOld[object] = InferredContravariantParamSpecOld[int]() # E +infer_in_int_old: InferredContravariantParamSpecOld[int] = InferredContravariantParamSpecOld[object]() # OK + + +class InferredCovariantParamSpecOld(Generic[InferP]): + def out_f(self, fn: Callable[InferP, None]) -> None: # OK + raise NotImplementedError + + +infer_out_int_old: InferredCovariantParamSpecOld[int] = InferredCovariantParamSpecOld[object]() # E +infer_out_obj_old: InferredCovariantParamSpecOld[object] = InferredCovariantParamSpecOld[int]() # OK diff --git a/conformance/tests/generics_typevartuple_variance.py b/conformance/tests/generics_typevartuple_variance.py index 262f37740..848558929 100644 --- a/conformance/tests/generics_typevartuple_variance.py +++ b/conformance/tests/generics_typevartuple_variance.py @@ -17,6 +17,8 @@ class InvariantTypeVarTuple[*InOutTs]: in_out_variadic_int: InvariantTypeVarTuple[*tuple[int, ...]] = InvariantTypeVarTuple[*tuple[object, ...]]() # E in_out_variadic_object: InvariantTypeVarTuple[*tuple[object, ...]] = InvariantTypeVarTuple[*tuple[int, ...]]() # E in_out_empty: InvariantTypeVarTuple[()] = InvariantTypeVarTuple[()]() # OK +in_out_fixed_from_variadic: InvariantTypeVarTuple[int] = InvariantTypeVarTuple[*tuple[int, ...]]() # E +in_out_variadic_from_fixed: InvariantTypeVarTuple[*tuple[int, ...]] = InvariantTypeVarTuple[int]() # E class ContravariantTypeVarTuple[*InTs]: @@ -28,6 +30,8 @@ def f(self, t: tuple[*InTs]): in_variadic_int: ContravariantTypeVarTuple[*tuple[int, ...]] = ContravariantTypeVarTuple[*tuple[object, ...]]() # OK in_variadic_object: ContravariantTypeVarTuple[*tuple[object, ...]] = ContravariantTypeVarTuple[*tuple[int, ...]]() # E in_empty: ContravariantTypeVarTuple[()] = ContravariantTypeVarTuple[()]() # OK +in_fixed_from_variadic: ContravariantTypeVarTuple[int] = ContravariantTypeVarTuple[*tuple[int, ...]]() # OK +in_variadic_from_fixed: ContravariantTypeVarTuple[*tuple[int, ...]] = ContravariantTypeVarTuple[int]() # E class CovariantTypeVarTuple[*OutTs]: @@ -44,11 +48,14 @@ def f(self) -> tuple[*OutTs]: out_variadic_int: CovariantTypeVarTuple[*tuple[int, ...]] = CovariantTypeVarTuple[*tuple[object, ...]]() # E out_variadic_object: CovariantTypeVarTuple[*tuple[object, ...]] = CovariantTypeVarTuple[*tuple[int, ...]]() # OK out_empty: CovariantTypeVarTuple[()] = CovariantTypeVarTuple[()]() # OK +out_fixed_from_variadic: CovariantTypeVarTuple[int] = CovariantTypeVarTuple[*tuple[int, ...]]() # E +out_variadic_from_fixed: CovariantTypeVarTuple[*tuple[int, ...]] = CovariantTypeVarTuple[int]() # OK Ts = TypeVarTuple("Ts") # OK +InferTs = TypeVarTuple("InferTs", infer_variance=True) # OK InvTs1 = TypeVarTuple("InvTs1", covariant=True, contravariant=True) # E InvTs2 = TypeVarTuple("InvTs2", covariant=True, infer_variance=True) # E -InvTs3 = TypeVarTuple("InvTs3", covariant=True, infer_variance=True) # E +InvTs3 = TypeVarTuple("InvTs3", contravariant=True, infer_variance=True) # E class InvariantTypeVarTupleOld(Generic[*Ts]): def in_f(self, *args: *Ts) -> None: # OK @@ -89,3 +96,22 @@ def out_f(self) -> tuple[*OutTs]: # OK out_int_old: CovariantTypeVarTupleOld[int] = CovariantTypeVarTupleOld[object]() # E out_obj_old: CovariantTypeVarTupleOld[object] = CovariantTypeVarTupleOld[int]() # OK + + +# `infer_variance=True` on a traditional `TypeVarTuple` +class InferredContravariantTypeVarTupleOld(Generic[*InferTs]): + def in_f(self, *args: *InferTs) -> None: # OK + raise NotImplementedError + + +infer_in_obj_old: InferredContravariantTypeVarTupleOld[object] = InferredContravariantTypeVarTupleOld[int]() # E +infer_in_int_old: InferredContravariantTypeVarTupleOld[int] = InferredContravariantTypeVarTupleOld[object]() # OK + + +class InferredCovariantTypeVarTupleOld(Generic[*InferTs]): + def out_f(self) -> tuple[*InferTs]: # OK + raise NotImplementedError + + +infer_out_int_old: InferredCovariantTypeVarTupleOld[int] = InferredCovariantTypeVarTupleOld[object]() # E +infer_out_obj_old: InferredCovariantTypeVarTupleOld[object] = InferredCovariantTypeVarTupleOld[int]() # OK diff --git a/conformance/uv.lock b/conformance/uv.lock index c28f526d2..2ff42f9be 100644 --- a/conformance/uv.lock +++ b/conformance/uv.lock @@ -261,6 +261,7 @@ dependencies = [ { name = "tomlkit" }, { name = "ty" }, { name = "types-markdown" }, + { name = "typing-extensions" }, { name = "zuban" }, ] @@ -275,6 +276,7 @@ requires-dist = [ { name = "tomlkit" }, { name = "ty" }, { name = "types-markdown" }, + { name = "typing-extensions", specifier = ">=4.16.0" }, { name = "zuban" }, ] diff --git a/docs/spec/generics.rst b/docs/spec/generics.rst index e9447bd6f..b20b2bbc4 100644 --- a/docs/spec/generics.rst +++ b/docs/spec/generics.rst @@ -2719,9 +2719,19 @@ constructor call. No further inference is needed. 2. Create two specialized versions of the class. We'll refer to these as ``upper`` and ``lower`` specializations. In both of these specializations, -replace all type parameters other than the one being inferred by a dummy type -instance (a concrete anonymous class that is assumed to meet the bounds or -constraints of the type parameter). In the ``upper`` specialized class, +replace all type parameters other than the one being inferred by a dummy +argument of the appropriate kind: + +- for a type variable, a dummy type instance (a concrete anonymous class that + is assumed to meet the bounds or constraints of the type parameter) +- for a type variable tuple, a fixed-length pack containing a single dummy type + instance +- for a parameter specification, a signature taking a single positional-only + parameter of a dummy type + +Any dummy argument will do, as long as it is fixed across both specializations; +its only purpose is to make the class fully specialized so that the target type +parameter can be varied on its own. In the ``upper`` specialized class, specialize the target type parameter with: - an ``object`` instance for a type variable @@ -2779,19 +2789,17 @@ To determine the variance of ``T3``, we specialize ``ClassA`` as follows: Since ``lower`` is assignable to ``upper``, ``T3`` is covariant. -Auto Variance For TypeVar -^^^^^^^^^^^^^^^^^^^^^^^^^ +Auto Variance For Traditional Type Variables +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ The existing ``TypeVar``, ``TypeVarTuple`` and ``ParamSpec`` class constructors -accepts keyword parameters named ``covariant`` and ``contravariant``. +accept keyword parameters named ``covariant`` and ``contravariant``. If both of these are ``False``, the type variable is assumed to be invariant. PEP 695 adds another keyword parameter named ``infer_variance`` indicating that a type checker should use inference to determine whether the type variable is invariant, covariant or -contravariant. A corresponding instance variable ``__infer_variance__`` can be -accessed at runtime to determine whether the variance is inferred. Type -variables that are implicitly allocated using the new syntax will always -have ``__infer_variance__`` set to ``True``. +contravariant. Type parameters that are implicitly allocated using the new +syntax always have inferred variance. A generic class that uses the traditional syntax may include combinations of type variables with explicit and inferred variance. From 4849cc34bc968ef8c602047a0f75c7e298affbc5 Mon Sep 17 00:00:00 2001 From: Carl Meyer Date: Wed, 12 Aug 2026 17:24:21 -0700 Subject: [PATCH 3/7] Clarify TypeVarTuple bound support and Python availability --- conformance/tests/generics_typevartuple_basic.py | 4 ++-- docs/spec/generics.rst | 12 +++++++----- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/conformance/tests/generics_typevartuple_basic.py b/conformance/tests/generics_typevartuple_basic.py index 20dd6fdbf..672960270 100644 --- a/conformance/tests/generics_typevartuple_basic.py +++ b/conformance/tests/generics_typevartuple_basic.py @@ -61,10 +61,10 @@ def method1(*args: Shape) -> None: # E: not unpacked ... -# > TypeVarTuple does not yet support specification of bounds, constraints. +# > TypeVarTuple does not support type constraints. Ts2 = TypeVarTuple("Ts2", int, float) # E -Ts3 = TypeVarTuple("Ts3", bound=int) # E +Ts3 = TypeVarTuple("Ts3", bound=int) # E: bound is unavailable in Python 3.12 # > If the same TypeVarTuple instance is used in multiple places in a signature diff --git a/docs/spec/generics.rst b/docs/spec/generics.rst index b20b2bbc4..76c78c70e 100644 --- a/docs/spec/generics.rst +++ b/docs/spec/generics.rst @@ -1190,13 +1190,15 @@ for two reasons: * To improve readability: the star also functions as an explicit visual indicator that the type variable tuple is not a normal type variable. -Type Constraints and Type Bounds: Not Supported -""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +Type Constraints and Type Bounds +"""""""""""""""""""""""""""""""" -``TypeVarTuple`` does not currently support specification of: +``TypeVarTuple`` does not support type constraints such as +``TypeVar('T', int, float)``. -* Type constraints (``TypeVar('T', int, float)``) -* Type bounds (``TypeVar('T', bound=ParentClass)``) +The ``TypeVarTuple`` constructor accepts a ``bound`` argument beginning in +Python 3.15 and in ``typing_extensions`` 4.16 and newer. As with ``ParamSpec``, +the typing semantics of this argument are not yet specified. Type Variable Tuple Equality """""""""""""""""""""""""""" From 653b023c6ac0a1919bcf869eda1415a59df6b2b4 Mon Sep 17 00:00:00 2001 From: Carl Meyer Date: Wed, 12 Aug 2026 17:24:37 -0700 Subject: [PATCH 4/7] Specify variance constructor options and availability --- docs/spec/generics.rst | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/docs/spec/generics.rst b/docs/spec/generics.rst index 76c78c70e..3735a5806 100644 --- a/docs/spec/generics.rst +++ b/docs/spec/generics.rst @@ -2794,14 +2794,18 @@ Since ``lower`` is assignable to ``upper``, ``T3`` is covariant. Auto Variance For Traditional Type Variables ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -The existing ``TypeVar``, ``TypeVarTuple`` and ``ParamSpec`` class constructors -accept keyword parameters named ``covariant`` and ``contravariant``. -If both of these are ``False``, the -type variable is assumed to be invariant. PEP 695 adds another keyword -parameter named ``infer_variance`` indicating that a type checker should use -inference to determine whether the type variable is invariant, covariant or -contravariant. Type parameters that are implicitly allocated using the new -syntax always have inferred variance. +The ``TypeVar``, ``TypeVarTuple``, and ``ParamSpec`` constructors accept the +keyword parameters ``covariant``, ``contravariant``, and ``infer_variance``. +At most one of these parameters may be ``True``. If all three are ``False``, +the type variable is invariant. If ``infer_variance`` is ``True``, a type +checker should infer whether the type variable is invariant, covariant, or +contravariant. + +:pep:`695` introduced ``infer_variance`` for ``TypeVar``. The ``TypeVarTuple`` +constructor accepts these variance parameters beginning in Python 3.15; +``typing_extensions`` provides a backport starting with version 4.16. Type +parameters implicitly allocated using the new syntax always have inferred +variance. A generic class that uses the traditional syntax may include combinations of type variables with explicit and inferred variance. From 8f860750027201cfe7d79951bc7d9a78726e87fd Mon Sep 17 00:00:00 2001 From: Carl Meyer Date: Wed, 12 Aug 2026 17:25:07 -0700 Subject: [PATCH 5/7] Infer variance for ParamSpec callback protocols --- .../pycroscope/callables_annotation.toml | 9 ++++++- .../pycroscope/callables_protocol.toml | 9 ++++++- .../pycroscope/callables_subtyping.toml | 11 +++++++- conformance/results/results.html | 25 +++++++++++++++---- conformance/tests/callables_annotation.py | 2 +- conformance/tests/callables_protocol.py | 2 +- conformance/tests/callables_subtyping.py | 2 +- 7 files changed, 49 insertions(+), 11 deletions(-) diff --git a/conformance/results/pycroscope/callables_annotation.toml b/conformance/results/pycroscope/callables_annotation.toml index 2de3e2782..4eac45be1 100644 --- a/conformance/results/pycroscope/callables_annotation.toml +++ b/conformance/results/pycroscope/callables_annotation.toml @@ -1,5 +1,10 @@ -conformance_automated = "Pass" +conformant = "Partial" +notes = """ +Does not support callback protocols with PEP 695 ParamSpec type parameters. +""" +conformance_automated = "Fail" errors_diff = """ +Line 115: Unexpected errors ['./callables_annotation.py:115:38: Traceback (most recent call last):', './callables_annotation.py:115:4: Traceback (most recent call last):'] """ output = """ ./callables_annotation.py:25:4: Missing required positional argument at position 1 [incompatible_call] @@ -14,6 +19,8 @@ output = """ ./callables_annotation.py:59:4: Ellipsis must be used directly in Callable[..., T], not in Callable[[...], T] [invalid_annotation] ./callables_annotation.py:91:0: Incompatible assignment: expected (int, /, **Any[explicit]) -> str, got () -> str [incompatible_assignment] ./callables_annotation.py:93:0: Incompatible assignment: expected (int, /, **Any[explicit]) -> str, got (*, a: int) -> str [incompatible_assignment] +./callables_annotation.py:115:38: Traceback (most recent call last): +./callables_annotation.py:115:4: Traceback (most recent call last): ./callables_annotation.py:159:4: Incompatible assignment: expected ./callables_annotation.py.Proto5[Any[explicit]], got ./callables_annotation.py.Proto8 [incompatible_assignment] ./callables_annotation.py:172:4: Incompatible assignment: expected .Callback2[Any[ellipsis_callable]] = (int, /, ****P) -> str, got () -> str [incompatible_assignment] ./callables_annotation.py:187:4: Incompatible assignment: expected (str, /, **Any[explicit]) -> str, got (int, str, /) -> str [incompatible_assignment] diff --git a/conformance/results/pycroscope/callables_protocol.toml b/conformance/results/pycroscope/callables_protocol.toml index 658e045ad..8bc4c7dff 100644 --- a/conformance/results/pycroscope/callables_protocol.toml +++ b/conformance/results/pycroscope/callables_protocol.toml @@ -1,5 +1,10 @@ -conformance_automated = "Pass" +conformant = "Partial" +notes = """ +Does not support callback protocols with PEP 695 ParamSpec type parameters. +""" +conformance_automated = "Fail" errors_diff = """ +Line 179: Unexpected errors ['./callables_protocol.py:179:30: Traceback (most recent call last):', './callables_protocol.py:179:4: Traceback (most recent call last):'] """ output = """ ./callables_protocol.py:35:0: Incompatible assignment: expected ./callables_protocol.py.Proto1, got (*vals: tuple[bytes, ...], max_items: int | None) -> list[bytes] [incompatible_assignment] @@ -12,6 +17,8 @@ output = """ ./callables_protocol.py:97:0: Incompatible assignment: expected ./callables_protocol.py.Proto4, got (x: int) -> None [incompatible_assignment] ./callables_protocol.py:121:0: Incompatible assignment: expected ./callables_protocol.py.NotProto6, got (*vals: tuple[bytes, ...], max_len: int | None = None) -> list[bytes] [incompatible_assignment] ./callables_protocol.py:169:0: Incompatible assignment: expected ./callables_protocol.py.Proto8, got (x: int) -> Any[explicit] [incompatible_assignment] +./callables_protocol.py:179:30: Traceback (most recent call last): +./callables_protocol.py:179:4: Traceback (most recent call last): ./callables_protocol.py:186:4: Incompatible types in assignment to attribute 'other_attribute': expected int, got Literal['str'] [incompatible_assignment] ./callables_protocol.py:187:4: ./callables_protocol.py.Proto9[**P@./callables_protocol.py.decorator1..decorator1, +R@./callables_protocol.py.decorator1..decorator1] has no attribute 'xxx' [undefined_attribute] ./callables_protocol.py:197:6: ./callables_protocol.py.Proto9[(x: int) -> Any[unannotated], str] has no attribute 'other_attribute2' [undefined_attribute] diff --git a/conformance/results/pycroscope/callables_subtyping.toml b/conformance/results/pycroscope/callables_subtyping.toml index 548cae50e..ad3adb9b2 100644 --- a/conformance/results/pycroscope/callables_subtyping.toml +++ b/conformance/results/pycroscope/callables_subtyping.toml @@ -1,5 +1,11 @@ -conformance_automated = "Pass" +conformant = "Partial" +notes = """ +Does not support callback protocols with PEP 695 ParamSpec type parameters. +""" +conformance_automated = "Fail" errors_diff = """ +Line 205: Unexpected errors ['./callables_subtyping.py:205:30: Traceback (most recent call last):', './callables_subtyping.py:205:4: Traceback (most recent call last):'] +Line 214: Unexpected errors ['./callables_subtyping.py:214:4: Incompatible assignment: expected callables_subtyping.ProtocolWithP[**P@callables_subtyping.func7..func7], got callables_subtyping.TypeAliasWithP[**P@callables_subtyping.func7..func7] = (**__P: **P) -> None [incompatible_assignment]'] """ output = """ ./callables_subtyping.py:26:4: Incompatible assignment: expected (float | int, /) -> float | int, got (int, /) -> int [incompatible_assignment] @@ -28,6 +34,9 @@ output = """ ./callables_subtyping.py:195:4: Incompatible assignment: expected callables_subtyping.IntKwargs6, got callables_subtyping.StrKwargs6 [incompatible_assignment] ./callables_subtyping.py:196:4: Incompatible assignment: expected callables_subtyping.Standard6, got callables_subtyping.IntStrKwargs6 [incompatible_assignment] ./callables_subtyping.py:197:4: Incompatible assignment: expected callables_subtyping.Standard6, got callables_subtyping.StrKwargs6 [incompatible_assignment] +./callables_subtyping.py:205:30: Traceback (most recent call last): +./callables_subtyping.py:205:4: Traceback (most recent call last): +./callables_subtyping.py:214:4: Incompatible assignment: expected callables_subtyping.ProtocolWithP[**P@callables_subtyping.func7..func7], got callables_subtyping.TypeAliasWithP[**P@callables_subtyping.func7..func7] = (**__P: **P) -> None [incompatible_assignment] ./callables_subtyping.py:236:4: Incompatible assignment: expected callables_subtyping.DefaultArg8, got callables_subtyping.NoDefaultArg8 [incompatible_assignment] ./callables_subtyping.py:237:4: Incompatible assignment: expected callables_subtyping.DefaultArg8, got callables_subtyping.NoX8 [incompatible_assignment] ./callables_subtyping.py:240:4: Incompatible assignment: expected callables_subtyping.NoDefaultArg8, got callables_subtyping.NoX8 [incompatible_assignment] diff --git a/conformance/results/results.html b/conformance/results/results.html index 76874ae97..a1ac5844b 100644 --- a/conformance/results/results.html +++ b/conformance/results/results.html @@ -1553,7 +1553,12 @@

    Python Type System Conformance Test Results

  • Does not treat *args: Any, **kargs: Any as ... when separated by keyword parameter.
  • - Pass + + Partial +
      +
    • Does not support callback protocols with PEP 695 ParamSpec type parameters.
    • +
    + Pass Pass Pass @@ -1576,7 +1581,12 @@

    Python Type System Conformance Test Results

    callables_protocol Pass - Pass + + Partial +
      +
    • Does not support callback protocols with PEP 695 ParamSpec type parameters.
    • +
    + Pass Pass Pass @@ -1585,7 +1595,12 @@

    Python Type System Conformance Test Results

    callables_subtyping Pass - Pass + + Partial +
      +
    • Does not support callback protocols with PEP 695 ParamSpec type parameters.
    • +
    + Pass Pass Pass @@ -1594,7 +1609,7 @@

    Python Type System Conformance Test Results

    3 / 4 • 75.0% - 4 / 4 • 100.0% + 2.5 / 4 • 62.5% 4 / 4 • 100.0% 4 / 4 • 100.0% 4 / 4 • 100.0% @@ -2708,7 +2723,7 @@

    Python Type System Conformance Test Results

    108.5 / 145 • 74.8% - 129.5 / 145 • 89.3% + 128 / 145 • 88.3% 140.5 / 145 • 96.9% 135.5 / 145 • 93.4% 128 / 145 • 88.3% diff --git a/conformance/tests/callables_annotation.py b/conformance/tests/callables_annotation.py index 35b98f5ee..8cf25c6ab 100644 --- a/conformance/tests/callables_annotation.py +++ b/conformance/tests/callables_annotation.py @@ -111,7 +111,7 @@ class Proto3(Protocol): def __call__(self, a: int, *args: Any, **kwargs: Any) -> None: ... -class Proto4(Protocol[P]): +class Proto4[**P](Protocol): def __call__(self, a: int, *args: P.args, **kwargs: P.kwargs) -> None: ... diff --git a/conformance/tests/callables_protocol.py b/conformance/tests/callables_protocol.py index 0ee1b5d34..3b05d10ca 100644 --- a/conformance/tests/callables_protocol.py +++ b/conformance/tests/callables_protocol.py @@ -173,7 +173,7 @@ def cb8_bad1(x: int) -> Any: R = TypeVar("R", covariant=True) -class Proto9(Protocol[P, R]): +class Proto9[**P, R](Protocol): other_attribute: int def __call__(self, *args: P.args, **kwargs: P.kwargs) -> R: diff --git a/conformance/tests/callables_subtyping.py b/conformance/tests/callables_subtyping.py index 0451d6289..9cecc843e 100644 --- a/conformance/tests/callables_subtyping.py +++ b/conformance/tests/callables_subtyping.py @@ -201,7 +201,7 @@ def func6( # > to a Callable parameterized by P. -class ProtocolWithP(Protocol[P]): +class ProtocolWithP[**P](Protocol): def __call__(self, *args: P.args, **kwargs: P.kwargs) -> None: ... From 30c322aaf42a3076938d0b97b2a45cad38397570 Mon Sep 17 00:00:00 2001 From: Carl Meyer Date: Wed, 12 Aug 2026 17:25:26 -0700 Subject: [PATCH 6/7] Point variance conformance tests to the current specification --- conformance/tests/generics_mixed_variance_inference.py | 2 +- conformance/tests/generics_paramspec_variance.py | 2 +- conformance/tests/generics_typevartuple_variance.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/conformance/tests/generics_mixed_variance_inference.py b/conformance/tests/generics_mixed_variance_inference.py index 7bb3a4b3a..e7cbfd752 100644 --- a/conformance/tests/generics_mixed_variance_inference.py +++ b/conformance/tests/generics_mixed_variance_inference.py @@ -2,7 +2,7 @@ Tests variance inference for mixed type parameters. """ -# Specification: https://peps.python.org/pep-0695/#variance-inference +# Specification: https://typing.readthedocs.io/en/latest/spec/generics.html#variance-inference class Mixed[T, *Ts, **P]: def f(self, x: T, /, *args: P.args, **kwargs: P.kwargs) -> tuple[*Ts]: diff --git a/conformance/tests/generics_paramspec_variance.py b/conformance/tests/generics_paramspec_variance.py index 5aa017bb8..04866e941 100644 --- a/conformance/tests/generics_paramspec_variance.py +++ b/conformance/tests/generics_paramspec_variance.py @@ -2,7 +2,7 @@ Tests variance of ParamSpec. """ -# Specification: https://typing.readthedocs.io/en/latest/spec/generics.html#semantics +# Specification: https://typing.readthedocs.io/en/latest/spec/generics.html#variance-inference from typing import Callable, Generic, ParamSpec diff --git a/conformance/tests/generics_typevartuple_variance.py b/conformance/tests/generics_typevartuple_variance.py index 848558929..ace05d773 100644 --- a/conformance/tests/generics_typevartuple_variance.py +++ b/conformance/tests/generics_typevartuple_variance.py @@ -2,7 +2,7 @@ Tests variance of TypeVarTuple. """ -# Specification: https://typing.readthedocs.io/en/latest/spec/generics.html#semantics +# Specification: https://typing.readthedocs.io/en/latest/spec/generics.html#variance-inference from typing import Generic From 70d51d294a9e6c5addd441bb142d03ab8d530e4f Mon Sep 17 00:00:00 2001 From: Carl Meyer Date: Wed, 12 Aug 2026 17:25:55 -0700 Subject: [PATCH 7/7] Correct Zuban mixed variance conformance scoring --- conformance/results/results.html | 11 ++++++++--- .../zuban/generics_mixed_variance_inference.toml | 5 ++++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/conformance/results/results.html b/conformance/results/results.html index a1ac5844b..2a8c27f44 100644 --- a/conformance/results/results.html +++ b/conformance/results/results.html @@ -617,7 +617,12 @@

    Python Type System Conformance Test Results

    Unsupported Unsupported Pass - Unsupported + + Partial +
      +
    • Does not infer covariance for a TypeVarTuple in a class with mixed type parameters.
    • +
    + generics_paramspec_basic @@ -994,7 +999,7 @@

    Python Type System Conformance Test Results

    30 / 33 • 90.9% 28.5 / 33 • 86.4% 29 / 33 • 87.9% - 29.5 / 33 • 89.4% + 30 / 33 • 90.9% @@ -2727,7 +2732,7 @@

    Python Type System Conformance Test Results

    140.5 / 145 • 96.9% 135.5 / 145 • 93.4% 128 / 145 • 88.3% - 139.5 / 145 • 96.2% + 140 / 145 • 96.6% diff --git a/conformance/results/zuban/generics_mixed_variance_inference.toml b/conformance/results/zuban/generics_mixed_variance_inference.toml index 47432b050..7e3422c42 100644 --- a/conformance/results/zuban/generics_mixed_variance_inference.toml +++ b/conformance/results/zuban/generics_mixed_variance_inference.toml @@ -1,4 +1,7 @@ -conformant = "Unsupported" +conformant = "Partial" +notes = """ +Does not infer covariance for a TypeVarTuple in a class with mixed type parameters. +""" conformance_automated = "Fail" errors_diff = """ Line 17: Unexpected errors ['generics_mixed_variance_inference.py:17: error: Incompatible types in assignment (expression has type "Mixed[int, bool, []]", variable has type "Mixed[int, int, []]") [assignment]']