diff --git a/conformance/results/mypy/overloads_definitions.toml b/conformance/results/mypy/overloads_definitions.toml index d38c913f..e642fa29 100644 --- a/conformance/results/mypy/overloads_definitions.toml +++ b/conformance/results/mypy/overloads_definitions.toml @@ -5,20 +5,20 @@ 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 = """ -Line 245: Expected 1 errors -Line 49: Unexpected errors ['overloads_definitions.py:49: error: An overloaded function outside a stub file must have an implementation [no-overload-impl]'] +Lines 220, 222, 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 = """ -overloads_definitions.py:14: error: Single overload definition, multiple required [misc] -overloads_definitions.py:26: error: An overloaded function outside a stub file must have an implementation [no-overload-impl] -overloads_definitions.py:49: error: An overloaded function outside a stub file must have an implementation [no-overload-impl] -overloads_definitions.py:63: error: An overloaded function outside a stub file must have an implementation [no-overload-impl] -overloads_definitions.py:78: error: Overload does not consistently use the "@staticmethod" decorator on all function signatures. [misc] -overloads_definitions.py:88: error: Overloaded function implementation does not accept all possible arguments of signature 1 [misc] -overloads_definitions.py:88: error: Overloaded function implementation does not accept all possible arguments of signature 2 [misc] -overloads_definitions.py:91: error: Overload does not consistently use the "@classmethod" decorator on all function signatures. [misc] -overloads_definitions.py:133: error: @final should be applied only to overload implementation [misc] -overloads_definitions.py:148: error: @final should be applied only to overload implementation [misc] -overloads_definitions.py:196: error: Cannot override final attribute "final_method" (previously declared in base class "Base") [misc] -overloads_definitions.py:211: error: Method "bad_override" is marked as an override, but no base method was found with this name [misc] +overloads_definitions.py:15: error: Single overload definition, multiple required [misc] +overloads_definitions.py:27: error: An overloaded function outside a stub file must have an implementation [no-overload-impl] +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] +overloads_definitions.py:175: error: Cannot override final attribute "final_method" (previously declared in base class "Base") [misc] +overloads_definitions.py:190: error: Method "bad_override" is marked as an override, but no base method was found with this name [misc] """ diff --git a/conformance/results/mypy/overloads_definitions_stub.toml b/conformance/results/mypy/overloads_definitions_stub.toml index d1623d20..f2fd2a7b 100644 --- a/conformance/results/mypy/overloads_definitions_stub.toml +++ b/conformance/results/mypy/overloads_definitions_stub.toml @@ -4,15 +4,15 @@ Allows @override to appear in a stub file not on the first overload. """ conformance_automated = "Fail" errors_diff = """ -Line 168: Expected 1 errors +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:37: error: Overload does not consistently use the "@staticmethod" decorator on all function signatures. [misc] -overloads_definitions_stub.pyi:38: error: Self argument missing for a non-static method (or an invalid type for self) [misc] -overloads_definitions_stub.pyi:46: error: Overload does not consistently use the "@classmethod" decorator on all function signatures. [misc] -overloads_definitions_stub.pyi:85: error: In a stub file @final must be applied only to the first overload [misc] -overloads_definitions_stub.pyi:101: error: In a stub file @final must be applied only to the first overload [misc] -overloads_definitions_stub.pyi:128: error: Cannot override final attribute "final_method" (previously declared in base class "Base") [misc] -overloads_definitions_stub.pyi:140: error: Method "bad_override" is marked as an override, but no base method was found with this name [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] +overloads_definitions_stub.pyi:107: error: Cannot override final attribute "final_method" (previously declared in base class "Base") [misc] +overloads_definitions_stub.pyi:120: error: Method "bad_override" is marked as an override, but no base method was found with this name [misc] """ diff --git a/conformance/results/pyre/overloads_definitions.toml b/conformance/results/pyre/overloads_definitions.toml index fc29f762..0a99160d 100644 --- a/conformance/results/pyre/overloads_definitions.toml +++ b/conformance/results/pyre/overloads_definitions.toml @@ -5,28 +5,28 @@ 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 = """ -Line 245: Expected 1 errors -Lines 148, 150: Expected error (tag 'invalid_final_2') +Lines 135, 137, 142: Expected error (tag 'invalid_final_2') +Lines 220, 222, 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 51: Unexpected errors ['overloads_definitions.py:51:4 Missing overload implementation [42]: Overloaded function `MyAbstractBase.func4` must have an implementation.'] -Line 128: Unexpected errors ['overloads_definitions.py:128:4 Incompatible overload [43]: This definition does not have the same decorators as the preceding overload(s).'] -Line 239: Unexpected errors ['overloads_definitions.py:239:4 Incompatible overload [43]: This definition does not have the same decorators as the preceding overload(s).'] +Line 49: Unexpected errors ['overloads_definitions.py:49:4 Missing overload implementation [42]: Overloaded function `MyAbstractBase.func4` must have an implementation.'] +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).'] """ output = """ -overloads_definitions.py:15:0 Incompatible overload [43]: At least two overload signatures must be present. -overloads_definitions.py:27:0 Missing overload implementation [42]: Overloaded function `func2` must have an implementation. +overloads_definitions.py:16:0 Incompatible overload [43]: At least two overload signatures must be present. +overloads_definitions.py:28:0 Missing overload implementation [42]: Overloaded function `func2` must have an implementation. overloads_definitions.py:40:4 Missing overload implementation [42]: Overloaded function `MyProto.func3` must have an implementation. -overloads_definitions.py:51:4 Missing overload implementation [42]: Overloaded function `MyAbstractBase.func4` must have an implementation. -overloads_definitions.py:64:4 Missing overload implementation [42]: Overloaded function `MyAbstractBase.not_abstract` must have an implementation. -overloads_definitions.py:80:4 Incompatible overload [43]: The implementation of `C.func5` does not accept all possible arguments of overload defined on line `80`. -overloads_definitions.py:85:4 Incompatible overload [43]: The implementation of `C.func5` does not accept all possible arguments of overload defined on line `85`. -overloads_definitions.py:88:4 Incompatible overload [43]: This definition does not have the same decorators as the preceding overload(s). -overloads_definitions.py:97:4 Incompatible overload [43]: The implementation of `C.func6` does not accept all possible arguments of overload defined on line `97`. -overloads_definitions.py:97:4 Incompatible overload [43]: This definition does not have the same decorators as the preceding overload(s). -overloads_definitions.py:128:4 Incompatible overload [43]: This definition does not have the same decorators as the preceding overload(s). -overloads_definitions.py:139:4 Incompatible overload [43]: This definition does not have the same decorators as the preceding overload(s). -overloads_definitions.py:204:4 Invalid override [40]: `overloads_definitions.Child.final_method` cannot override final method defined in `Base`. -overloads_definitions.py:220:4 Incompatible overload [43]: This definition does not have the same decorators as the preceding overload(s). -overloads_definitions.py:220:4 Invalid override [40]: `overloads_definitions.Child.bad_override` is decorated with @override, but no method of the same name exists in superclasses of `Child`. -overloads_definitions.py:239:4 Incompatible overload [43]: This definition does not have the same decorators as the preceding overload(s). +overloads_definitions.py:49:4 Missing overload implementation [42]: Overloaded function `MyAbstractBase.func4` must have an implementation. +overloads_definitions.py:59:4 Missing overload implementation [42]: Overloaded function `MyAbstractBase.not_abstract` must have an implementation. +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`. +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`. +overloads_definitions.py:81:4 Incompatible overload [43]: This definition does not have the same decorators as the preceding overload(s). +overloads_definitions.py:90:4 Incompatible overload [43]: The implementation of `C.func6` does not accept all possible arguments of overload defined on line `90`. +overloads_definitions.py:90:4 Incompatible overload [43]: This definition does not have the same decorators as the preceding overload(s). +overloads_definitions.py:117:4 Incompatible overload [43]: This definition does not have the same decorators as the preceding overload(s). +overloads_definitions.py:127:4 Incompatible overload [43]: This definition does not have the same decorators as the preceding overload(s). +overloads_definitions.py:181:4 Invalid override [40]: `overloads_definitions.Child.final_method` cannot override final method defined in `Base`. +overloads_definitions.py:198:4 Incompatible overload [43]: This definition does not have the same decorators as the preceding overload(s). +overloads_definitions.py:198:4 Invalid override [40]: `overloads_definitions.Child.bad_override` is decorated with @override, but no method of the same name exists in superclasses of `Child`. +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/overloads_definitions_stub.toml b/conformance/results/pyre/overloads_definitions_stub.toml index 93772e38..4a923955 100644 --- a/conformance/results/pyre/overloads_definitions_stub.toml +++ b/conformance/results/pyre/overloads_definitions_stub.toml @@ -4,24 +4,22 @@ Expects @final and @override to be present on all overloads, not just first. """ conformance_automated = "Fail" errors_diff = """ -Line 168: Expected 1 errors -Lines 80, 82, 85, 87: Expected error (tag 'invalid_final') -Lines 96, 98, 101: Expected error (tag 'invalid_final_2') -Lines 122, 128, 129, 133: Expected error (tag 'override-final') -Line 75: Unexpected errors ['overloads_definitions_stub.pyi:75:4 Incompatible overload [43]: This definition does not have the same decorators as the preceding overload(s).'] -Line 91: Unexpected errors ['overloads_definitions_stub.pyi:91:4 Incompatible overload [43]: This definition does not have the same decorators as the preceding overload(s).'] -Line 146: Unexpected errors ['overloads_definitions_stub.pyi:146:4 Incompatible overload [43]: This definition does not have the same decorators as the preceding overload(s).'] -Line 162: Unexpected errors ['overloads_definitions_stub.pyi:162:4 Incompatible overload [43]: This definition does not have the same decorators as the preceding overload(s).'] -Line 174: Unexpected errors ['overloads_definitions_stub.pyi:174:4 Incompatible overload [43]: This definition does not have the same decorators as the preceding overload(s).'] +Lines 67, 69, 71, 73: Expected error (tag 'invalid_final') +Lines 80, 82, 84, 86: Expected error (tag 'invalid_final_2') +Lines 102, 107, 108, 111, 113: Expected error (tag 'override-final') +Line 63: Unexpected errors ['overloads_definitions_stub.pyi:63:4 Incompatible overload [43]: This definition does not have the same decorators as the preceding overload(s).'] +Line 76: Unexpected errors ['overloads_definitions_stub.pyi:76:4 Incompatible overload [43]: This definition does not have the same decorators as the preceding overload(s).'] +Line 125: Unexpected errors ['overloads_definitions_stub.pyi:125:4 Incompatible overload [43]: This definition does not have the same decorators as the preceding overload(s).'] +Line 138: Unexpected errors ['overloads_definitions_stub.pyi:138:4 Incompatible overload [43]: This definition does not have the same decorators as the preceding overload(s).'] """ output = """ overloads_definitions_stub.pyi:14:0 Incompatible overload [43]: At least two overload signatures must be present. -overloads_definitions_stub.pyi:43:4 Incompatible overload [43]: This definition does not have the same decorators as the preceding overload(s). -overloads_definitions_stub.pyi:52:4 Incompatible overload [43]: This definition does not have the same decorators as the preceding overload(s). -overloads_definitions_stub.pyi:75:4 Incompatible overload [43]: This definition does not have the same decorators as the preceding overload(s). -overloads_definitions_stub.pyi:91:4 Incompatible overload [43]: This definition does not have the same decorators as the preceding overload(s). -overloads_definitions_stub.pyi:142:4 Invalid override [40]: `overloads_definitions_stub.Child.bad_override` is decorated with @override, but no method of the same name exists in superclasses of `Child`. -overloads_definitions_stub.pyi:146:4 Incompatible overload [43]: This definition does not have the same decorators as the preceding overload(s). -overloads_definitions_stub.pyi:162:4 Incompatible overload [43]: This definition does not have the same decorators as the preceding overload(s). -overloads_definitions_stub.pyi:174:4 Incompatible overload [43]: This definition does not have the same decorators as the preceding overload(s). +overloads_definitions_stub.pyi:37:4 Incompatible overload [43]: This definition does not have the same decorators as the preceding overload(s). +overloads_definitions_stub.pyi:44:4 Incompatible overload [43]: This definition does not have the same decorators as the preceding overload(s). +overloads_definitions_stub.pyi:63:4 Incompatible overload [43]: This definition does not have the same decorators as the preceding overload(s). +overloads_definitions_stub.pyi:76:4 Incompatible overload [43]: This definition does not have the same decorators as the preceding overload(s). +overloads_definitions_stub.pyi:122:4 Invalid override [40]: `overloads_definitions_stub.Child.bad_override` is decorated with @override, but no method of the same name exists in superclasses of `Child`. +overloads_definitions_stub.pyi:125:4 Incompatible overload [43]: This definition does not have the same decorators as the preceding overload(s). +overloads_definitions_stub.pyi:138:4 Incompatible overload [43]: This definition does not have the same decorators as the preceding overload(s). +overloads_definitions_stub.pyi:147:4 Incompatible overload [43]: This definition does not have the same decorators as the preceding overload(s). """ diff --git a/conformance/results/pyre/version.toml b/conformance/results/pyre/version.toml index 036bbbfb..b7e0e78a 100644 --- a/conformance/results/pyre/version.toml +++ b/conformance/results/pyre/version.toml @@ -1,2 +1,2 @@ version = "pyre 0.9.23" -test_duration = 7.4 +test_duration = 6.3 diff --git a/conformance/results/pyright/overloads_definitions.toml b/conformance/results/pyright/overloads_definitions.toml index 78ec7ab8..e0c86ab2 100644 --- a/conformance/results/pyright/overloads_definitions.toml +++ b/conformance/results/pyright/overloads_definitions.toml @@ -1,38 +1,31 @@ -conformant = "Partial" -notes = """ -Allows @final/@override on all overloads and implementation; should be implementation-only. -""" -conformance_automated = "Fail" +conformant = "Pass" +conformance_automated = "Pass" errors_diff = """ -Line 245: Expected 1 errors -Line 155: Unexpected errors ['overloads_definitions.py:155:9 - error: @final decorator should be applied only to the implementation (reportInconsistentOverload)'] -Line 247: Unexpected errors ['overloads_definitions.py:247:9 - error: @override decorator should be applied only to the implementation (reportInconsistentOverload)'] -Line 252: Unexpected errors ['overloads_definitions.py:252:9 - error: @override decorator should be applied only to the implementation (reportInconsistentOverload)'] """ output = """ -overloads_definitions.py:15:5 - error: "func1" is marked as overload, but additional overloads are missing (reportInconsistentOverload) -overloads_definitions.py:27:5 - error: "func2" is marked as overload, but no implementation is provided (reportNoOverloadImplementation) -overloads_definitions.py:64:9 - error: "not_abstract" is marked as overload, but no implementation is provided (reportNoOverloadImplementation) -overloads_definitions.py:80:9 - error: Overloads for "func5" use @staticmethod inconsistently (reportInconsistentOverload) -overloads_definitions.py:88:9 - error: Overloaded implementation is not consistent with signature of overload 1 +overloads_definitions.py:16:5 - error: "func1" is marked as overload, but additional overloads are missing (reportInconsistentOverload) +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:88:9 - error: Overloaded implementation is not consistent with signature of overload 2 +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:93:9 - error: Overloads for "func6" use @classmethod inconsistently (reportInconsistentOverload) -overloads_definitions.py:97:15 - warning: Instance methods should take a "self" parameter (reportSelfClsParameterName) -overloads_definitions.py:135:9 - error: @final decorator should be applied only to the implementation (reportInconsistentOverload) -overloads_definitions.py:150:9 - error: @final decorator should be applied only to the implementation (reportInconsistentOverload) -overloads_definitions.py:155:9 - error: @final decorator should be applied only to the implementation (reportInconsistentOverload) -overloads_definitions.py:204:9 - error: Method "final_method" cannot override final method defined in class "Base" (reportIncompatibleMethodOverride) -overloads_definitions.py:220:9 - error: Method "bad_override" is marked as override, but no base method of same name is present (reportGeneralTypeIssues) -overloads_definitions.py:247:9 - error: @override decorator should be applied only to the implementation (reportInconsistentOverload) -overloads_definitions.py:252:9 - error: @override decorator should be applied only to the implementation (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) +overloads_definitions.py:181:9 - error: Method "final_method" cannot override final method defined in class "Base" (reportIncompatibleMethodOverride) +overloads_definitions.py:198:9 - error: Method "bad_override" is marked as override, but no base method of same name is present (reportGeneralTypeIssues) +overloads_definitions.py:222:9 - error: @override decorator should be applied only to the implementation (reportInconsistentOverload) +overloads_definitions.py:226:9 - error: @override 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 3a71f07f..1e9c8949 100644 --- a/conformance/results/pyright/overloads_definitions_stub.toml +++ b/conformance/results/pyright/overloads_definitions_stub.toml @@ -1,24 +1,16 @@ -conformant = "Partial" -notes = """ -Does not enforce that @final/@override in a stub should be only on first overload. -Does not enforce @override when correctly used with an overloaded method in a stub file. -""" -conformance_automated = "Fail" +conformant = "Pass" +conformance_automated = "Pass" errors_diff = """ -Line 168: Expected 1 errors -Lines 96, 98, 101: Expected error (tag 'invalid_final_2') -Line 103: Unexpected errors ['overloads_definitions_stub.pyi:103:9 - error: Only the first overload should be marked @final (reportInconsistentOverload)'] -Line 174: Unexpected errors ['overloads_definitions_stub.pyi:174:9 - error: Only the first overload should be marked @override (reportInconsistentOverload)'] """ output = """ overloads_definitions_stub.pyi:14:5 - error: "func1" is marked as overload, but additional overloads are missing (reportInconsistentOverload) -overloads_definitions_stub.pyi:38:9 - error: Overloads for "func5" use @staticmethod inconsistently (reportInconsistentOverload) -overloads_definitions_stub.pyi:38:15 - warning: Instance methods should take a "self" parameter (reportSelfClsParameterName) -overloads_definitions_stub.pyi:48:9 - error: Overloads for "func6" use @classmethod inconsistently (reportInconsistentOverload) -overloads_definitions_stub.pyi:52:15 - warning: Instance methods should take a "self" parameter (reportSelfClsParameterName) -overloads_definitions_stub.pyi:87:9 - error: Only the first overload should be marked @final (reportInconsistentOverload) -overloads_definitions_stub.pyi:103:9 - error: Only the first overload should be marked @final (reportInconsistentOverload) -overloads_definitions_stub.pyi:133:9 - error: Method "final_method" cannot override final method defined in class "Base" (reportIncompatibleMethodOverride) -overloads_definitions_stub.pyi:142:9 - error: Method "bad_override" is marked as override, but no base method of same name is present (reportGeneralTypeIssues) -overloads_definitions_stub.pyi:174:9 - error: Only the first overload should be marked @override (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) +overloads_definitions_stub.pyi:122:9 - error: Method "bad_override" is marked as override, but no base method of same name is present (reportGeneralTypeIssues) +overloads_definitions_stub.pyi:147:9 - error: Only the first overload should be marked @override (reportInconsistentOverload) """ diff --git a/conformance/results/pyright/overloads_evaluation.toml b/conformance/results/pyright/overloads_evaluation.toml index ee50a3a1..2c490190 100644 --- a/conformance/results/pyright/overloads_evaluation.toml +++ b/conformance/results/pyright/overloads_evaluation.toml @@ -1,10 +1,4 @@ -conformant = "Partial" -notes = """ -Does not expand boolean arguments to Literal[True] and Literal[False]. -Does not expand enum arguments to literal variants. -Does not expand tuple arguments to possible combinations. -Does not prefer variadic match to indeterminate-length unpacked argument. -""" +conformant = "Pass" conformance_automated = "Pass" errors_diff = """ """ diff --git a/conformance/results/pytype/overloads_definitions.toml b/conformance/results/pytype/overloads_definitions.toml index e5307735..dc4444dc 100644 --- a/conformance/results/pytype/overloads_definitions.toml +++ b/conformance/results/pytype/overloads_definitions.toml @@ -8,29 +8,29 @@ Does not enforce any rules on location of @final or @override decorators. """ conformance_automated = "Fail" errors_diff = """ -Line 245: Expected 1 errors -Lines 14, 15: Expected error (tag 'func1') -Lines 26, 27: Expected error (tag 'func2') -Lines 63, 64: Expected error (tag 'not_abstract') -Lines 78, 80, 85, 88: Expected error (tag 'func5') -Lines 91, 93, 97, 101: Expected error (tag 'func6') -Lines 133, 135, 139: Expected error (tag 'invalid_final') -Lines 148, 150: Expected error (tag 'invalid_final_2') +Lines 15, 16: Expected error (tag 'func1') +Lines 27, 28: Expected error (tag 'func2') +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') 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 46: Unexpected errors ["overloads_definitions.py:46:9: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in func3: @typing.overload-decorated 'MyProto.func3' object is not callable [not-callable]"] -Line 58: Unexpected errors ["overloads_definitions.py:58:9: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in func4: @typing.overload-decorated 'MyAbstractBase.func4' object is not callable [not-callable]"] -Line 70: Unexpected errors ["overloads_definitions.py:70:9: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in not_abstract: @typing.overload-decorated 'MyAbstractBase.not_abstract' object is not callable [not-callable]"] -Line 81: Unexpected errors ['overloads_definitions.py:81:9: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in func5: bad return type [bad-return-type]'] -Line 86: Unexpected errors ['overloads_definitions.py:86:9: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in func5: bad return type [bad-return-type]'] -Line 129: Unexpected errors ['overloads_definitions.py:129:9: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in final_method: bad return type [bad-return-type]', 'overloads_definitions.py:129:9: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in final_method: bad return type [bad-return-type]'] -Line 143: Unexpected errors ['overloads_definitions.py:143:9: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in invalid_final: bad return type [bad-return-type]', 'overloads_definitions.py:143:9: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in invalid_final: bad return type [bad-return-type]'] -Line 160: Unexpected errors ['overloads_definitions.py:160:9: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in invalid_final_2: bad return type [bad-return-type]', 'overloads_definitions.py:160:9: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in invalid_final_2: bad return type [bad-return-type]'] -Line 176: Unexpected errors ['overloads_definitions.py:176:9: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in good_override: bad return type [bad-return-type]', 'overloads_definitions.py:176:9: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in good_override: bad return type [bad-return-type]'] -Line 187: Unexpected errors ['overloads_definitions.py:187:9: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in to_override: bad return type [bad-return-type]', 'overloads_definitions.py:187:9: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in to_override: bad return type [bad-return-type]'] -Line 205: Unexpected errors ['overloads_definitions.py:205:9: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in final_method: bad return type [bad-return-type]', 'overloads_definitions.py:205:9: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in final_method: bad return type [bad-return-type]'] -Line 221: Unexpected errors ['overloads_definitions.py:221:9: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in bad_override: bad return type [bad-return-type]', 'overloads_definitions.py:221:9: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in bad_override: bad return type [bad-return-type]'] -Line 240: Unexpected errors ['overloads_definitions.py:240:9: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in good_override: bad return type [bad-return-type]', 'overloads_definitions.py:240:9: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in good_override: bad return type [bad-return-type]'] -Line 257: Unexpected errors ['overloads_definitions.py:257:9: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in to_override: bad return type [bad-return-type]', 'overloads_definitions.py:257:9: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in to_override: bad return type [bad-return-type]'] +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 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]'] +Line 159: Unexpected errors ['overloads_definitions.py:159:1: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in good_override: bad return type [bad-return-type]', 'overloads_definitions.py:159:1: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in good_override: bad return type [bad-return-type]'] +Line 167: Unexpected errors ['overloads_definitions.py:167:1: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in to_override: bad return type [bad-return-type]', 'overloads_definitions.py:167:1: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in to_override: bad return type [bad-return-type]'] +Line 184: Unexpected errors ['overloads_definitions.py:184:9: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in final_method: bad return type [bad-return-type]', 'overloads_definitions.py:184:9: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in final_method: bad return type [bad-return-type]'] +Line 199: Unexpected errors ['overloads_definitions.py:199:9: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in bad_override: bad return type [bad-return-type]', 'overloads_definitions.py:199:9: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in bad_override: bad return type [bad-return-type]'] +Line 215: Unexpected errors ['overloads_definitions.py:215:57: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in good_override: bad return type [bad-return-type]', 'overloads_definitions.py:215:57: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in good_override: bad return type [bad-return-type]'] +Line 229: Unexpected errors ['overloads_definitions.py:229:55: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in to_override: bad return type [bad-return-type]', 'overloads_definitions.py:229:55: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in to_override: bad return type [bad-return-type]'] """ output = """ overloads_definitions.py:6:1: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in : typing.override not supported yet [not-supported-yet] @@ -48,87 +48,85 @@ from typing import ( ) \u001b[1m\u001b[31m~\u001b[39m\u001b[0m -overloads_definitions.py:46:9: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in func3: @typing.overload-decorated 'MyProto.func3' object is not callable [not-callable] +overloads_definitions.py:43:37: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in func3: @typing.overload-decorated 'MyProto.func3' object is not callable [not-callable] - ... - \u001b[1m\u001b[31m~~~\u001b[39m\u001b[0m + def func3(self, x: str) -> str: ... + \u001b[1m\u001b[31m~~~\u001b[39m\u001b[0m -overloads_definitions.py:58:9: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in func4: @typing.overload-decorated 'MyAbstractBase.func4' object is not callable [not-callable] +overloads_definitions.py:53:37: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in func4: @typing.overload-decorated 'MyAbstractBase.func4' object is not callable [not-callable] - ... - \u001b[1m\u001b[31m~~~\u001b[39m\u001b[0m + def func4(self, x: str) -> str: ... + \u001b[1m\u001b[31m~~~\u001b[39m\u001b[0m -overloads_definitions.py:70:9: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in not_abstract: @typing.overload-decorated 'MyAbstractBase.not_abstract' object is not callable [not-callable] +overloads_definitions.py:63:44: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in not_abstract: @typing.overload-decorated 'MyAbstractBase.not_abstract' object is not callable [not-callable] - ... - \u001b[1m\u001b[31m~~~\u001b[39m\u001b[0m + def not_abstract(self, x: str) -> str: ... + \u001b[1m\u001b[31m~~~\u001b[39m\u001b[0m -overloads_definitions.py:81:9: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in func5: bad return type [bad-return-type] +overloads_definitions.py:74:9: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in func5: bad return type [bad-return-type] ... \u001b[1m\u001b[31m~~~\u001b[39m\u001b[0m -overloads_definitions.py:86:9: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in func5: bad return type [bad-return-type] +overloads_definitions.py:79:9: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in func5: bad return type [bad-return-type] ... \u001b[1m\u001b[31m~~~\u001b[39m\u001b[0m -overloads_definitions.py:129:9: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in final_method: bad return type [bad-return-type] +overloads_definitions.py:117:56: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in final_method: bad return type [bad-return-type] - ... - \u001b[1m\u001b[31m~~~\u001b[39m\u001b[0m + def final_method(self, x: int | str) -> int | str: ... + \u001b[1m\u001b[31m~~~\u001b[39m\u001b[0m -overloads_definitions.py:129:9: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in final_method: bad return type [bad-return-type] +overloads_definitions.py:117:56: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in final_method: bad return type [bad-return-type] - ... - \u001b[1m\u001b[31m~~~\u001b[39m\u001b[0m + def final_method(self, x: int | str) -> int | str: ... + \u001b[1m\u001b[31m~~~\u001b[39m\u001b[0m -overloads_definitions.py:143:9: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in invalid_final: bad return type [bad-return-type] +overloads_definitions.py:130:1: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in invalid_final: bad return type [bad-return-type] - ... - \u001b[1m\u001b[31m~~~\u001b[39m\u001b[0m + def invalid_final(self, x: int | str) -> int | str: ... +\u001b[1m\u001b[31m\u001b[39m\u001b[0m -overloads_definitions.py:143:9: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in invalid_final: bad return type [bad-return-type] +overloads_definitions.py:130:1: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in invalid_final: bad return type [bad-return-type] - ... - \u001b[1m\u001b[31m~~~\u001b[39m\u001b[0m + def invalid_final(self, x: int | str) -> int | str: ... +\u001b[1m\u001b[31m\u001b[39m\u001b[0m -overloads_definitions.py:160:9: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in invalid_final_2: bad return type [bad-return-type] +overloads_definitions.py:146:59: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in invalid_final_2: bad return type [bad-return-type] - ... - \u001b[1m\u001b[31m~~~\u001b[39m\u001b[0m + def invalid_final_2(self, x: int | str) -> int | str: ... + \u001b[1m\u001b[31m~~~\u001b[39m\u001b[0m -overloads_definitions.py:160:9: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in invalid_final_2: bad return type [bad-return-type] +overloads_definitions.py:146:59: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in invalid_final_2: bad return type [bad-return-type] - ... - \u001b[1m\u001b[31m~~~\u001b[39m\u001b[0m + def invalid_final_2(self, x: int | str) -> int | str: ... + \u001b[1m\u001b[31m~~~\u001b[39m\u001b[0m -overloads_definitions.py:176:9: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in good_override: bad return type [bad-return-type] +overloads_definitions.py:159:1: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in good_override: bad return type [bad-return-type] - ... - \u001b[1m\u001b[31m~~~\u001b[39m\u001b[0m + def good_override(self, x: int | str) -> int | str: ... +\u001b[1m\u001b[31m\u001b[39m\u001b[0m -overloads_definitions.py:176:9: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in good_override: bad return type [bad-return-type] +overloads_definitions.py:159:1: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in good_override: bad return type [bad-return-type] - ... - \u001b[1m\u001b[31m~~~\u001b[39m\u001b[0m + def good_override(self, x: int | str) -> int | str: ... +\u001b[1m\u001b[31m\u001b[39m\u001b[0m -overloads_definitions.py:187:9: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in to_override: bad return type [bad-return-type] +overloads_definitions.py:167:1: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in to_override: bad return type [bad-return-type] - ... - \u001b[1m\u001b[31m~~~\u001b[39m\u001b[0m + def to_override(self, x: int | str) -> int | str: ... +\u001b[1m\u001b[31m\u001b[39m\u001b[0m -overloads_definitions.py:187:9: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in to_override: bad return type [bad-return-type] +overloads_definitions.py:167:1: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in to_override: bad return type [bad-return-type] - ... - \u001b[1m\u001b[31m~~~\u001b[39m\u001b[0m + def to_override(self, x: int | str) -> int | str: ... +\u001b[1m\u001b[31m\u001b[39m\u001b[0m -overloads_definitions.py:190:1: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in : Class Child overrides final method final_method, defined in base class Base [final-error] +overloads_definitions.py:170:1: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in : Class Child overrides final method final_method, defined in base class Base [final-error] class Child(Base): # E[override-final] \u001b[1m\u001b[31m~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\u001b[39m\u001b[0m - -\u001b[1m\u001b[31m\u001b[39m\u001b[0m # The correctly-decorated @final method `Base.final_method` should cause an \u001b[1m\u001b[31m~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\u001b[39m\u001b[0m # error if overridden in a child class (we use an overload here to avoid @@ -137,24 +135,24 @@ 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-final] -\u001b[1m\u001b[31m~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\u001b[39m\u001b[0m - def final_method(self, x: int) -> int: -\u001b[1m\u001b[31m~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\u001b[39m\u001b[0m - ... -\u001b[1m\u001b[31m~~~~~~~~~~~\u001b[39m\u001b[0m + @overload # E[override-final] +\u001b[1m\u001b[31m~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\u001b[39m\u001b[0m + def final_method(self, x: int) -> int: ... +\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 - def final_method(self, x: str) -> str: -\u001b[1m\u001b[31m~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\u001b[39m\u001b[0m - ... -\u001b[1m\u001b[31m~~~~~~~~~~~\u001b[39m\u001b[0m + def final_method(self, x: str) -> str: ... +\u001b[1m\u001b[31m~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\u001b[39m\u001b[0m \u001b[1m\u001b[31m\u001b[39m\u001b[0m - def final_method(self, x: int | str) -> int | str: # E[override-final] can't override final method -\u001b[1m\u001b[31m~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\u001b[39m\u001b[0m + def final_method( # E[override-final] can't override final method +\u001b[1m\u001b[31m~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\u001b[39m\u001b[0m + self, x: int | str +\u001b[1m\u001b[31m~~~~~~~~~~~~~~~~~~~~~~~~~~\u001b[39m\u001b[0m + ) -> int | str: # E[override-final] can't override final method +\u001b[1m\u001b[31m~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\u001b[39m\u001b[0m ... \u001b[1m\u001b[31m~~~~~~~~~~~\u001b[39m\u001b[0m @@ -177,16 +175,14 @@ class Child(Base): # E[override-final] \u001b[1m\u001b[31m\u001b[39m\u001b[0m @overload \u001b[1m\u001b[31m~~~~~~~~~~~~~\u001b[39m\u001b[0m - def bad_override(self, x: str) -> str: -\u001b[1m\u001b[31m~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\u001b[39m\u001b[0m - ... -\u001b[1m\u001b[31m~~~~~~~~~~~\u001b[39m\u001b[0m + def bad_override(self, x: str) -> str: ... +\u001b[1m\u001b[31m~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\u001b[39m\u001b[0m \u001b[1m\u001b[31m\u001b[39m\u001b[0m @override \u001b[1m\u001b[31m~~~~~~~~~~~~~\u001b[39m\u001b[0m - def bad_override(self, x: int | str) -> int | str: # E[bad_override] -\u001b[1m\u001b[31m~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\u001b[39m\u001b[0m + def bad_override(self, x: int | str) -> int | str: # E[bad_override] +\u001b[1m\u001b[31m~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\u001b[39m\u001b[0m ... \u001b[1m\u001b[31m~~~~~~~~~~~\u001b[39m\u001b[0m @@ -207,26 +203,20 @@ class Child(Base): # E[override-final] \u001b[1m\u001b[31m\u001b[39m\u001b[0m @overload \u001b[1m\u001b[31m~~~~~~~~~~~~~\u001b[39m\u001b[0m - def good_override(self, x: int) -> int: -\u001b[1m\u001b[31m~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\u001b[39m\u001b[0m - ... -\u001b[1m\u001b[31m~~~~~~~~~~~\u001b[39m\u001b[0m + def good_override(self, x: int) -> int: ... +\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 - def good_override(self, x: str) -> str: -\u001b[1m\u001b[31m~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\u001b[39m\u001b[0m - ... -\u001b[1m\u001b[31m~~~~~~~~~~~\u001b[39m\u001b[0m + def good_override(self, x: str) -> str: ... +\u001b[1m\u001b[31m~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\u001b[39m\u001b[0m \u001b[1m\u001b[31m\u001b[39m\u001b[0m @override \u001b[1m\u001b[31m~~~~~~~~~~~~~\u001b[39m\u001b[0m - def good_override(self, x: int | str) -> int | str: -\u001b[1m\u001b[31m~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\u001b[39m\u001b[0m - ... -\u001b[1m\u001b[31m~~~~~~~~~~~\u001b[39m\u001b[0m + def good_override(self, x: int | str) -> int | str: ... +\u001b[1m\u001b[31m~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\u001b[39m\u001b[0m \u001b[1m\u001b[31m\u001b[39m\u001b[0m # This is the wrong way to use @override with an overloaded method, and @@ -235,78 +225,72 @@ 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 should appear only on implementation -\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: -\u001b[1m\u001b[31m~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\u001b[39m\u001b[0m - ... -\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: -\u001b[1m\u001b[31m~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\u001b[39m\u001b[0m - ... -\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 \u001b[1m\u001b[31m~~~~~~~~~~~~~\u001b[39m\u001b[0m - def to_override(self, x: int | str) -> int | str: -\u001b[1m\u001b[31m~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\u001b[39m\u001b[0m - ... -\u001b[1m\u001b[31m~~~~~~~~~~~\u001b[39m\u001b[0m + def to_override(self, x: int | str) -> int | str: ... +\u001b[1m\u001b[31m~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\u001b[39m\u001b[0m -overloads_definitions.py:205:9: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in final_method: bad return type [bad-return-type] +overloads_definitions.py:184:9: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in final_method: bad return type [bad-return-type] ... \u001b[1m\u001b[31m~~~\u001b[39m\u001b[0m -overloads_definitions.py:205:9: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in final_method: bad return type [bad-return-type] +overloads_definitions.py:184:9: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in final_method: bad return type [bad-return-type] ... \u001b[1m\u001b[31m~~~\u001b[39m\u001b[0m -overloads_definitions.py:212:5: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in Child: Attribute 'bad_override' not found on any parent class [override-error] +overloads_definitions.py:191:5: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in Child: Attribute 'bad_override' not found on any parent class [override-error] def bad_override(self, x: int) -> int: # E[bad_override] \u001b[1m\u001b[31m~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\u001b[39m\u001b[0m ... \u001b[1m\u001b[31m~~~~~~~~~~~\u001b[39m\u001b[0m -overloads_definitions.py:221:9: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in bad_override: bad return type [bad-return-type] +overloads_definitions.py:199:9: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in bad_override: bad return type [bad-return-type] ... \u001b[1m\u001b[31m~~~\u001b[39m\u001b[0m -overloads_definitions.py:221:9: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in bad_override: bad return type [bad-return-type] +overloads_definitions.py:199:9: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in bad_override: bad return type [bad-return-type] ... \u001b[1m\u001b[31m~~~\u001b[39m\u001b[0m -overloads_definitions.py:240:9: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in good_override: bad return type [bad-return-type] +overloads_definitions.py:215:57: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in good_override: bad return type [bad-return-type] - ... - \u001b[1m\u001b[31m~~~\u001b[39m\u001b[0m + def good_override(self, x: int | str) -> int | str: ... + \u001b[1m\u001b[31m~~~\u001b[39m\u001b[0m -overloads_definitions.py:240:9: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in good_override: bad return type [bad-return-type] +overloads_definitions.py:215:57: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in good_override: bad return type [bad-return-type] - ... - \u001b[1m\u001b[31m~~~\u001b[39m\u001b[0m + def good_override(self, x: int | str) -> int | str: ... + \u001b[1m\u001b[31m~~~\u001b[39m\u001b[0m -overloads_definitions.py:257:9: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in to_override: bad return type [bad-return-type] +overloads_definitions.py:229:55: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in to_override: bad return type [bad-return-type] - ... - \u001b[1m\u001b[31m~~~\u001b[39m\u001b[0m + def to_override(self, x: int | str) -> int | str: ... + \u001b[1m\u001b[31m~~~\u001b[39m\u001b[0m -overloads_definitions.py:257:9: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in to_override: bad return type [bad-return-type] +overloads_definitions.py:229:55: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in to_override: bad return type [bad-return-type] - ... - \u001b[1m\u001b[31m~~~\u001b[39m\u001b[0m + def to_override(self, x: int | str) -> int | str: ... + \u001b[1m\u001b[31m~~~\u001b[39m\u001b[0m """ diff --git a/conformance/results/pytype/overloads_definitions_stub.toml b/conformance/results/pytype/overloads_definitions_stub.toml index de2b6eda..bf139932 100644 --- a/conformance/results/pytype/overloads_definitions_stub.toml +++ b/conformance/results/pytype/overloads_definitions_stub.toml @@ -4,14 +4,14 @@ Does not enforce any of the specified rules regarding overload definitions. """ conformance_automated = "Fail" errors_diff = """ -Line 168: Expected 1 errors Lines 13, 14: Expected error (tag 'func1') -Lines 37, 38, 43: Expected error (tag 'func5') -Lines 46, 48, 52: Expected error (tag 'func6') -Lines 80, 82, 85, 87: Expected error (tag 'invalid_final') -Lines 96, 98, 101: Expected error (tag 'invalid_final_2') -Lines 122, 128, 129, 133: Expected error (tag 'override-final') -Lines 140, 142: Expected error (tag 'bad_override') +Lines 32, 33, 37: Expected error (tag 'func5') +Lines 39, 41, 44: Expected error (tag 'func6') +Lines 67, 69, 71, 73: Expected error (tag 'invalid_final') +Lines 80, 82, 84, 86: Expected error (tag 'invalid_final_2') +Lines 102, 107, 108, 111, 113: Expected error (tag 'override-final') +Lines 120, 122: Expected error (tag 'bad_override') +Lines 143, 147, 149: Expected error (tag 'override_impl') """ output = """ """ diff --git a/conformance/results/pytype/version.toml b/conformance/results/pytype/version.toml index 57c8a1ff..e114259d 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 = 34.0 diff --git a/conformance/results/results.html b/conformance/results/results.html index 86f2fd3c..955525fb 100644 --- a/conformance/results/results.html +++ b/conformance/results/results.html @@ -165,10 +165,10 @@

Python Type System Conformance Test Results

1.3sec
pyre 0.9.23
-
7.4sec
+
6.3sec
pytype 2024.10.11
-
35.2sec
+
34.0sec
@@ -680,19 +680,19 @@

Python Type System Conformance Test Results

     overloads_definitions
Partial

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.

-
Partial

Allows @final/@override on all overloads and implementation; should be implementation-only.

+Pass
Partial

Does not allow an overload with no implementation in a Protocol or an abstract base class.

Expects @final/@override on all overloads and implementation, instead of implementation only.

Fail

Does not reject a function with a single @overload signature.

Does not reject a function with @overload signature but no implementation.

Does not allow an overload with no implementation in a Protocol or an abstract base class.

Does not error on overloads inconsistently decorated with `@staticmethod` or `@classmethod`.

Does not enforce any rules on location of @final or @override decorators.

     overloads_definitions_stub
Partial

Allows @override to appear in a stub file not on the first overload.

-
Partial

Does not enforce that @final/@override in a stub should be only on first overload.

Does not enforce @override when correctly used with an overloaded method in a stub file.

+Pass
Partial

Expects @final and @override to be present on all overloads, not just first.

Fail

Does not enforce any of the specified rules regarding overload definitions.

     overloads_evaluation
Partial

Does not expand boolean arguments to Literal[True] and Literal[False].

Does not expand enum arguments to literal variants.

Does not expand tuple arguments to possible combinations.

-
Partial

Does not expand boolean arguments to Literal[True] and Literal[False].

Does not expand enum arguments to literal variants.

Does not expand tuple arguments to possible combinations.

Does not prefer variadic match to indeterminate-length unpacked argument.

+Pass
Partial

Does not expand boolean arguments to Literal[True] and Literal[False].

Does not expand enum arguments to literal variants.

Does not expand type[A | B] to type[A] and type[B].

Does not expand tuple arguments to possible combinations.

Does not prefer variadic match to indeterminate-length unpacked argument.

Does not treat multiple matches due to gradual types as ambiguous.

Partial

Does not perform argument expansion (on any types) when matching overloads.

Does not treat multiple matches due to gradual types as ambiguous.

Does not prefer variadic match to indeterminate-length unpacked argument.

diff --git a/conformance/tests/overloads_definitions.py b/conformance/tests/overloads_definitions.py index a2323d7f..d6c0267e 100644 --- a/conformance/tests/overloads_definitions.py +++ b/conformance/tests/overloads_definitions.py @@ -10,6 +10,7 @@ override, ) + # > At least two @overload-decorated definitions must be present. @overload # E[func1] def func1() -> None: # E[func1]: At least two overloads must be present @@ -29,33 +30,27 @@ def func2(x: int) -> int: # E[func2]: no implementation @overload -def func2(x: str) -> str: - ... +def func2(x: str) -> str: ... # > Overload definitions within stub files, protocols, and on abstract methods # > within abstract base classes are exempt from this check. class MyProto(Protocol): @overload - def func3(self, x: int) -> int: - ... - + def func3(self, x: int) -> int: ... @overload - def func3(self, x: str) -> str: - ... + def func3(self, x: str) -> str: ... + class MyAbstractBase(ABC): @overload @abstractmethod - def func4(self, x: int) -> int: - ... - + def func4(self, x: int) -> int: ... @overload @abstractmethod - def func4(self, x: str) -> str: - ... + def func4(self, x: str) -> str: ... # A non-abstract method in an abstract base class still requires an # implementation: @@ -64,10 +59,8 @@ def func4(self, x: str) -> str: def not_abstract(self, x: int) -> int: # E[not_abstract] no implementation ... - @overload - def not_abstract(self, x: str) -> str: - ... + def not_abstract(self, x: str) -> str: ... # > If one overload signature is decorated with ``@staticmethod`` or @@ -102,7 +95,6 @@ def func6(cls, x: int | str) -> int | str: # E[func6] return 1 - # > If a ``@final`` or ``@override`` decorator is supplied for a function with # > overloads, the decorator should be applied only to the overload # > implementation if it is present. If an overload implementation isn't present @@ -112,21 +104,17 @@ def func6(cls, x: int | str) -> int | str: # E[func6] # > ``@override`` decorator follows these rules, a type checker should treat the # > decorator as if it is present on all overloads. class Base: - # This is a good definition of an overloaded final method (@final decorator # on implementation only): @overload - def final_method(self, x: int) -> int: - ... + def final_method(self, x: int) -> int: ... @overload - def final_method(self, x: str) -> str: - ... + def final_method(self, x: str) -> str: ... @final - def final_method(self, x: int | str) -> int | str: - ... + def final_method(self, x: int | str) -> int | str: ... # The @final decorator should not be on one of the overloads: @@ -139,8 +127,7 @@ def invalid_final(self, x: int) -> int: # E[invalid_final] def invalid_final(self, x: str) -> str: # E[invalid_final] ... - def invalid_final(self, x: int | str) -> int | str: - ... + def invalid_final(self, x: int | str) -> int | str: ... # The @final decorator should not be on multiple overloads and # implementation: @@ -152,12 +139,11 @@ def invalid_final_2(self, x: int) -> int: # E[invalid_final_2] @overload @final - def invalid_final_2(self, x: str) -> str: + def invalid_final_2(self, x: str) -> str: # E[invalid_final_2] ... @final - def invalid_final_2(self, x: int | str) -> int | str: - ... + def invalid_final_2(self, x: int | str) -> int | str: ... # These methods are just here for the @override test below. We use an # overload because mypy doesn't like overriding a non-overloaded method @@ -165,43 +151,36 @@ def invalid_final_2(self, x: int | str) -> int | str: # specification question, but it's not what we're trying to test here: @overload - def good_override(self, x: int) -> int: - ... + def good_override(self, x: int) -> int: ... @overload - def good_override(self, x: str) -> str: - ... + def good_override(self, x: str) -> str: ... - def good_override(self, x: int | str) -> int | str: - ... + def good_override(self, x: int | str) -> int | str: ... @overload - def to_override(self, x: int) -> int: - ... + def to_override(self, x: int) -> int: ... @overload - def to_override(self, x: str) -> str: - ... + def to_override(self, x: str) -> str: ... - def to_override(self, x: int | str) -> int | str: - ... + def to_override(self, x: int | str) -> int | str: ... class Child(Base): # E[override-final] - # The correctly-decorated @final method `Base.final_method` should cause an # error if overridden in a child class (we use an overload here to avoid # questions of override LSP compatibility and focus only on the override): - @overload # E[override-final] - def final_method(self, x: int) -> int: - ... + @overload # E[override-final] + def final_method(self, x: int) -> int: ... @overload - def final_method(self, x: str) -> str: - ... + def final_method(self, x: str) -> str: ... - def final_method(self, x: int | str) -> int | str: # E[override-final] can't override final method + def final_method( # E[override-final] can't override final method + self, x: int | str + ) -> int | str: # E[override-final] can't override final method ... # This is the right way to mark an overload as @override (decorate @@ -213,11 +192,10 @@ def bad_override(self, x: int) -> int: # E[bad_override] ... @overload - def bad_override(self, x: str) -> str: - ... + def bad_override(self, x: str) -> str: ... @override - def bad_override(self, x: int | str) -> int | str: # E[bad_override] + def bad_override(self, x: int | str) -> int | str: # E[bad_override] ... # This is also a correctly-decorated overloaded @override, which is @@ -228,31 +206,24 @@ def bad_override(self, x: int | str) -> int | str: # E[bad_override] # method that doesn't exist in base: @overload - def good_override(self, x: int) -> int: - ... + def good_override(self, x: int) -> int: ... @overload - def good_override(self, x: str) -> str: - ... + def good_override(self, x: str) -> str: ... @override - def good_override(self, x: int | str) -> int | str: - ... + 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 should appear only on implementation + @overload # E[override_impl]: @override should appear only on implementation @override - def to_override(self, x: int) -> int: - ... + def to_override(self, x: int) -> int: ... # E[override_impl] @overload @override - def to_override(self, x: str) -> str: - ... + def to_override(self, x: str) -> str: ... # E[override_impl] @override - def to_override(self, x: int | str) -> int | str: - ... - + 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 f86f2980..3ab48adf 100644 --- a/conformance/tests/overloads_definitions_stub.pyi +++ b/conformance/tests/overloads_definitions_stub.pyi @@ -14,20 +14,15 @@ from typing import ( def func1() -> None: # E[func1]: At least two overloads must be present ... - # > The ``@overload``-decorated definitions must be followed by an overload # > implementation, which does not include an ``@overload`` decorator. Type # > checkers should report an error or warning if an implementation is missing. # > Overload definitions within stub files, protocols, and on abstract methods # > within abstract base classes are exempt from this check. @overload -def func2(x: int) -> int: - ... - - +def func2(x: int) -> int: ... @overload -def func2(x: str) -> str: - ... +def func2(x: str) -> str: ... # > If one overload signature is decorated with ``@staticmethod`` or # > ``@classmethod``, all overload signatures must be similarly decorated. The @@ -37,22 +32,18 @@ class C: @overload # E[func5] def func5(x: int) -> int: # E[func5] ... - @overload @staticmethod def func5(x: str) -> str: # E[func5] ... - @overload # E[func6] @classmethod def func6(cls, x: int) -> int: # E[func6] ... - @overload def func6(cls, x: str) -> str: # E[func6] ... - # > If a ``@final`` or ``@override`` decorator is supplied for a function with # > overloads, the decorator should be applied only to the overload # > implementation if it is present. If an overload implementation isn't present @@ -62,18 +53,14 @@ class C: # > ``@override`` decorator follows these rules, a type checker should treat the # > decorator as if it is present on all overloads. class Base: - # This is a good definition of an overloaded final method in a stub (@final # decorator on first overload only): @overload @final - def final_method(self, x: int) -> int: - ... - + def final_method(self, x: int) -> int: ... @overload - def final_method(self, x: str) -> str: - ... + def final_method(self, x: str) -> str: ... # The @final decorator should not be on multiple overloads: @@ -81,15 +68,12 @@ class Base: @final def invalid_final(self, x: int) -> int: # E[invalid_final] ... - @overload # E[invalid_final] @final def invalid_final(self, x: str) -> str: # E[invalid_final] ... - @overload - def invalid_final(self, x: bytes) -> bytes: - ... + def invalid_final(self, x: bytes) -> bytes: ... # The @final decorator should not be on all overloads: @@ -97,11 +81,9 @@ class Base: @final def invalid_final_2(self, x: int) -> int: # E[invalid_final_2] ... - @overload # E[invalid_final_2] @final - def invalid_final_2(self, x: str) -> str: - ... + def invalid_final_2(self, x: str) -> str: ... # E[invalid_final_2] # These methods are just here for the @override test below. We use an # overload because mypy doesn't like overriding a non-overloaded method @@ -112,15 +94,12 @@ class Base: def good_override(self, x: int) -> int: ... @overload def good_override(self, x: str) -> str: ... - @overload def to_override(self, x: int) -> int: ... @overload def to_override(self, x: str) -> str: ... - class Child(Base): # E[override-final] - # The correctly-decorated @final method `Base.final_method` should cause an # error if overridden in a child class (we use an overload here to avoid # questions of override LSP compatibility and focus only on the override): @@ -128,9 +107,10 @@ class Child(Base): # E[override-final] @overload # E[override-final] def final_method(self, x: int) -> int: # E[override-final] ... - @overload - def final_method(self, x: str) -> str: # E[override-final] can't override final method + def final_method( # E[override-final] can't override final method + self, x: str + ) -> str: # E[override-final] can't override final method ... # This is the right way to mark an overload as @override (decorate first @@ -141,10 +121,8 @@ class Child(Base): # E[override-final] @override def bad_override(self, x: int) -> int: # E[bad_override] ... - @overload - def bad_override(self, x: str) -> str: - ... + def bad_override(self, x: str) -> str: ... # This is also a correctly-decorated overloaded @override, which is # overriding a method that does exist in the base, so there should be no @@ -155,21 +133,18 @@ class Child(Base): # E[override-final] @overload @override - def good_override(self, x: int) -> int: - ... - + def good_override(self, x: int) -> int: ... @overload - def good_override(self, x: str) -> str: - ... + def good_override(self, x: str) -> str: ... # This is the wrong way to use @override with an overloaded method, and # should emit an error: - @overload # E: @override should appear only on first overload - def to_override(self, x: int) -> int: - ... - + @overload # E[override_impl]: @override should appear only on first overload + def to_override(self, x: int) -> int: ... @overload @override - def to_override(self, x: str) -> str: + def to_override( # E[override_impl]: @override should appear only on first overload + self, x: str + ) -> str: # E[override_impl]: @override should appear only on first overload ...