diff --git a/conformance/README.md b/conformance/README.md index 7abe0c43..aa65c815 100644 --- a/conformance/README.md +++ b/conformance/README.md @@ -46,12 +46,26 @@ Test cases use the following conventions: * Lines that are expected to produce a type checker error should have a comment starting with # E", either by itself or followed by an explanation after a colon (e.g., "# E: int is not a subtype of str"). Such explanatory comments are purely for human understanding, but type checkers are not - expected to use their exact wording. + expected to use their exact wording. There are several syntactic variations; see "Test Case Syntax" + below. * Lines that may produce an error (e.g., because the spec allows multiple behaviors) should be marked with "# E?" instead of "# E". * If a test case tests conformance with a specific passage in the spec, that passage should be quoted in a comment prefixed with "# > ". +## Test Case Syntax + +Test cases support the following special comments for declaring where errors should be raised: + +* `# E`: an error must be raised on this line +* `# E?`: an error may be raised on this line +* `# E[tag]`, where `tag` is an arbitrary string: must appear multiple times in a file with the same tag. + Exactly one line with this tag must raise an error. +* `# E[tag+]`: like `# E[tag]`, but errors may be raised on multiple lines. + +Each comment may be followed by a colon plus an explanation of the error; the explanation is ignored +by the scoring system. + ## Running the Conformance Test Tool To run the conformance test suite: @@ -60,7 +74,7 @@ To run the conformance test suite: * Switch to the `conformance` subdirectory and install all dependencies (`pip install -r requirements.txt`). * Switch to the `src` subdirectory and run `python main.py`. -Note that some type checkers may not run on some platforms. If a type checker fails to install, tests will be skipped for that type checker. +Note that some type checkers may not run on some platforms. If a type checker fails to install, tests will be skipped for that type checker. Currently, the only unsupported type checker is Pyre on Windows. ## Reporting Conformance Results diff --git a/conformance/results/mypy/overloads_definitions.toml b/conformance/results/mypy/overloads_definitions.toml index e642fa29..d9485b86 100644 --- a/conformance/results/mypy/overloads_definitions.toml +++ b/conformance/results/mypy/overloads_definitions.toml @@ -5,7 +5,7 @@ Does not allow an overload with no implementation in an abstract base class. Allows @override to be on all overloads and implementation, instead of just implementation. """ errors_diff = """ -Lines 220, 222, 226: Expected error (tag 'override_impl') +Lines 220, 221, 222, 225, 226: Expected error (tag 'override_impl') Line 47: Unexpected errors ['overloads_definitions.py:47: error: An overloaded function outside a stub file must have an implementation [no-overload-impl]'] """ output = """ @@ -14,8 +14,6 @@ overloads_definitions.py:27: error: An overloaded function outside a stub file m overloads_definitions.py:47: error: An overloaded function outside a stub file must have an implementation [no-overload-impl] overloads_definitions.py:58: error: An overloaded function outside a stub file must have an implementation [no-overload-impl] overloads_definitions.py:71: error: Overload does not consistently use the "@staticmethod" decorator on all function signatures. [misc] -overloads_definitions.py:81: error: Overloaded function implementation does not accept all possible arguments of signature 1 [misc] -overloads_definitions.py:81: error: Overloaded function implementation does not accept all possible arguments of signature 2 [misc] overloads_definitions.py:84: error: Overload does not consistently use the "@classmethod" decorator on all function signatures. [misc] overloads_definitions.py:121: error: @final should be applied only to overload implementation [misc] overloads_definitions.py:135: error: @final should be applied only to overload implementation [misc] diff --git a/conformance/results/mypy/overloads_definitions_stub.toml b/conformance/results/mypy/overloads_definitions_stub.toml index f2fd2a7b..2fccd76a 100644 --- a/conformance/results/mypy/overloads_definitions_stub.toml +++ b/conformance/results/mypy/overloads_definitions_stub.toml @@ -9,7 +9,6 @@ Lines 143, 147, 149: Expected error (tag 'override_impl') output = """ overloads_definitions_stub.pyi:13: error: Single overload definition, multiple required [misc] overloads_definitions_stub.pyi:32: error: Overload does not consistently use the "@staticmethod" decorator on all function signatures. [misc] -overloads_definitions_stub.pyi:33: error: Self argument missing for a non-static method (or an invalid type for self) [misc] overloads_definitions_stub.pyi:39: error: Overload does not consistently use the "@classmethod" decorator on all function signatures. [misc] overloads_definitions_stub.pyi:71: error: In a stub file @final must be applied only to the first overload [misc] overloads_definitions_stub.pyi:84: error: In a stub file @final must be applied only to the first overload [misc] diff --git a/conformance/results/mypy/tuples_type_compat.toml b/conformance/results/mypy/tuples_type_compat.toml index 3882ed3f..da7c5e84 100644 --- a/conformance/results/mypy/tuples_type_compat.toml +++ b/conformance/results/mypy/tuples_type_compat.toml @@ -9,27 +9,29 @@ tuples_type_compat.py:32: error: Incompatible types in assignment (expression ha tuples_type_compat.py:33: error: Incompatible types in assignment (expression has type "tuple[int, ...]", variable has type "tuple[int]") [assignment] tuples_type_compat.py:43: error: Incompatible types in assignment (expression has type "tuple[int, ...]", variable has type "tuple[int]") [assignment] tuples_type_compat.py:62: error: Incompatible types in assignment (expression has type "tuple[int, ...]", variable has type "tuple[int, int]") [assignment] -tuples_type_compat.py:95: error: Expression is of type "tuple[int] | tuple[str, str] | tuple[int, *tuple[str, ...], int]", not "tuple[int]" [assert-type] -tuples_type_compat.py:99: error: Expression is of type "tuple[int] | tuple[str, str] | tuple[int, *tuple[str, ...], int]", not "tuple[str, str] | tuple[int, int]" [assert-type] -tuples_type_compat.py:103: error: Expression is of type "tuple[int] | tuple[str, str] | tuple[int, *tuple[str, ...], int]", not "tuple[int, str, int]" [assert-type] -tuples_type_compat.py:136: error: Expression is of type "Sequence[object]", not "Sequence[complex | list[int]]" [assert-type] -tuples_type_compat.py:139: error: Expression is of type "Sequence[object]", not "Sequence[int | str]" [assert-type] -tuples_type_compat.py:144: error: Incompatible types in assignment (expression has type "tuple[int, str, str]", variable has type "tuple[int, str]") [assignment] -tuples_type_compat.py:149: error: Incompatible types in assignment (expression has type "tuple[int, int, str]", variable has type "tuple[int, *tuple[str, ...]]") [assignment] -tuples_type_compat.py:150: error: Incompatible types in assignment (expression has type "tuple[int, str, int]", variable has type "tuple[int, *tuple[str, ...]]") [assignment] -tuples_type_compat.py:156: error: Incompatible types in assignment (expression has type "tuple[int, str, str]", variable has type "tuple[int, *tuple[str, ...], int]") [assignment] -tuples_type_compat.py:157: error: Incompatible types in assignment (expression has type "tuple[int, str, str, float]", variable has type "tuple[int, *tuple[str, ...], int]") [assignment] -tuples_type_compat.py:162: error: Incompatible types in assignment (expression has type "tuple[int, str, int]", variable has type "tuple[*tuple[str, ...], int]") [assignment] -tuples_type_compat.py:163: error: Incompatible types in assignment (expression has type "tuple[str, str, float]", variable has type "tuple[*tuple[str, ...], int]") [assignment] -tuples_type_compat.py:168: error: Incompatible types in assignment (expression has type "tuple[str, str]", variable has type "tuple[str, str, int]") [assignment] -tuples_type_compat.py:171: error: Incompatible types in assignment (expression has type "tuple[str, str]", variable has type "tuple[str, str, str, *tuple[str, ...]]") [assignment] -tuples_type_compat.py:175: error: Incompatible types in assignment (expression has type "tuple[str, str]", variable has type "tuple[*tuple[str, ...], str, str, str]") [assignment] +tuples_type_compat.py:76: error: Expression is of type "tuple[int]", not "tuple[int] | tuple[str, str] | tuple[int, *tuple[str, ...], int]" [assert-type] +tuples_type_compat.py:81: error: Expression is of type "tuple[str, str] | tuple[int, int]", not "tuple[int] | tuple[str, str] | tuple[int, *tuple[str, ...], int]" [assert-type] +tuples_type_compat.py:86: error: Expression is of type "tuple[int, str, int]", not "tuple[int] | tuple[str, str] | tuple[int, *tuple[str, ...], int]" [assert-type] +tuples_type_compat.py:101: error: Expression is of type "tuple[int] | tuple[str, str] | tuple[int, *tuple[str, ...], int]", not "tuple[int]" [assert-type] +tuples_type_compat.py:106: error: Expression is of type "tuple[int] | tuple[str, str] | tuple[int, *tuple[str, ...], int]", not "tuple[str, str] | tuple[int, int]" [assert-type] +tuples_type_compat.py:111: error: Expression is of type "tuple[int] | tuple[str, str] | tuple[int, *tuple[str, ...], int]", not "tuple[int, str, int]" [assert-type] +tuples_type_compat.py:127: error: Expression is of type "tuple[int | str, str]", not "tuple[int | str, int | str]" [assert-type] +tuples_type_compat.py:130: error: Expression is of type "tuple[int | str, int]", not "tuple[int | str, int | str]" [assert-type] +tuples_type_compat.py:149: error: Expression is of type "Sequence[object]", not "Sequence[complex | list[int]]" [assert-type] +tuples_type_compat.py:152: error: Expression is of type "Sequence[object]", not "Sequence[int | str]" [assert-type] +tuples_type_compat.py:157: error: Incompatible types in assignment (expression has type "tuple[int, str, str]", variable has type "tuple[int, str]") [assignment] +tuples_type_compat.py:162: error: Incompatible types in assignment (expression has type "tuple[int, int, str]", variable has type "tuple[int, *tuple[str, ...]]") [assignment] +tuples_type_compat.py:163: error: Incompatible types in assignment (expression has type "tuple[int, str, int]", variable has type "tuple[int, *tuple[str, ...]]") [assignment] +tuples_type_compat.py:169: error: Incompatible types in assignment (expression has type "tuple[int, str, str]", variable has type "tuple[int, *tuple[str, ...], int]") [assignment] +tuples_type_compat.py:170: error: Incompatible types in assignment (expression has type "tuple[int, str, str, float]", variable has type "tuple[int, *tuple[str, ...], int]") [assignment] +tuples_type_compat.py:175: error: Incompatible types in assignment (expression has type "tuple[int, str, int]", variable has type "tuple[*tuple[str, ...], int]") [assignment] +tuples_type_compat.py:176: error: Incompatible types in assignment (expression has type "tuple[str, str, float]", variable has type "tuple[*tuple[str, ...], int]") [assignment] +tuples_type_compat.py:181: error: Incompatible types in assignment (expression has type "tuple[str, str]", variable has type "tuple[str, str, int]") [assignment] +tuples_type_compat.py:184: error: Incompatible types in assignment (expression has type "tuple[str, str]", variable has type "tuple[str, str, str, *tuple[str, ...]]") [assignment] +tuples_type_compat.py:188: error: Incompatible types in assignment (expression has type "tuple[str, str]", variable has type "tuple[*tuple[str, ...], str, str, str]") [assignment] """ conformance_automated = "Fail" errors_diff = """ -Line 95: Unexpected errors ['tuples_type_compat.py:95: error: Expression is of type "tuple[int] | tuple[str, str] | tuple[int, *tuple[str, ...], int]", not "tuple[int]" [assert-type]'] -Line 99: Unexpected errors ['tuples_type_compat.py:99: error: Expression is of type "tuple[int] | tuple[str, str] | tuple[int, *tuple[str, ...], int]", not "tuple[str, str] | tuple[int, int]" [assert-type]'] -Line 103: Unexpected errors ['tuples_type_compat.py:103: error: Expression is of type "tuple[int] | tuple[str, str] | tuple[int, *tuple[str, ...], int]", not "tuple[int, str, int]" [assert-type]'] -Line 136: Unexpected errors ['tuples_type_compat.py:136: error: Expression is of type "Sequence[object]", not "Sequence[complex | list[int]]" [assert-type]'] -Line 139: Unexpected errors ['tuples_type_compat.py:139: error: Expression is of type "Sequence[object]", not "Sequence[int | str]" [assert-type]'] +Line 149: Unexpected errors ['tuples_type_compat.py:149: error: Expression is of type "Sequence[object]", not "Sequence[complex | list[int]]" [assert-type]'] +Line 152: Unexpected errors ['tuples_type_compat.py:152: error: Expression is of type "Sequence[object]", not "Sequence[int | str]" [assert-type]'] """ diff --git a/conformance/results/mypy/version.toml b/conformance/results/mypy/version.toml index ec26466c..b3982776 100644 --- a/conformance/results/mypy/version.toml +++ b/conformance/results/mypy/version.toml @@ -1,2 +1,2 @@ version = "mypy 1.15.0" -test_duration = 2.3 +test_duration = 1.8 diff --git a/conformance/results/pyre/overloads_definitions.toml b/conformance/results/pyre/overloads_definitions.toml index 0a99160d..9462c19c 100644 --- a/conformance/results/pyre/overloads_definitions.toml +++ b/conformance/results/pyre/overloads_definitions.toml @@ -5,10 +5,14 @@ Does not allow an overload with no implementation in a Protocol or an abstract b Expects @final/@override on all overloads and implementation, instead of implementation only. """ errors_diff = """ -Lines 135, 137, 142: Expected error (tag 'invalid_final_2') -Lines 220, 222, 226: Expected error (tag 'override_impl') +Lines 71, 73, 78, 81: Expected exactly one error (tag 'func5') +Lines 135, 136, 137, 141, 142: Expected error (tag 'invalid_final_2') +Lines 220, 221, 222, 225, 226: Expected error (tag 'override_impl') Line 40: Unexpected errors ['overloads_definitions.py:40:4 Missing overload implementation [42]: Overloaded function `MyProto.func3` must have an implementation.'] Line 49: Unexpected errors ['overloads_definitions.py:49:4 Missing overload implementation [42]: Overloaded function `MyAbstractBase.func4` must have an implementation.'] +Line 73: Unexpected errors ['overloads_definitions.py:73:4 Incompatible overload [43]: The implementation of `C.func5` does not accept all possible arguments of overload defined on line `73`.'] +Line 78: Unexpected errors ['overloads_definitions.py:78:4 Incompatible overload [43]: The implementation of `C.func5` does not accept all possible arguments of overload defined on line `78`.'] +Line 81: Unexpected errors ['overloads_definitions.py:81:4 Incompatible overload [43]: This definition does not have the same decorators as the preceding overload(s).'] Line 117: Unexpected errors ['overloads_definitions.py:117:4 Incompatible overload [43]: This definition does not have the same decorators as the preceding overload(s).'] Line 215: Unexpected errors ['overloads_definitions.py:215:4 Incompatible overload [43]: This definition does not have the same decorators as the preceding overload(s).'] """ diff --git a/conformance/results/pyre/tuples_type_compat.toml b/conformance/results/pyre/tuples_type_compat.toml index 72799fbd..7eb2392d 100644 --- a/conformance/results/pyre/tuples_type_compat.toml +++ b/conformance/results/pyre/tuples_type_compat.toml @@ -8,28 +8,28 @@ Does not correctly evaluate `Sequence[Never]` for `tuple[()]`. output = """ tuples_type_compat.py:15:4 Incompatible variable type [9]: v2 is declared to have type `Tuple[int, int]` but is used as type `Tuple[float, complex]`. tuples_type_compat.py:55:21 Undefined or invalid type [11]: Annotation `SomeType` is not defined as a type. -tuples_type_compat.py:72:11 Incompatible parameter type [6]: In call `len`, for 1st positional argument, expected `pyre_extensions.PyreReadOnly[Sized]` but got `Union[Tuple[int], Tuple[str, str], typing.Tuple[int, *Tuple[str, ...], int]]`. -tuples_type_compat.py:74:8 Assert type [70]: Expected `Tuple[int]` but got `Union[Tuple[int], Tuple[str, str], typing.Tuple[int, *Tuple[str, ...], int]]`. -tuples_type_compat.py:76:11 Incompatible parameter type [6]: In call `len`, for 1st positional argument, expected `pyre_extensions.PyreReadOnly[Sized]` but got `Union[Tuple[int], Tuple[str, str], typing.Tuple[int, *Tuple[str, ...], int]]`. -tuples_type_compat.py:78:8 Assert type [70]: Expected `Union[Tuple[int, int], Tuple[str, str]]` but got `Union[Tuple[int], Tuple[str, str], typing.Tuple[int, *Tuple[str, ...], int]]`. -tuples_type_compat.py:80:11 Incompatible parameter type [6]: In call `len`, for 1st positional argument, expected `pyre_extensions.PyreReadOnly[Sized]` but got `Union[Tuple[int], Tuple[str, str], typing.Tuple[int, *Tuple[str, ...], int]]`. -tuples_type_compat.py:82:8 Assert type [70]: Expected `Tuple[int, str, int]` but got `Union[Tuple[int], Tuple[str, str], typing.Tuple[int, *Tuple[str, ...], int]]`. -tuples_type_compat.py:95:12 Assert type [70]: Expected `Tuple[int]` but got `Union[Tuple[int], Tuple[str, str], typing.Tuple[int, *Tuple[str, ...], int]]`. -tuples_type_compat.py:99:12 Assert type [70]: Expected `Union[Tuple[int, int], Tuple[str, str]]` but got `Union[Tuple[int], Tuple[str, str], typing.Tuple[int, *Tuple[str, ...], int]]`. -tuples_type_compat.py:103:12 Assert type [70]: Expected `Tuple[int, str, int]` but got `Union[Tuple[int], Tuple[str, str], typing.Tuple[int, *Tuple[str, ...], int]]`. -tuples_type_compat.py:115:12 Assert type [70]: Expected `Tuple[Union[int, str], str]` but got `Tuple[Union[int, str], Union[int, str]]`. -tuples_type_compat.py:117:12 Assert type [70]: Expected `Tuple[Union[int, str], int]` but got `Tuple[Union[int, str], Union[int, str]]`. -tuples_type_compat.py:140:4 Assert type [70]: Expected `Sequence[Never]` but got `Sequence[Variable[T]]`. -tuples_type_compat.py:144:0 Incompatible variable type [9]: t1 is declared to have type `Tuple[int, str]` but is used as type `Tuple[int, str, str]`. -tuples_type_compat.py:149:0 Incompatible variable type [9]: t2 is declared to have type `typing.Tuple[int, *Tuple[str, ...]]` but is used as type `Tuple[int, int, str]`. -tuples_type_compat.py:150:0 Incompatible variable type [9]: t2 is declared to have type `typing.Tuple[int, *Tuple[str, ...]]` but is used as type `Tuple[int, str, int]`. -tuples_type_compat.py:156:0 Incompatible variable type [9]: t3 is declared to have type `typing.Tuple[int, *Tuple[str, ...], int]` but is used as type `Tuple[int, str, str]`. -tuples_type_compat.py:157:0 Incompatible variable type [9]: t3 is declared to have type `typing.Tuple[int, *Tuple[str, ...], int]` but is used as type `Tuple[int, str, str, float]`. -tuples_type_compat.py:162:0 Incompatible variable type [9]: t4 is declared to have type `typing.Tuple[*Tuple[str, ...], int]` but is used as type `Tuple[int, str, int]`. -tuples_type_compat.py:163:0 Incompatible variable type [9]: t4 is declared to have type `typing.Tuple[*Tuple[str, ...], int]` but is used as type `Tuple[str, str, float]`. -tuples_type_compat.py:168:4 Incompatible variable type [9]: t2 is declared to have type `Tuple[str, str, int]` but is used as type `Tuple[str, str]`. -tuples_type_compat.py:171:4 Incompatible variable type [9]: t5 is declared to have type `typing.Tuple[str, str, str, *Tuple[str, ...]]` but is used as type `Tuple[str, str]`. -tuples_type_compat.py:175:4 Incompatible variable type [9]: t9 is declared to have type `typing.Tuple[*Tuple[str, ...], str, str, str]` but is used as type `Tuple[str, str]`. +tuples_type_compat.py:73:11 Incompatible parameter type [6]: In call `len`, for 1st positional argument, expected `pyre_extensions.PyreReadOnly[Sized]` but got `Union[Tuple[int], Tuple[str, str], typing.Tuple[int, *Tuple[str, ...], int]]`. +tuples_type_compat.py:75:8 Assert type [70]: Expected `Tuple[int]` but got `Union[Tuple[int], Tuple[str, str], typing.Tuple[int, *Tuple[str, ...], int]]`. +tuples_type_compat.py:78:11 Incompatible parameter type [6]: In call `len`, for 1st positional argument, expected `pyre_extensions.PyreReadOnly[Sized]` but got `Union[Tuple[int], Tuple[str, str], typing.Tuple[int, *Tuple[str, ...], int]]`. +tuples_type_compat.py:80:8 Assert type [70]: Expected `Union[Tuple[int, int], Tuple[str, str]]` but got `Union[Tuple[int], Tuple[str, str], typing.Tuple[int, *Tuple[str, ...], int]]`. +tuples_type_compat.py:83:11 Incompatible parameter type [6]: In call `len`, for 1st positional argument, expected `pyre_extensions.PyreReadOnly[Sized]` but got `Union[Tuple[int], Tuple[str, str], typing.Tuple[int, *Tuple[str, ...], int]]`. +tuples_type_compat.py:85:8 Assert type [70]: Expected `Tuple[int, str, int]` but got `Union[Tuple[int], Tuple[str, str], typing.Tuple[int, *Tuple[str, ...], int]]`. +tuples_type_compat.py:101:12 Assert type [70]: Expected `Tuple[int]` but got `Union[Tuple[int], Tuple[str, str], typing.Tuple[int, *Tuple[str, ...], int]]`. +tuples_type_compat.py:106:12 Assert type [70]: Expected `Union[Tuple[int, int], Tuple[str, str]]` but got `Union[Tuple[int], Tuple[str, str], typing.Tuple[int, *Tuple[str, ...], int]]`. +tuples_type_compat.py:111:12 Assert type [70]: Expected `Tuple[int, str, int]` but got `Union[Tuple[int], Tuple[str, str], typing.Tuple[int, *Tuple[str, ...], int]]`. +tuples_type_compat.py:126:12 Assert type [70]: Expected `Tuple[Union[int, str], str]` but got `Tuple[Union[int, str], Union[int, str]]`. +tuples_type_compat.py:129:12 Assert type [70]: Expected `Tuple[Union[int, str], int]` but got `Tuple[Union[int, str], Union[int, str]]`. +tuples_type_compat.py:153:4 Assert type [70]: Expected `Sequence[Never]` but got `Sequence[Variable[T]]`. +tuples_type_compat.py:157:0 Incompatible variable type [9]: t1 is declared to have type `Tuple[int, str]` but is used as type `Tuple[int, str, str]`. +tuples_type_compat.py:162:0 Incompatible variable type [9]: t2 is declared to have type `typing.Tuple[int, *Tuple[str, ...]]` but is used as type `Tuple[int, int, str]`. +tuples_type_compat.py:163:0 Incompatible variable type [9]: t2 is declared to have type `typing.Tuple[int, *Tuple[str, ...]]` but is used as type `Tuple[int, str, int]`. +tuples_type_compat.py:169:0 Incompatible variable type [9]: t3 is declared to have type `typing.Tuple[int, *Tuple[str, ...], int]` but is used as type `Tuple[int, str, str]`. +tuples_type_compat.py:170:0 Incompatible variable type [9]: t3 is declared to have type `typing.Tuple[int, *Tuple[str, ...], int]` but is used as type `Tuple[int, str, str, float]`. +tuples_type_compat.py:175:0 Incompatible variable type [9]: t4 is declared to have type `typing.Tuple[*Tuple[str, ...], int]` but is used as type `Tuple[int, str, int]`. +tuples_type_compat.py:176:0 Incompatible variable type [9]: t4 is declared to have type `typing.Tuple[*Tuple[str, ...], int]` but is used as type `Tuple[str, str, float]`. +tuples_type_compat.py:181:4 Incompatible variable type [9]: t2 is declared to have type `Tuple[str, str, int]` but is used as type `Tuple[str, str]`. +tuples_type_compat.py:184:4 Incompatible variable type [9]: t5 is declared to have type `typing.Tuple[str, str, str, *Tuple[str, ...]]` but is used as type `Tuple[str, str]`. +tuples_type_compat.py:188:4 Incompatible variable type [9]: t9 is declared to have type `typing.Tuple[*Tuple[str, ...], str, str, str]` but is used as type `Tuple[str, str]`. """ conformance_automated = "Fail" errors_diff = """ @@ -39,16 +39,8 @@ Line 33: Expected 1 errors Line 43: Expected 1 errors Line 62: Expected 1 errors Line 55: Unexpected errors ['tuples_type_compat.py:55:21 Undefined or invalid type [11]: Annotation `SomeType` is not defined as a type.'] -Line 72: Unexpected errors ['tuples_type_compat.py:72:11 Incompatible parameter type [6]: In call `len`, for 1st positional argument, expected `pyre_extensions.PyreReadOnly[Sized]` but got `Union[Tuple[int], Tuple[str, str], typing.Tuple[int, *Tuple[str, ...], int]]`.'] -Line 74: Unexpected errors ['tuples_type_compat.py:74:8 Assert type [70]: Expected `Tuple[int]` but got `Union[Tuple[int], Tuple[str, str], typing.Tuple[int, *Tuple[str, ...], int]]`.'] -Line 76: Unexpected errors ['tuples_type_compat.py:76:11 Incompatible parameter type [6]: In call `len`, for 1st positional argument, expected `pyre_extensions.PyreReadOnly[Sized]` but got `Union[Tuple[int], Tuple[str, str], typing.Tuple[int, *Tuple[str, ...], int]]`.'] -Line 78: Unexpected errors ['tuples_type_compat.py:78:8 Assert type [70]: Expected `Union[Tuple[int, int], Tuple[str, str]]` but got `Union[Tuple[int], Tuple[str, str], typing.Tuple[int, *Tuple[str, ...], int]]`.'] -Line 80: Unexpected errors ['tuples_type_compat.py:80:11 Incompatible parameter type [6]: In call `len`, for 1st positional argument, expected `pyre_extensions.PyreReadOnly[Sized]` but got `Union[Tuple[int], Tuple[str, str], typing.Tuple[int, *Tuple[str, ...], int]]`.'] -Line 82: Unexpected errors ['tuples_type_compat.py:82:8 Assert type [70]: Expected `Tuple[int, str, int]` but got `Union[Tuple[int], Tuple[str, str], typing.Tuple[int, *Tuple[str, ...], int]]`.'] -Line 95: Unexpected errors ['tuples_type_compat.py:95:12 Assert type [70]: Expected `Tuple[int]` but got `Union[Tuple[int], Tuple[str, str], typing.Tuple[int, *Tuple[str, ...], int]]`.'] -Line 99: Unexpected errors ['tuples_type_compat.py:99:12 Assert type [70]: Expected `Union[Tuple[int, int], Tuple[str, str]]` but got `Union[Tuple[int], Tuple[str, str], typing.Tuple[int, *Tuple[str, ...], int]]`.'] -Line 103: Unexpected errors ['tuples_type_compat.py:103:12 Assert type [70]: Expected `Tuple[int, str, int]` but got `Union[Tuple[int], Tuple[str, str], typing.Tuple[int, *Tuple[str, ...], int]]`.'] -Line 115: Unexpected errors ['tuples_type_compat.py:115:12 Assert type [70]: Expected `Tuple[Union[int, str], str]` but got `Tuple[Union[int, str], Union[int, str]]`.'] -Line 117: Unexpected errors ['tuples_type_compat.py:117:12 Assert type [70]: Expected `Tuple[Union[int, str], int]` but got `Tuple[Union[int, str], Union[int, str]]`.'] -Line 140: Unexpected errors ['tuples_type_compat.py:140:4 Assert type [70]: Expected `Sequence[Never]` but got `Sequence[Variable[T]]`.'] +Line 73: Unexpected errors ['tuples_type_compat.py:73:11 Incompatible parameter type [6]: In call `len`, for 1st positional argument, expected `pyre_extensions.PyreReadOnly[Sized]` but got `Union[Tuple[int], Tuple[str, str], typing.Tuple[int, *Tuple[str, ...], int]]`.'] +Line 78: Unexpected errors ['tuples_type_compat.py:78:11 Incompatible parameter type [6]: In call `len`, for 1st positional argument, expected `pyre_extensions.PyreReadOnly[Sized]` but got `Union[Tuple[int], Tuple[str, str], typing.Tuple[int, *Tuple[str, ...], int]]`.'] +Line 83: Unexpected errors ['tuples_type_compat.py:83:11 Incompatible parameter type [6]: In call `len`, for 1st positional argument, expected `pyre_extensions.PyreReadOnly[Sized]` but got `Union[Tuple[int], Tuple[str, str], typing.Tuple[int, *Tuple[str, ...], int]]`.'] +Line 153: Unexpected errors ['tuples_type_compat.py:153:4 Assert type [70]: Expected `Sequence[Never]` but got `Sequence[Variable[T]]`.'] """ diff --git a/conformance/results/pyre/version.toml b/conformance/results/pyre/version.toml index 1fe37985..e9c0c954 100644 --- a/conformance/results/pyre/version.toml +++ b/conformance/results/pyre/version.toml @@ -1,2 +1,2 @@ version = "pyre 0.9.23" -test_duration = 8.2 +test_duration = 9.0 diff --git a/conformance/results/pyright/overloads_definitions.toml b/conformance/results/pyright/overloads_definitions.toml index e0c86ab2..f7b17e78 100644 --- a/conformance/results/pyright/overloads_definitions.toml +++ b/conformance/results/pyright/overloads_definitions.toml @@ -7,20 +7,7 @@ overloads_definitions.py:16:5 - error: "func1" is marked as overload, but additi overloads_definitions.py:28:5 - error: "func2" is marked as overload, but no implementation is provided (reportNoOverloadImplementation) overloads_definitions.py:59:9 - error: "not_abstract" is marked as overload, but no implementation is provided (reportNoOverloadImplementation) overloads_definitions.py:73:9 - error: Overloads for "func5" use @staticmethod inconsistently (reportInconsistentOverload) -overloads_definitions.py:81:9 - error: Overloaded implementation is not consistent with signature of overload 1 -  Type "(self: Self@C, x: int | str) -> (int | str)" is not assignable to type "(x: int) -> int" -    Parameter name mismatch: "x" versus "self" -    Parameter 1: type "int" is incompatible with type "Self@C" -      Type "int" is not assignable to type "Self@C" -    Extra parameter "x" (reportInconsistentOverload) -overloads_definitions.py:81:9 - error: Overloaded implementation is not consistent with signature of overload 2 -  Type "(self: Self@C, x: int | str) -> (int | str)" is not assignable to type "(x: str) -> str" -    Parameter name mismatch: "x" versus "self" -    Parameter 1: type "str" is incompatible with type "Self@C" -      Type "str" is not assignable to type "Self@C" -    Extra parameter "x" (reportInconsistentOverload) overloads_definitions.py:86:9 - error: Overloads for "func6" use @classmethod inconsistently (reportInconsistentOverload) -overloads_definitions.py:90:15 - warning: Instance methods should take a "self" parameter (reportSelfClsParameterName) overloads_definitions.py:123:9 - error: @final decorator should be applied only to the implementation (reportInconsistentOverload) overloads_definitions.py:137:9 - error: @final decorator should be applied only to the implementation (reportInconsistentOverload) overloads_definitions.py:142:9 - error: @final decorator should be applied only to the implementation (reportInconsistentOverload) diff --git a/conformance/results/pyright/overloads_definitions_stub.toml b/conformance/results/pyright/overloads_definitions_stub.toml index 1e9c8949..a043c6cf 100644 --- a/conformance/results/pyright/overloads_definitions_stub.toml +++ b/conformance/results/pyright/overloads_definitions_stub.toml @@ -5,9 +5,7 @@ errors_diff = """ output = """ overloads_definitions_stub.pyi:14:5 - error: "func1" is marked as overload, but additional overloads are missing (reportInconsistentOverload) overloads_definitions_stub.pyi:33:9 - error: Overloads for "func5" use @staticmethod inconsistently (reportInconsistentOverload) -overloads_definitions_stub.pyi:33:15 - warning: Instance methods should take a "self" parameter (reportSelfClsParameterName) overloads_definitions_stub.pyi:41:9 - error: Overloads for "func6" use @classmethod inconsistently (reportInconsistentOverload) -overloads_definitions_stub.pyi:44:15 - warning: Instance methods should take a "self" parameter (reportSelfClsParameterName) overloads_definitions_stub.pyi:73:9 - error: Only the first overload should be marked @final (reportInconsistentOverload) overloads_definitions_stub.pyi:86:9 - error: Only the first overload should be marked @final (reportInconsistentOverload) overloads_definitions_stub.pyi:111:9 - error: Method "final_method" cannot override final method defined in class "Base" (reportIncompatibleMethodOverride) diff --git a/conformance/results/pyright/tuples_type_compat.toml b/conformance/results/pyright/tuples_type_compat.toml index 02eac297..72058759 100644 --- a/conformance/results/pyright/tuples_type_compat.toml +++ b/conformance/results/pyright/tuples_type_compat.toml @@ -19,28 +19,36 @@ tuples_type_compat.py:43:22 - error: Type "tuple[int, ...]" is not assignable to tuples_type_compat.py:62:26 - error: Type "tuple[int, ...]" is not assignable to declared type "tuple[int, int]"   "tuple[int, ...]" is not assignable to "tuple[int, int]"     Tuple size mismatch; expected 2 but received indeterminate (reportAssignmentType) -tuples_type_compat.py:144:6 - error: Type "tuple[Literal[1], Literal[''], Literal['']]" is not assignable to declared type "tuple[int, str]" +tuples_type_compat.py:76:21 - error: "assert_type" mismatch: expected "tuple[int] | tuple[str, str] | tuple[int, *tuple[str, ...], int]" but received "tuple[int]" (reportAssertTypeFailure) +tuples_type_compat.py:81:21 - error: "assert_type" mismatch: expected "tuple[int] | tuple[str, str] | tuple[int, *tuple[str, ...], int]" but received "tuple[str, str] | tuple[int, int]" (reportAssertTypeFailure) +tuples_type_compat.py:86:21 - error: "assert_type" mismatch: expected "tuple[int] | tuple[str, str] | tuple[int, *tuple[str, ...], int]" but received "tuple[int, str, int]" (reportAssertTypeFailure) +tuples_type_compat.py:102:25 - error: "assert_type" mismatch: expected "tuple[int] | tuple[str, str] | tuple[int, *tuple[str, ...], int]" but received "tuple[int]" (reportAssertTypeFailure) +tuples_type_compat.py:107:25 - error: "assert_type" mismatch: expected "tuple[int] | tuple[str, str] | tuple[int, *tuple[str, ...], int]" but received "tuple[str, str] | tuple[int, int]" (reportAssertTypeFailure) +tuples_type_compat.py:112:25 - error: "assert_type" mismatch: expected "tuple[int] | tuple[str, str] | tuple[int, *tuple[str, ...], int]" but received "tuple[int, str, int]" (reportAssertTypeFailure) +tuples_type_compat.py:127:25 - error: "assert_type" mismatch: expected "tuple[int | str, int | str]" but received "tuple[int | str, str]" (reportAssertTypeFailure) +tuples_type_compat.py:130:25 - error: "assert_type" mismatch: expected "tuple[int | str, int | str]" but received "tuple[int | str, int]" (reportAssertTypeFailure) +tuples_type_compat.py:157:6 - error: Type "tuple[Literal[1], Literal[''], Literal['']]" is not assignable to declared type "tuple[int, str]"   "tuple[Literal[1], Literal[''], Literal['']]" is not assignable to "tuple[int, str]"     Tuple size mismatch; expected 2 but received 3 (reportAssignmentType) -tuples_type_compat.py:149:10 - error: Type "tuple[Literal[1], Literal[1], Literal['']]" is not assignable to declared type "tuple[int, *tuple[str, ...]]" +tuples_type_compat.py:162:10 - error: Type "tuple[Literal[1], Literal[1], Literal['']]" is not assignable to declared type "tuple[int, *tuple[str, ...]]"   "Literal[1]" is not assignable to "str" (reportAssignmentType) -tuples_type_compat.py:150:14 - error: Type "tuple[Literal[1], Literal[''], Literal[1]]" is not assignable to declared type "tuple[int, *tuple[str, ...]]" +tuples_type_compat.py:163:14 - error: Type "tuple[Literal[1], Literal[''], Literal[1]]" is not assignable to declared type "tuple[int, *tuple[str, ...]]"   "Literal[1]" is not assignable to "str" (reportAssignmentType) -tuples_type_compat.py:156:14 - error: Type "tuple[Literal[1], Literal[''], Literal['']]" is not assignable to declared type "tuple[int, *tuple[str, ...], int]" +tuples_type_compat.py:169:14 - error: Type "tuple[Literal[1], Literal[''], Literal['']]" is not assignable to declared type "tuple[int, *tuple[str, ...], int]"   "Literal['']" is not assignable to "int" (reportAssignmentType) -tuples_type_compat.py:157:18 - error: Type "tuple[Literal[1], Literal[''], Literal[''], float]" is not assignable to declared type "tuple[int, *tuple[str, ...], int]" +tuples_type_compat.py:170:18 - error: Type "tuple[Literal[1], Literal[''], Literal[''], float]" is not assignable to declared type "tuple[int, *tuple[str, ...], int]"   "float" is not assignable to "int" (reportAssignmentType) -tuples_type_compat.py:162:7 - error: Type "tuple[Literal[1], Literal[''], Literal[1]]" is not assignable to declared type "tuple[*tuple[str, ...], int]" +tuples_type_compat.py:175:7 - error: Type "tuple[Literal[1], Literal[''], Literal[1]]" is not assignable to declared type "tuple[*tuple[str, ...], int]"   "Literal[1]" is not assignable to "str" (reportAssignmentType) -tuples_type_compat.py:163:15 - error: Type "tuple[Literal[''], Literal[''], float]" is not assignable to declared type "tuple[*tuple[str, ...], int]" +tuples_type_compat.py:176:15 - error: Type "tuple[Literal[''], Literal[''], float]" is not assignable to declared type "tuple[*tuple[str, ...], int]"   "float" is not assignable to "int" (reportAssignmentType) -tuples_type_compat.py:168:40 - error: Type "tuple[str, str]" is not assignable to declared type "tuple[str, str, int]" +tuples_type_compat.py:181:40 - error: Type "tuple[str, str]" is not assignable to declared type "tuple[str, str, int]"   "tuple[str, str]" is not assignable to "tuple[str, str, int]"     Tuple size mismatch; expected 3 but received 2 (reportAssignmentType) -tuples_type_compat.py:171:50 - error: Type "tuple[str, str]" is not assignable to declared type "tuple[str, str, str, *tuple[str, ...]]" +tuples_type_compat.py:184:50 - error: Type "tuple[str, str]" is not assignable to declared type "tuple[str, str, str, *tuple[str, ...]]"   "tuple[str, str]" is not assignable to "tuple[str, str, str, *tuple[str, ...]]"     Tuple size mismatch; expected 3 or more but received 2 (reportAssignmentType) -tuples_type_compat.py:175:50 - error: Type "tuple[str, str]" is not assignable to declared type "tuple[*tuple[str, ...], str, str, str]" +tuples_type_compat.py:188:50 - error: Type "tuple[str, str]" is not assignable to declared type "tuple[*tuple[str, ...], str, str, str]"   "tuple[str, str]" is not assignable to "tuple[*tuple[str, ...], str, str, str]"     Tuple size mismatch; expected 3 or more but received 2 (reportAssignmentType) """ diff --git a/conformance/results/pyright/version.toml b/conformance/results/pyright/version.toml index 57dacbb6..03b8b5c6 100644 --- a/conformance/results/pyright/version.toml +++ b/conformance/results/pyright/version.toml @@ -1,2 +1,2 @@ version = "pyright 1.1.399" -test_duration = 1.4 +test_duration = 1.1 diff --git a/conformance/results/pytype/overloads_definitions.toml b/conformance/results/pytype/overloads_definitions.toml index dc4444dc..5716f0e5 100644 --- a/conformance/results/pytype/overloads_definitions.toml +++ b/conformance/results/pytype/overloads_definitions.toml @@ -14,14 +14,15 @@ Lines 58, 59: Expected error (tag 'not_abstract') Lines 71, 73, 78, 81: Expected error (tag 'func5') Lines 84, 86, 90, 94: Expected error (tag 'func6') Lines 121, 123, 127: Expected error (tag 'invalid_final') -Lines 135, 137, 142: Expected error (tag 'invalid_final_2') -Lines 220, 222, 226: Expected error (tag 'override_impl') +Lines 135, 136, 137, 141, 142: Expected error (tag 'invalid_final_2') +Lines 220, 221, 222, 225, 226: Expected error (tag 'override_impl') Line 6: Unexpected errors ['overloads_definitions.py:6:1: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in : typing.override not supported yet [not-supported-yet]'] Line 43: Unexpected errors ["overloads_definitions.py:43:37: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in func3: @typing.overload-decorated 'MyProto.func3' object is not callable [not-callable]"] Line 53: Unexpected errors ["overloads_definitions.py:53:37: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in func4: @typing.overload-decorated 'MyAbstractBase.func4' object is not callable [not-callable]"] Line 63: Unexpected errors ["overloads_definitions.py:63:44: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in not_abstract: @typing.overload-decorated 'MyAbstractBase.not_abstract' object is not callable [not-callable]"] Line 74: Unexpected errors ['overloads_definitions.py:74:9: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in func5: bad return type [bad-return-type]'] Line 79: Unexpected errors ['overloads_definitions.py:79:9: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in func5: bad return type [bad-return-type]'] +Line 95: Unexpected errors ['overloads_definitions.py:95:16: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in func6: bad return type [bad-return-type]'] Line 117: Unexpected errors ['overloads_definitions.py:117:56: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in final_method: bad return type [bad-return-type]', 'overloads_definitions.py:117:56: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in final_method: bad return type [bad-return-type]'] Line 130: Unexpected errors ['overloads_definitions.py:130:1: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in invalid_final: bad return type [bad-return-type]', 'overloads_definitions.py:130:1: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in invalid_final: bad return type [bad-return-type]'] Line 146: Unexpected errors ['overloads_definitions.py:146:59: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in invalid_final_2: bad return type [bad-return-type]', 'overloads_definitions.py:146:59: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in invalid_final_2: bad return type [bad-return-type]'] @@ -73,6 +74,11 @@ overloads_definitions.py:79:9: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in f ... \u001b[1m\u001b[31m~~~\u001b[39m\u001b[0m +overloads_definitions.py:95:16: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in func6: bad return type [bad-return-type] + + return 1 + \u001b[1m\u001b[31m~\u001b[39m\u001b[0m + overloads_definitions.py:117:56: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in final_method: bad return type [bad-return-type] def final_method(self, x: int | str) -> int | str: ... @@ -225,20 +231,20 @@ class Child(Base): # E[override-final] \u001b[1m\u001b[31m~~~~~~~~~~~~~~~~~~~~~~~~~~~\u001b[39m\u001b[0m \u001b[1m\u001b[31m\u001b[39m\u001b[0m - @overload # E[override_impl]: @override should appear only on implementation -\u001b[1m\u001b[31m~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\u001b[39m\u001b[0m - @override -\u001b[1m\u001b[31m~~~~~~~~~~~~~\u001b[39m\u001b[0m - def to_override(self, x: int) -> int: ... # E[override_impl] -\u001b[1m\u001b[31m~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\u001b[39m\u001b[0m + @overload # E[override_impl+]: @override should appear only on implementation +\u001b[1m\u001b[31m~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\u001b[39m\u001b[0m + @override # E[override_impl+] +\u001b[1m\u001b[31m~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\u001b[39m\u001b[0m + def to_override(self, x: int) -> int: ... # E[override_impl+] +\u001b[1m\u001b[31m~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\u001b[39m\u001b[0m \u001b[1m\u001b[31m\u001b[39m\u001b[0m @overload \u001b[1m\u001b[31m~~~~~~~~~~~~~\u001b[39m\u001b[0m - @override -\u001b[1m\u001b[31m~~~~~~~~~~~~~\u001b[39m\u001b[0m - def to_override(self, x: str) -> str: ... # E[override_impl] -\u001b[1m\u001b[31m~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\u001b[39m\u001b[0m + @override # E[override_impl+] +\u001b[1m\u001b[31m~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\u001b[39m\u001b[0m + def to_override(self, x: str) -> str: ... # E[override_impl+] +\u001b[1m\u001b[31m~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\u001b[39m\u001b[0m \u001b[1m\u001b[31m\u001b[39m\u001b[0m @override diff --git a/conformance/results/pytype/tuples_type_compat.toml b/conformance/results/pytype/tuples_type_compat.toml index 029eb713..d7c19176 100644 --- a/conformance/results/pytype/tuples_type_compat.toml +++ b/conformance/results/pytype/tuples_type_compat.toml @@ -25,257 +25,257 @@ tuples_type_compat.py:47:5: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in func v6: tuple[int, *tuple[str, ...]] = t3 # OK \u001b[1m\u001b[31m~~\u001b[39m\u001b[0m -tuples_type_compat.py:71:47: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in : Invalid type annotation '' [invalid-annotation] +tuples_type_compat.py:70:56: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in : Invalid type annotation '' [invalid-annotation] -def func5(val: tuple[int] | tuple[str, str] | tuple[int, *tuple[str, ...], int]): - \u001b[1m\u001b[31m~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\u001b[39m\u001b[0m +Func5Input: TypeAlias = tuple[int] | tuple[str, str] | tuple[int, *tuple[str, ...], int] + \u001b[1m\u001b[31m~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\u001b[39m\u001b[0m -tuples_type_compat.py:74:9: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in func5: tuple [assert-type] +tuples_type_compat.py:75:9: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in func5: tuple [assert-type] - assert_type(val, tuple[int]) # tuple[int] + assert_type(val, tuple[int]) # E[func5_1] \u001b[1m\u001b[31m~~~~~~~~~~~~~~~~~~~~~~~~~~~~\u001b[39m\u001b[0m -tuples_type_compat.py:78:9: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in func5: tuple [assert-type] +tuples_type_compat.py:80:9: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in func5: tuple [assert-type] - assert_type(val, tuple[str, str] | tuple[int, int]) + assert_type(val, tuple[str, str] | tuple[int, int]) # E[func5_2] \u001b[1m\u001b[31m~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\u001b[39m\u001b[0m -tuples_type_compat.py:82:9: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in func5: tuple [assert-type] +tuples_type_compat.py:85:9: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in func5: tuple [assert-type] - assert_type(val, tuple[int, str, int]) + assert_type(val, tuple[int, str, int]) # E[func5_3] \u001b[1m\u001b[31m~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\u001b[39m\u001b[0m -tuples_type_compat.py:91:47: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in : Invalid type annotation '' [invalid-annotation] +tuples_type_compat.py:94:56: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in : Invalid type annotation '' [invalid-annotation] -def func6(val: tuple[int] | tuple[str, str] | tuple[int, *tuple[str, ...], int]): - \u001b[1m\u001b[31m~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\u001b[39m\u001b[0m +Func6Input: TypeAlias = tuple[int] | tuple[str, str] | tuple[int, *tuple[str, ...], int] + \u001b[1m\u001b[31m~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\u001b[39m\u001b[0m -tuples_type_compat.py:115:13: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in func7: tuple[Union[int, str], Union[int, str]] [assert-type] +tuples_type_compat.py:126:13: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in func7: tuple[Union[int, str], Union[int, str]] [assert-type] - assert_type(subj, tuple[int | str, str]) + assert_type(subj, tuple[int | str, str]) # E[func7_1] \u001b[1m\u001b[31m~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\u001b[39m\u001b[0m -tuples_type_compat.py:117:13: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in func7: tuple[Union[int, str], Union[int, str]] [assert-type] +tuples_type_compat.py:129:13: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in func7: tuple[Union[int, str], Union[int, str]] [assert-type] - assert_type(subj, tuple[int | str, int]) + assert_type(subj, tuple[int | str, int]) # E[func7_2] \u001b[1m\u001b[31m~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\u001b[39m\u001b[0m -tuples_type_compat.py:134:40: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in : Invalid type annotation '' [invalid-annotation] +tuples_type_compat.py:147:40: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in : Invalid type annotation '' [invalid-annotation] t1: tuple[complex, list[int]], t2: tuple[int, *tuple[str, ...]], t3: tuple[()] \u001b[1m\u001b[31m~~~~~~~~~~~~~~~~~~~~~~~~~~~~\u001b[39m\u001b[0m -tuples_type_compat.py:139:5: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in func8: Sequence [assert-type] +tuples_type_compat.py:152:5: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in func8: Sequence [assert-type] assert_type(test_seq(t2), Sequence[int | str]) # Could be Sequence[object] \u001b[1m\u001b[31m~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\u001b[39m\u001b[0m -tuples_type_compat.py:140:5: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in func8: Sequence [assert-type] +tuples_type_compat.py:153:5: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in func8: Sequence [assert-type] assert_type(test_seq(t3), Sequence[Never]) \u001b[1m\u001b[31m~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\u001b[39m\u001b[0m -tuples_type_compat.py:143:1: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in : Type annotation for t1 does not match type of assignment [annotation-type-mismatch] +tuples_type_compat.py:156:1: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in : Type annotation for t1 does not match type of assignment [annotation-type-mismatch] t1: tuple[int, *tuple[str]] = (1, "") # OK \u001b[1m\u001b[31m~~\u001b[39m\u001b[0m -tuples_type_compat.py:143:1: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in : Invalid type annotation 'tuple[int, *tuple[str]]' [invalid-annotation] +tuples_type_compat.py:156:1: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in : Invalid type annotation 'tuple[int, *tuple[str]]' [invalid-annotation] t1: tuple[int, *tuple[str]] = (1, "") # OK \u001b[1m\u001b[31m~~\u001b[39m\u001b[0m -tuples_type_compat.py:143:5: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in : Invalid type annotation '' [invalid-annotation] +tuples_type_compat.py:156:5: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in : Invalid type annotation '' [invalid-annotation] t1: tuple[int, *tuple[str]] = (1, "") # OK \u001b[1m\u001b[31m~~~~~~~~~~~~~~~~~~~~~~~\u001b[39m\u001b[0m -tuples_type_compat.py:144:1: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in : Type annotation for t1 does not match type of assignment [annotation-type-mismatch] +tuples_type_compat.py:157:1: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in : Type annotation for t1 does not match type of assignment [annotation-type-mismatch] t1 = (1, "", "") # E \u001b[1m\u001b[31m~~\u001b[39m\u001b[0m -tuples_type_compat.py:146:1: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in : Invalid type annotation 'tuple[int, *tuple[str, ...]]' [invalid-annotation] +tuples_type_compat.py:159:1: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in : Invalid type annotation 'tuple[int, *tuple[str, ...]]' [invalid-annotation] t2: tuple[int, *tuple[str, ...]] = (1,) # OK \u001b[1m\u001b[31m~~\u001b[39m\u001b[0m -tuples_type_compat.py:146:5: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in : Invalid type annotation '' [invalid-annotation] +tuples_type_compat.py:159:5: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in : Invalid type annotation '' [invalid-annotation] t2: tuple[int, *tuple[str, ...]] = (1,) # OK \u001b[1m\u001b[31m~~~~~~~~~~~~~~~~~~~~~~~~~~~~\u001b[39m\u001b[0m -tuples_type_compat.py:147:1: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in : Type annotation for t2 does not match type of assignment [annotation-type-mismatch] +tuples_type_compat.py:160:1: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in : Type annotation for t2 does not match type of assignment [annotation-type-mismatch] t2 = (1, "") # OK \u001b[1m\u001b[31m~~\u001b[39m\u001b[0m -tuples_type_compat.py:148:1: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in : Type annotation for t2 does not match type of assignment [annotation-type-mismatch] +tuples_type_compat.py:161:1: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in : Type annotation for t2 does not match type of assignment [annotation-type-mismatch] t2 = (1, "", "") # OK \u001b[1m\u001b[31m~~\u001b[39m\u001b[0m -tuples_type_compat.py:149:1: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in : Type annotation for t2 does not match type of assignment [annotation-type-mismatch] +tuples_type_compat.py:162:1: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in : Type annotation for t2 does not match type of assignment [annotation-type-mismatch] t2 = (1, 1, "") # E \u001b[1m\u001b[31m~~\u001b[39m\u001b[0m -tuples_type_compat.py:150:1: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in : Type annotation for t2 does not match type of assignment [annotation-type-mismatch] +tuples_type_compat.py:163:1: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in : Type annotation for t2 does not match type of assignment [annotation-type-mismatch] t2 = (1, "", 1) # E \u001b[1m\u001b[31m~~\u001b[39m\u001b[0m -tuples_type_compat.py:153:1: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in : Type annotation for t3 does not match type of assignment [annotation-type-mismatch] +tuples_type_compat.py:166:1: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in : Type annotation for t3 does not match type of assignment [annotation-type-mismatch] t3: tuple[int, *tuple[str, ...], int] = (1, 2) # OK \u001b[1m\u001b[31m~~\u001b[39m\u001b[0m -tuples_type_compat.py:153:1: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in : Invalid type annotation 'tuple[int, *tuple[str, ...], int]' [invalid-annotation] +tuples_type_compat.py:166:1: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in : Invalid type annotation 'tuple[int, *tuple[str, ...], int]' [invalid-annotation] t3: tuple[int, *tuple[str, ...], int] = (1, 2) # OK \u001b[1m\u001b[31m~~\u001b[39m\u001b[0m -tuples_type_compat.py:153:5: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in : Invalid type annotation '' [invalid-annotation] +tuples_type_compat.py:166:5: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in : Invalid type annotation '' [invalid-annotation] t3: tuple[int, *tuple[str, ...], int] = (1, 2) # OK \u001b[1m\u001b[31m~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\u001b[39m\u001b[0m -tuples_type_compat.py:154:1: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in : Type annotation for t3 does not match type of assignment [annotation-type-mismatch] +tuples_type_compat.py:167:1: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in : Type annotation for t3 does not match type of assignment [annotation-type-mismatch] t3 = (1, "", 2) # OK \u001b[1m\u001b[31m~~\u001b[39m\u001b[0m -tuples_type_compat.py:155:1: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in : Type annotation for t3 does not match type of assignment [annotation-type-mismatch] +tuples_type_compat.py:168:1: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in : Type annotation for t3 does not match type of assignment [annotation-type-mismatch] t3 = (1, "", "", 2) # OK \u001b[1m\u001b[31m~~\u001b[39m\u001b[0m -tuples_type_compat.py:156:1: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in : Type annotation for t3 does not match type of assignment [annotation-type-mismatch] +tuples_type_compat.py:169:1: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in : Type annotation for t3 does not match type of assignment [annotation-type-mismatch] t3 = (1, "", "") # E \u001b[1m\u001b[31m~~\u001b[39m\u001b[0m -tuples_type_compat.py:157:1: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in : Type annotation for t3 does not match type of assignment [annotation-type-mismatch] +tuples_type_compat.py:170:1: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in : Type annotation for t3 does not match type of assignment [annotation-type-mismatch] t3 = (1, "", "", 1.2) # E \u001b[1m\u001b[31m~~\u001b[39m\u001b[0m -tuples_type_compat.py:159:1: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in : Invalid type annotation 'tuple[*tuple[str, ...], int]' [invalid-annotation] +tuples_type_compat.py:172:1: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in : Invalid type annotation 'tuple[*tuple[str, ...], int]' [invalid-annotation] t4: tuple[*tuple[str, ...], int] = (1,) # OK \u001b[1m\u001b[31m~~\u001b[39m\u001b[0m -tuples_type_compat.py:159:5: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in : Invalid type annotation '' [invalid-annotation] +tuples_type_compat.py:172:5: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in : Invalid type annotation '' [invalid-annotation] t4: tuple[*tuple[str, ...], int] = (1,) # OK \u001b[1m\u001b[31m~~~~~~~~~~~~~~~~~~~~~~~~~~~~\u001b[39m\u001b[0m -tuples_type_compat.py:160:1: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in : Type annotation for t4 does not match type of assignment [annotation-type-mismatch] +tuples_type_compat.py:173:1: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in : Type annotation for t4 does not match type of assignment [annotation-type-mismatch] t4 = ("", 1) # OK \u001b[1m\u001b[31m~~\u001b[39m\u001b[0m -tuples_type_compat.py:161:1: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in : Type annotation for t4 does not match type of assignment [annotation-type-mismatch] +tuples_type_compat.py:174:1: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in : Type annotation for t4 does not match type of assignment [annotation-type-mismatch] t4 = ("", "", 1) # OK \u001b[1m\u001b[31m~~\u001b[39m\u001b[0m -tuples_type_compat.py:162:1: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in : Type annotation for t4 does not match type of assignment [annotation-type-mismatch] +tuples_type_compat.py:175:1: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in : Type annotation for t4 does not match type of assignment [annotation-type-mismatch] t4 = (1, "", 1) # E \u001b[1m\u001b[31m~~\u001b[39m\u001b[0m -tuples_type_compat.py:163:1: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in : Type annotation for t4 does not match type of assignment [annotation-type-mismatch] +tuples_type_compat.py:176:1: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in : Type annotation for t4 does not match type of assignment [annotation-type-mismatch] t4 = ("", "", 1.2) # E \u001b[1m\u001b[31m~~\u001b[39m\u001b[0m -tuples_type_compat.py:167:5: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in func9: Type annotation for t1 does not match type of assignment [annotation-type-mismatch] +tuples_type_compat.py:180:5: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in func9: Type annotation for t1 does not match type of assignment [annotation-type-mismatch] t1: tuple[str, str, *tuple[int, ...]] = a # OK \u001b[1m\u001b[31m~~\u001b[39m\u001b[0m -tuples_type_compat.py:167:5: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in func9: Invalid type annotation 'tuple[str, str, *tuple[int, ...]]' [invalid-annotation] +tuples_type_compat.py:180:5: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in func9: Invalid type annotation 'tuple[str, str, *tuple[int, ...]]' [invalid-annotation] t1: tuple[str, str, *tuple[int, ...]] = a # OK \u001b[1m\u001b[31m~~\u001b[39m\u001b[0m -tuples_type_compat.py:168:5: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in func9: Type annotation for t2 does not match type of assignment [annotation-type-mismatch] +tuples_type_compat.py:181:5: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in func9: Type annotation for t2 does not match type of assignment [annotation-type-mismatch] t2: tuple[str, str, *tuple[int]] = a # E \u001b[1m\u001b[31m~~\u001b[39m\u001b[0m -tuples_type_compat.py:168:5: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in func9: Invalid type annotation 'tuple[str, str, *tuple[int]]' [invalid-annotation] +tuples_type_compat.py:181:5: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in func9: Invalid type annotation 'tuple[str, str, *tuple[int]]' [invalid-annotation] t2: tuple[str, str, *tuple[int]] = a # E \u001b[1m\u001b[31m~~\u001b[39m\u001b[0m -tuples_type_compat.py:169:5: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in func9: Type annotation for t3 does not match type of assignment [annotation-type-mismatch] +tuples_type_compat.py:182:5: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in func9: Type annotation for t3 does not match type of assignment [annotation-type-mismatch] t3: tuple[str, *tuple[str, ...]] = a # OK \u001b[1m\u001b[31m~~\u001b[39m\u001b[0m -tuples_type_compat.py:169:5: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in func9: Invalid type annotation 'tuple[str, *tuple[str, ...]]' [invalid-annotation] +tuples_type_compat.py:182:5: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in func9: Invalid type annotation 'tuple[str, *tuple[str, ...]]' [invalid-annotation] t3: tuple[str, *tuple[str, ...]] = a # OK \u001b[1m\u001b[31m~~\u001b[39m\u001b[0m -tuples_type_compat.py:170:5: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in func9: Type annotation for t4 does not match type of assignment [annotation-type-mismatch] +tuples_type_compat.py:183:5: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in func9: Type annotation for t4 does not match type of assignment [annotation-type-mismatch] t4: tuple[str, str, *tuple[str, ...]] = a # OK \u001b[1m\u001b[31m~~\u001b[39m\u001b[0m -tuples_type_compat.py:170:5: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in func9: Invalid type annotation 'tuple[str, str, *tuple[str, ...]]' [invalid-annotation] +tuples_type_compat.py:183:5: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in func9: Invalid type annotation 'tuple[str, str, *tuple[str, ...]]' [invalid-annotation] t4: tuple[str, str, *tuple[str, ...]] = a # OK \u001b[1m\u001b[31m~~\u001b[39m\u001b[0m -tuples_type_compat.py:171:5: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in func9: Type annotation for t5 does not match type of assignment [annotation-type-mismatch] +tuples_type_compat.py:184:5: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in func9: Type annotation for t5 does not match type of assignment [annotation-type-mismatch] t5: tuple[str, str, str, *tuple[str, ...]] = a # E \u001b[1m\u001b[31m~~\u001b[39m\u001b[0m -tuples_type_compat.py:171:5: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in func9: Invalid type annotation 'tuple[str, str, str, *tuple[str, ...]]' [invalid-annotation] +tuples_type_compat.py:184:5: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in func9: Invalid type annotation 'tuple[str, str, str, *tuple[str, ...]]' [invalid-annotation] t5: tuple[str, str, str, *tuple[str, ...]] = a # E \u001b[1m\u001b[31m~~\u001b[39m\u001b[0m -tuples_type_compat.py:172:5: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in func9: Type annotation for t6 does not match type of assignment [annotation-type-mismatch] +tuples_type_compat.py:185:5: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in func9: Type annotation for t6 does not match type of assignment [annotation-type-mismatch] t6: tuple[str, *tuple[int, ...], str] = a # OK \u001b[1m\u001b[31m~~\u001b[39m\u001b[0m -tuples_type_compat.py:172:5: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in func9: Invalid type annotation 'tuple[str, *tuple[int, ...], str]' [invalid-annotation] +tuples_type_compat.py:185:5: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in func9: Invalid type annotation 'tuple[str, *tuple[int, ...], str]' [invalid-annotation] t6: tuple[str, *tuple[int, ...], str] = a # OK \u001b[1m\u001b[31m~~\u001b[39m\u001b[0m -tuples_type_compat.py:173:5: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in func9: Type annotation for t7 does not match type of assignment [annotation-type-mismatch] +tuples_type_compat.py:186:5: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in func9: Type annotation for t7 does not match type of assignment [annotation-type-mismatch] t7: tuple[*tuple[str, ...], str] = a # OK \u001b[1m\u001b[31m~~\u001b[39m\u001b[0m -tuples_type_compat.py:173:5: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in func9: Invalid type annotation 'tuple[*tuple[str, ...], str]' [invalid-annotation] +tuples_type_compat.py:186:5: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in func9: Invalid type annotation 'tuple[*tuple[str, ...], str]' [invalid-annotation] t7: tuple[*tuple[str, ...], str] = a # OK \u001b[1m\u001b[31m~~\u001b[39m\u001b[0m -tuples_type_compat.py:174:5: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in func9: Type annotation for t8 does not match type of assignment [annotation-type-mismatch] +tuples_type_compat.py:187:5: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in func9: Type annotation for t8 does not match type of assignment [annotation-type-mismatch] t8: tuple[*tuple[str, ...], str] = a # OK \u001b[1m\u001b[31m~~\u001b[39m\u001b[0m -tuples_type_compat.py:174:5: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in func9: Invalid type annotation 'tuple[*tuple[str, ...], str]' [invalid-annotation] +tuples_type_compat.py:187:5: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in func9: Invalid type annotation 'tuple[*tuple[str, ...], str]' [invalid-annotation] t8: tuple[*tuple[str, ...], str] = a # OK \u001b[1m\u001b[31m~~\u001b[39m\u001b[0m -tuples_type_compat.py:175:5: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in func9: Type annotation for t9 does not match type of assignment [annotation-type-mismatch] +tuples_type_compat.py:188:5: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in func9: Type annotation for t9 does not match type of assignment [annotation-type-mismatch] t9: tuple[*tuple[str, ...], str, str, str] = a # E \u001b[1m\u001b[31m~~\u001b[39m\u001b[0m -tuples_type_compat.py:175:5: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in func9: Invalid type annotation 'tuple[*tuple[str, ...], str, str, str]' [invalid-annotation] +tuples_type_compat.py:188:5: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in func9: Invalid type annotation 'tuple[*tuple[str, ...], str, str, str]' [invalid-annotation] t9: tuple[*tuple[str, ...], str, str, str] = a # E \u001b[1m\u001b[31m~~\u001b[39m\u001b[0m @@ -288,33 +288,31 @@ Line 32: Expected 1 errors Line 33: Expected 1 errors Line 43: Expected 1 errors Line 62: Expected 1 errors +Lines 101, 102: Expected error (tag 'func6_1') +Lines 106, 107: Expected error (tag 'func6_2') +Lines 111, 112: Expected error (tag 'func6_3') Line 22: Unexpected errors ["tuples_type_compat.py:22:31: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in : Invalid type annotation '' [invalid-annotation]"] Line 27: Unexpected errors ["tuples_type_compat.py:27:5: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in func2: Invalid type annotation 'tuple[int, *tuple[int, ...]]' [invalid-annotation]"] Line 47: Unexpected errors ["tuples_type_compat.py:47:5: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in func3: Invalid type annotation 'tuple[int, *tuple[str, ...]]' [invalid-annotation]"] -Line 71: Unexpected errors ["tuples_type_compat.py:71:47: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in : Invalid type annotation '' [invalid-annotation]"] -Line 74: Unexpected errors ['tuples_type_compat.py:74:9: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in func5: tuple [assert-type]'] -Line 78: Unexpected errors ['tuples_type_compat.py:78:9: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in func5: tuple [assert-type]'] -Line 82: Unexpected errors ['tuples_type_compat.py:82:9: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in func5: tuple [assert-type]'] -Line 91: Unexpected errors ["tuples_type_compat.py:91:47: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in : Invalid type annotation '' [invalid-annotation]"] -Line 115: Unexpected errors ['tuples_type_compat.py:115:13: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in func7: tuple[Union[int, str], Union[int, str]] [assert-type]'] -Line 117: Unexpected errors ['tuples_type_compat.py:117:13: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in func7: tuple[Union[int, str], Union[int, str]] [assert-type]'] -Line 134: Unexpected errors ["tuples_type_compat.py:134:40: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in : Invalid type annotation '' [invalid-annotation]"] -Line 139: Unexpected errors ['tuples_type_compat.py:139:5: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in func8: Sequence [assert-type]'] -Line 140: Unexpected errors ['tuples_type_compat.py:140:5: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in func8: Sequence [assert-type]'] -Line 143: Unexpected errors ['tuples_type_compat.py:143:1: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in : Type annotation for t1 does not match type of assignment [annotation-type-mismatch]', "tuples_type_compat.py:143:1: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in : Invalid type annotation 'tuple[int, *tuple[str]]' [invalid-annotation]", "tuples_type_compat.py:143:5: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in : Invalid type annotation '' [invalid-annotation]"] -Line 146: Unexpected errors ["tuples_type_compat.py:146:1: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in : Invalid type annotation 'tuple[int, *tuple[str, ...]]' [invalid-annotation]", "tuples_type_compat.py:146:5: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in : Invalid type annotation '' [invalid-annotation]"] -Line 147: Unexpected errors ['tuples_type_compat.py:147:1: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in : Type annotation for t2 does not match type of assignment [annotation-type-mismatch]'] -Line 148: Unexpected errors ['tuples_type_compat.py:148:1: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in : Type annotation for t2 does not match type of assignment [annotation-type-mismatch]'] -Line 153: Unexpected errors ['tuples_type_compat.py:153:1: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in : Type annotation for t3 does not match type of assignment [annotation-type-mismatch]', "tuples_type_compat.py:153:1: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in : Invalid type annotation 'tuple[int, *tuple[str, ...], int]' [invalid-annotation]", "tuples_type_compat.py:153:5: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in : Invalid type annotation '' [invalid-annotation]"] -Line 154: Unexpected errors ['tuples_type_compat.py:154:1: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in : Type annotation for t3 does not match type of assignment [annotation-type-mismatch]'] -Line 155: Unexpected errors ['tuples_type_compat.py:155:1: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in : Type annotation for t3 does not match type of assignment [annotation-type-mismatch]'] -Line 159: Unexpected errors ["tuples_type_compat.py:159:1: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in : Invalid type annotation 'tuple[*tuple[str, ...], int]' [invalid-annotation]", "tuples_type_compat.py:159:5: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in : Invalid type annotation '' [invalid-annotation]"] -Line 160: Unexpected errors ['tuples_type_compat.py:160:1: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in : Type annotation for t4 does not match type of assignment [annotation-type-mismatch]'] -Line 161: Unexpected errors ['tuples_type_compat.py:161:1: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in : Type annotation for t4 does not match type of assignment [annotation-type-mismatch]'] -Line 167: Unexpected errors ['tuples_type_compat.py:167:5: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in func9: Type annotation for t1 does not match type of assignment [annotation-type-mismatch]', "tuples_type_compat.py:167:5: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in func9: Invalid type annotation 'tuple[str, str, *tuple[int, ...]]' [invalid-annotation]"] -Line 169: Unexpected errors ['tuples_type_compat.py:169:5: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in func9: Type annotation for t3 does not match type of assignment [annotation-type-mismatch]', "tuples_type_compat.py:169:5: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in func9: Invalid type annotation 'tuple[str, *tuple[str, ...]]' [invalid-annotation]"] -Line 170: Unexpected errors ['tuples_type_compat.py:170:5: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in func9: Type annotation for t4 does not match type of assignment [annotation-type-mismatch]', "tuples_type_compat.py:170:5: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in func9: Invalid type annotation 'tuple[str, str, *tuple[str, ...]]' [invalid-annotation]"] -Line 172: Unexpected errors ['tuples_type_compat.py:172:5: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in func9: Type annotation for t6 does not match type of assignment [annotation-type-mismatch]', "tuples_type_compat.py:172:5: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in func9: Invalid type annotation 'tuple[str, *tuple[int, ...], str]' [invalid-annotation]"] -Line 173: Unexpected errors ['tuples_type_compat.py:173:5: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in func9: Type annotation for t7 does not match type of assignment [annotation-type-mismatch]', "tuples_type_compat.py:173:5: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in func9: Invalid type annotation 'tuple[*tuple[str, ...], str]' [invalid-annotation]"] -Line 174: Unexpected errors ['tuples_type_compat.py:174:5: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in func9: Type annotation for t8 does not match type of assignment [annotation-type-mismatch]', "tuples_type_compat.py:174:5: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in func9: Invalid type annotation 'tuple[*tuple[str, ...], str]' [invalid-annotation]"] +Line 70: Unexpected errors ["tuples_type_compat.py:70:56: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in : Invalid type annotation '' [invalid-annotation]"] +Line 94: Unexpected errors ["tuples_type_compat.py:94:56: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in : Invalid type annotation '' [invalid-annotation]"] +Line 147: Unexpected errors ["tuples_type_compat.py:147:40: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in : Invalid type annotation '' [invalid-annotation]"] +Line 152: Unexpected errors ['tuples_type_compat.py:152:5: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in func8: Sequence [assert-type]'] +Line 153: Unexpected errors ['tuples_type_compat.py:153:5: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in func8: Sequence [assert-type]'] +Line 156: Unexpected errors ['tuples_type_compat.py:156:1: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in : Type annotation for t1 does not match type of assignment [annotation-type-mismatch]', "tuples_type_compat.py:156:1: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in : Invalid type annotation 'tuple[int, *tuple[str]]' [invalid-annotation]", "tuples_type_compat.py:156:5: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in : Invalid type annotation '' [invalid-annotation]"] +Line 159: Unexpected errors ["tuples_type_compat.py:159:1: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in : Invalid type annotation 'tuple[int, *tuple[str, ...]]' [invalid-annotation]", "tuples_type_compat.py:159:5: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in : Invalid type annotation '' [invalid-annotation]"] +Line 160: Unexpected errors ['tuples_type_compat.py:160:1: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in : Type annotation for t2 does not match type of assignment [annotation-type-mismatch]'] +Line 161: Unexpected errors ['tuples_type_compat.py:161:1: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in : Type annotation for t2 does not match type of assignment [annotation-type-mismatch]'] +Line 166: Unexpected errors ['tuples_type_compat.py:166:1: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in : Type annotation for t3 does not match type of assignment [annotation-type-mismatch]', "tuples_type_compat.py:166:1: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in : Invalid type annotation 'tuple[int, *tuple[str, ...], int]' [invalid-annotation]", "tuples_type_compat.py:166:5: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in : Invalid type annotation '' [invalid-annotation]"] +Line 167: Unexpected errors ['tuples_type_compat.py:167:1: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in : Type annotation for t3 does not match type of assignment [annotation-type-mismatch]'] +Line 168: Unexpected errors ['tuples_type_compat.py:168:1: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in : Type annotation for t3 does not match type of assignment [annotation-type-mismatch]'] +Line 172: Unexpected errors ["tuples_type_compat.py:172:1: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in : Invalid type annotation 'tuple[*tuple[str, ...], int]' [invalid-annotation]", "tuples_type_compat.py:172:5: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in : Invalid type annotation '' [invalid-annotation]"] +Line 173: Unexpected errors ['tuples_type_compat.py:173:1: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in : Type annotation for t4 does not match type of assignment [annotation-type-mismatch]'] +Line 174: Unexpected errors ['tuples_type_compat.py:174:1: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in : Type annotation for t4 does not match type of assignment [annotation-type-mismatch]'] +Line 180: Unexpected errors ['tuples_type_compat.py:180:5: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in func9: Type annotation for t1 does not match type of assignment [annotation-type-mismatch]', "tuples_type_compat.py:180:5: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in func9: Invalid type annotation 'tuple[str, str, *tuple[int, ...]]' [invalid-annotation]"] +Line 182: Unexpected errors ['tuples_type_compat.py:182:5: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in func9: Type annotation for t3 does not match type of assignment [annotation-type-mismatch]', "tuples_type_compat.py:182:5: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in func9: Invalid type annotation 'tuple[str, *tuple[str, ...]]' [invalid-annotation]"] +Line 183: Unexpected errors ['tuples_type_compat.py:183:5: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in func9: Type annotation for t4 does not match type of assignment [annotation-type-mismatch]', "tuples_type_compat.py:183:5: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in func9: Invalid type annotation 'tuple[str, str, *tuple[str, ...]]' [invalid-annotation]"] +Line 185: Unexpected errors ['tuples_type_compat.py:185:5: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in func9: Type annotation for t6 does not match type of assignment [annotation-type-mismatch]', "tuples_type_compat.py:185:5: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in func9: Invalid type annotation 'tuple[str, *tuple[int, ...], str]' [invalid-annotation]"] +Line 186: Unexpected errors ['tuples_type_compat.py:186:5: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in func9: Type annotation for t7 does not match type of assignment [annotation-type-mismatch]', "tuples_type_compat.py:186:5: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in func9: Invalid type annotation 'tuple[*tuple[str, ...], str]' [invalid-annotation]"] +Line 187: Unexpected errors ['tuples_type_compat.py:187:5: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in func9: Type annotation for t8 does not match type of assignment [annotation-type-mismatch]', "tuples_type_compat.py:187:5: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in func9: Invalid type annotation 'tuple[*tuple[str, ...], str]' [invalid-annotation]"] """ diff --git a/conformance/results/pytype/version.toml b/conformance/results/pytype/version.toml index 57c8a1ff..3a84f443 100644 --- a/conformance/results/pytype/version.toml +++ b/conformance/results/pytype/version.toml @@ -1,2 +1,2 @@ version = "pytype 2024.10.11" -test_duration = 35.2 +test_duration = 31.3 diff --git a/conformance/results/results.html b/conformance/results/results.html index 85500563..dc93d81f 100644 --- a/conformance/results/results.html +++ b/conformance/results/results.html @@ -159,16 +159,16 @@

Python Type System Conformance Test Results

 
mypy 1.15.0
-
2.3sec
+
1.8sec
pyright 1.1.399
-
1.4sec
+
1.1sec
pyre 0.9.23
-
8.2sec
+
9.0sec
pytype 2024.10.11
-
35.2sec
+
31.3sec
diff --git a/conformance/src/main.py b/conformance/src/main.py index 0c8a3b5a..4c9342a6 100644 --- a/conformance/src/main.py +++ b/conformance/src/main.py @@ -45,13 +45,15 @@ def run_tests( def get_expected_errors(test_case: Path) -> tuple[ dict[int, tuple[int, int]], - dict[str, list[int]], + dict[str, tuple[list[int], bool]], ]: """Return the line numbers where type checkers are expected to produce an error. The return value is a tuple of two dictionaries: - The format of the first is {line number: (number of required errors, number of optional errors)}. - - The format of the second is {error tag: [lines where the error may appear]}. + - The format of the second is {error tag: ([lines where the error may appear], allow multiple}. + If allow multiple is True, the error may appear on multiple lines; otherwise, it must + appear exactly once. For example, the following test case: @@ -64,13 +66,13 @@ def f(): pass # E[final] ( {1: (1, 0), 2: (0, 1)}, - {"final": [3, 4]} + {"final": ([3, 4], False)} ) """ with open(test_case, "r", encoding="utf-8") as f: lines = f.readlines() output: dict[int, tuple[int, int]] = {} - groups: dict[str, list[int]] = {} + groups: dict[str, tuple[list[int], bool]] = {} for i, line in enumerate(lines, start=1): line_without_comment, *_ = line.split("#") # Ignore lines with no non-comment content. This allows commenting out test cases. @@ -86,7 +88,18 @@ def f(): pass # E[final] if required or optional: output[i] = (required, optional) for match in re.finditer(r"# E\[([^\]]+)\]", line): - groups.setdefault(match.group(1), []).append(i) + tag = match.group(1) + if tag.endswith("+"): + allow_multiple = True + tag = tag[:-1] + else: + allow_multiple = False + if tag not in groups: + groups[tag] = ([i], allow_multiple) + else: + if groups[tag][1] != allow_multiple: + raise ValueError(f"Error group {tag} has inconsistent allow_multiple value in {test_case}") + groups[tag][0].append(i) for group, linenos in groups.items(): if len(linenos) == 1: raise ValueError(f"Error group {group} only appears on a single line in {test_case}") @@ -119,11 +132,14 @@ def diff_expected_errors( # We don't report an issue if the count differs, because type checkers may produce # multiple error messages for a single line. linenos_used_by_groups: set[int] = set() - for group, linenos in error_groups.items(): - if not any(lineno in errors for lineno in linenos): + for group, (linenos, allow_multiple) in error_groups.items(): + num_errors = sum(1 for lineno in linenos if lineno in errors) + if num_errors == 0: differences.append(f"Lines {', '.join(map(str, linenos))}: Expected error (tag {group!r})") - else: + elif num_errors == 1 or allow_multiple: linenos_used_by_groups.update(linenos) + else: + differences.append(f"Lines {', '.join(map(str, linenos))}: Expected exactly one error (tag {group!r})") for actual_lineno, actual_errors in errors.items(): if actual_lineno not in expected_errors and actual_lineno not in linenos_used_by_groups: differences.append(f"Line {actual_lineno}: Unexpected errors {actual_errors}") diff --git a/conformance/tests/aliases_type_statement.py b/conformance/tests/aliases_type_statement.py index 024b4098..c373b53e 100644 --- a/conformance/tests/aliases_type_statement.py +++ b/conformance/tests/aliases_type_statement.py @@ -85,5 +85,5 @@ def func3(): type RecursiveTypeAlias5[T] = T | list[RecursiveTypeAlias5[T]] -type RecursiveTypeAlias6 = RecursiveTypeAlias7 # E[RTA6]: circular definition -type RecursiveTypeAlias7 = RecursiveTypeAlias6 # E[RTA6]: circular definition +type RecursiveTypeAlias6 = RecursiveTypeAlias7 # E[RTA6+]: circular definition +type RecursiveTypeAlias7 = RecursiveTypeAlias6 # E[RTA6+]: circular definition diff --git a/conformance/tests/overloads_definitions.py b/conformance/tests/overloads_definitions.py index d6c0267e..bf8be66b 100644 --- a/conformance/tests/overloads_definitions.py +++ b/conformance/tests/overloads_definitions.py @@ -70,28 +70,28 @@ def not_abstract(self, x: str) -> str: ... class C: @overload # E[func5] @staticmethod - def func5(x: int) -> int: # E[func5] + def func5(x: int, /) -> int: # E[func5] ... @overload @staticmethod - def func5(x: str) -> str: # E[func5] + def func5(x: str, /) -> str: # E[func5] ... - def func5(self, x: int | str) -> int | str: # E[func5] + def func5(*args: object) -> int | str: # E[func5] return 1 @overload # E[func6] @classmethod - def func6(cls, x: int) -> int: # E[func6] + def func6(cls, x: int, /) -> int: # E[func6] ... @overload - def func6(cls, x: str) -> str: # E[func6] + def func6(self, x: str, /) -> str: # E[func6] ... @classmethod - def func6(cls, x: int | str) -> int | str: # E[func6] + def func6(cls, *args: int | str) -> int | str: # E[func6] return 1 @@ -132,14 +132,14 @@ def invalid_final(self, x: int | str) -> int | str: ... # The @final decorator should not be on multiple overloads and # implementation: - @overload # E[invalid_final_2] @final should be on implementation only - @final - def invalid_final_2(self, x: int) -> int: # E[invalid_final_2] + @overload # E[invalid_final_2+]: @final should be on implementation only + @final # E[invalid_final_2+] + def invalid_final_2(self, x: int) -> int: # E[invalid_final_2+] ... @overload - @final - def invalid_final_2(self, x: str) -> str: # E[invalid_final_2] + @final # E[invalid_final_2+] + def invalid_final_2(self, x: str) -> str: # E[invalid_final_2+] ... @final @@ -217,13 +217,13 @@ def good_override(self, x: int | str) -> int | str: ... # This is the wrong way to use @override with an overloaded method, and # should emit an error: - @overload # E[override_impl]: @override should appear only on implementation - @override - def to_override(self, x: int) -> int: ... # E[override_impl] + @overload # E[override_impl+]: @override should appear only on implementation + @override # E[override_impl+] + def to_override(self, x: int) -> int: ... # E[override_impl+] @overload - @override - def to_override(self, x: str) -> str: ... # E[override_impl] + @override # E[override_impl+] + def to_override(self, x: str) -> str: ... # E[override_impl+] @override def to_override(self, x: int | str) -> int | str: ... diff --git a/conformance/tests/overloads_definitions_stub.pyi b/conformance/tests/overloads_definitions_stub.pyi index 3ab48adf..a61bd059 100644 --- a/conformance/tests/overloads_definitions_stub.pyi +++ b/conformance/tests/overloads_definitions_stub.pyi @@ -30,18 +30,18 @@ def func2(x: str) -> str: ... # > checkers should report an error if these conditions are not met. class C: @overload # E[func5] - def func5(x: int) -> int: # E[func5] + def func5(self, x: int, /) -> int: # E[func5] ... @overload @staticmethod - def func5(x: str) -> str: # E[func5] + def func5(x: str, /) -> str: # E[func5] ... @overload # E[func6] @classmethod - def func6(cls, x: int) -> int: # E[func6] + def func6(cls, x: int, /) -> int: # E[func6] ... @overload - def func6(cls, x: str) -> str: # E[func6] + def func6(self, *args: str) -> str: # E[func6] ... # > If a ``@final`` or ``@override`` decorator is supplied for a function with diff --git a/conformance/tests/tuples_type_compat.py b/conformance/tests/tuples_type_compat.py index 12a84cb1..27b76921 100644 --- a/conformance/tests/tuples_type_compat.py +++ b/conformance/tests/tuples_type_compat.py @@ -7,7 +7,7 @@ # > Because tuple contents are immutable, the element types of a tuple are covariant. -from typing import Any, Iterable, Never, Sequence, TypeVar, assert_type +from typing import Any, Iterable, Never, Sequence, TypeAlias, TypeVar, assert_type def func1(t1: tuple[float, complex], t2: tuple[int, int]): @@ -67,19 +67,23 @@ def func4( # NOTE: This type narrowing functionality is optional, not mandated. +Func5Input: TypeAlias = tuple[int] | tuple[str, str] | tuple[int, *tuple[str, ...], int] -def func5(val: tuple[int] | tuple[str, str] | tuple[int, *tuple[str, ...], int]): +def func5(val: Func5Input): if len(val) == 1: # Type can be narrowed to tuple[int]. - assert_type(val, tuple[int]) # E?: tuple[int] + assert_type(val, tuple[int]) # E[func5_1] + assert_type(val, Func5Input) # E[func5_1] if len(val) == 2: # Type can be narrowed to tuple[str, str] | tuple[int, int]. - assert_type(val, tuple[str, str] | tuple[int, int]) # E? + assert_type(val, tuple[str, str] | tuple[int, int]) # E[func5_2] + assert_type(val, Func5Input) # E[func5_2] if len(val) == 3: # Type can be narrowed to tuple[int, str, int]. - assert_type(val, tuple[int, str, int]) # E? + assert_type(val, tuple[int, str, int]) # E[func5_3] + assert_type(val, Func5Input) # E[func5_3] # > This property may also be used to safely narrow tuple types within a match @@ -87,20 +91,25 @@ def func5(val: tuple[int] | tuple[str, str] | tuple[int, *tuple[str, ...], int]) # NOTE: This type narrowing functionality is optional, not mandated. +Func6Input: TypeAlias = tuple[int] | tuple[str, str] | tuple[int, *tuple[str, ...], int] -def func6(val: tuple[int] | tuple[str, str] | tuple[int, *tuple[str, ...], int]): + +def func6(val: Func6Input): match val: case (x,): - # Type can be narrowed to tuple[int]. - assert_type(val, tuple[int]) # E?: tuple[int] + # Type may be narrowed to tuple[int]. + assert_type(val, tuple[int]) # E[func6_1] + assert_type(val, Func6Input) # E[func6_1] case (x, y): - # Type can be narrowed to tuple[str, str] | tuple[int, int]. - assert_type(val, tuple[str, str] | tuple[int, int]) # E? + # Type may be narrowed to tuple[str, str] | tuple[int, int]. + assert_type(val, tuple[str, str] | tuple[int, int]) # E[func6_2] + assert_type(val, Func6Input) # E[func6_2] case (x, y, z): - # Type can be narrowed to tuple[int, str, int]. - assert_type(val, tuple[int, str, int]) # E? + # Type may be narrowed to tuple[int, str, int]. + assert_type(val, tuple[int, str, int]) # E[func6_3] + assert_type(val, Func6Input) # E[func6_3] # > Type checkers may safely use this equivalency rule (tuple expansion) @@ -108,13 +117,17 @@ def func6(val: tuple[int] | tuple[str, str] | tuple[int, *tuple[str, ...], int]) # NOTE: This type narrowing functionality is optional, not mandated. +Func7Input: TypeAlias = tuple[int | str, int | str] + -def func7(subj: tuple[int | str, int | str]): +def func7(subj: Func7Input): match subj: case x, str(): - assert_type(subj, tuple[int | str, str]) # E? + assert_type(subj, tuple[int | str, str]) # E[func7_1] + assert_type(subj, Func7Input) # E[func7_1] case y: - assert_type(subj, tuple[int | str, int]) # E? + assert_type(subj, tuple[int | str, int]) # E[func7_2] + assert_type(subj, Func7Input) # E[func7_2] # > The tuple class derives from Sequence[T_co] where ``T_co`` is a covariant