Skip to content

Commit 2dea83d

Browse files
authored
Tweaked overload conformance tests to permit errors to appear in a few additional places (#1956)
Tweaked overload conformance tests to permit errors to appear in a few additional places. Updated conformance results for pyright, which passes the overload conformance tests in the latest version.
1 parent 5f97c00 commit 2dea83d

14 files changed

+263
-356
lines changed

conformance/results/mypy/overloads_definitions.toml

+14-14
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,20 @@ Does not allow an overload with no implementation in an abstract base class.
55
Allows @override to be on all overloads and implementation, instead of just implementation.
66
"""
77
errors_diff = """
8-
Line 245: Expected 1 errors
9-
Line 49: Unexpected errors ['overloads_definitions.py:49: error: An overloaded function outside a stub file must have an implementation [no-overload-impl]']
8+
Lines 220, 222, 226: Expected error (tag 'override_impl')
9+
Line 47: Unexpected errors ['overloads_definitions.py:47: error: An overloaded function outside a stub file must have an implementation [no-overload-impl]']
1010
"""
1111
output = """
12-
overloads_definitions.py:14: error: Single overload definition, multiple required [misc]
13-
overloads_definitions.py:26: error: An overloaded function outside a stub file must have an implementation [no-overload-impl]
14-
overloads_definitions.py:49: error: An overloaded function outside a stub file must have an implementation [no-overload-impl]
15-
overloads_definitions.py:63: error: An overloaded function outside a stub file must have an implementation [no-overload-impl]
16-
overloads_definitions.py:78: error: Overload does not consistently use the "@staticmethod" decorator on all function signatures. [misc]
17-
overloads_definitions.py:88: error: Overloaded function implementation does not accept all possible arguments of signature 1 [misc]
18-
overloads_definitions.py:88: error: Overloaded function implementation does not accept all possible arguments of signature 2 [misc]
19-
overloads_definitions.py:91: error: Overload does not consistently use the "@classmethod" decorator on all function signatures. [misc]
20-
overloads_definitions.py:133: error: @final should be applied only to overload implementation [misc]
21-
overloads_definitions.py:148: error: @final should be applied only to overload implementation [misc]
22-
overloads_definitions.py:196: error: Cannot override final attribute "final_method" (previously declared in base class "Base") [misc]
23-
overloads_definitions.py:211: error: Method "bad_override" is marked as an override, but no base method was found with this name [misc]
12+
overloads_definitions.py:15: error: Single overload definition, multiple required [misc]
13+
overloads_definitions.py:27: error: An overloaded function outside a stub file must have an implementation [no-overload-impl]
14+
overloads_definitions.py:47: error: An overloaded function outside a stub file must have an implementation [no-overload-impl]
15+
overloads_definitions.py:58: error: An overloaded function outside a stub file must have an implementation [no-overload-impl]
16+
overloads_definitions.py:71: error: Overload does not consistently use the "@staticmethod" decorator on all function signatures. [misc]
17+
overloads_definitions.py:81: error: Overloaded function implementation does not accept all possible arguments of signature 1 [misc]
18+
overloads_definitions.py:81: error: Overloaded function implementation does not accept all possible arguments of signature 2 [misc]
19+
overloads_definitions.py:84: error: Overload does not consistently use the "@classmethod" decorator on all function signatures. [misc]
20+
overloads_definitions.py:121: error: @final should be applied only to overload implementation [misc]
21+
overloads_definitions.py:135: error: @final should be applied only to overload implementation [misc]
22+
overloads_definitions.py:175: error: Cannot override final attribute "final_method" (previously declared in base class "Base") [misc]
23+
overloads_definitions.py:190: error: Method "bad_override" is marked as an override, but no base method was found with this name [misc]
2424
"""

conformance/results/mypy/overloads_definitions_stub.toml

+8-8
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ Allows @override to appear in a stub file not on the first overload.
44
"""
55
conformance_automated = "Fail"
66
errors_diff = """
7-
Line 168: Expected 1 errors
7+
Lines 143, 147, 149: Expected error (tag 'override_impl')
88
"""
99
output = """
1010
overloads_definitions_stub.pyi:13: error: Single overload definition, multiple required [misc]
11-
overloads_definitions_stub.pyi:37: error: Overload does not consistently use the "@staticmethod" decorator on all function signatures. [misc]
12-
overloads_definitions_stub.pyi:38: error: Self argument missing for a non-static method (or an invalid type for self) [misc]
13-
overloads_definitions_stub.pyi:46: error: Overload does not consistently use the "@classmethod" decorator on all function signatures. [misc]
14-
overloads_definitions_stub.pyi:85: error: In a stub file @final must be applied only to the first overload [misc]
15-
overloads_definitions_stub.pyi:101: error: In a stub file @final must be applied only to the first overload [misc]
16-
overloads_definitions_stub.pyi:128: error: Cannot override final attribute "final_method" (previously declared in base class "Base") [misc]
17-
overloads_definitions_stub.pyi:140: error: Method "bad_override" is marked as an override, but no base method was found with this name [misc]
11+
overloads_definitions_stub.pyi:32: error: Overload does not consistently use the "@staticmethod" decorator on all function signatures. [misc]
12+
overloads_definitions_stub.pyi:33: error: Self argument missing for a non-static method (or an invalid type for self) [misc]
13+
overloads_definitions_stub.pyi:39: error: Overload does not consistently use the "@classmethod" decorator on all function signatures. [misc]
14+
overloads_definitions_stub.pyi:71: error: In a stub file @final must be applied only to the first overload [misc]
15+
overloads_definitions_stub.pyi:84: error: In a stub file @final must be applied only to the first overload [misc]
16+
overloads_definitions_stub.pyi:107: error: Cannot override final attribute "final_method" (previously declared in base class "Base") [misc]
17+
overloads_definitions_stub.pyi:120: error: Method "bad_override" is marked as an override, but no base method was found with this name [misc]
1818
"""

conformance/results/pyre/overloads_definitions.toml

+20-20
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,28 @@ Does not allow an overload with no implementation in a Protocol or an abstract b
55
Expects @final/@override on all overloads and implementation, instead of implementation only.
66
"""
77
errors_diff = """
8-
Line 245: Expected 1 errors
9-
Lines 148, 150: Expected error (tag 'invalid_final_2')
8+
Lines 135, 137, 142: Expected error (tag 'invalid_final_2')
9+
Lines 220, 222, 226: Expected error (tag 'override_impl')
1010
Line 40: Unexpected errors ['overloads_definitions.py:40:4 Missing overload implementation [42]: Overloaded function `MyProto.func3` must have an implementation.']
11-
Line 51: Unexpected errors ['overloads_definitions.py:51:4 Missing overload implementation [42]: Overloaded function `MyAbstractBase.func4` must have an implementation.']
12-
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).']
13-
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).']
11+
Line 49: Unexpected errors ['overloads_definitions.py:49:4 Missing overload implementation [42]: Overloaded function `MyAbstractBase.func4` must have an implementation.']
12+
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).']
13+
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).']
1414
"""
1515
output = """
16-
overloads_definitions.py:15:0 Incompatible overload [43]: At least two overload signatures must be present.
17-
overloads_definitions.py:27:0 Missing overload implementation [42]: Overloaded function `func2` must have an implementation.
16+
overloads_definitions.py:16:0 Incompatible overload [43]: At least two overload signatures must be present.
17+
overloads_definitions.py:28:0 Missing overload implementation [42]: Overloaded function `func2` must have an implementation.
1818
overloads_definitions.py:40:4 Missing overload implementation [42]: Overloaded function `MyProto.func3` must have an implementation.
19-
overloads_definitions.py:51:4 Missing overload implementation [42]: Overloaded function `MyAbstractBase.func4` must have an implementation.
20-
overloads_definitions.py:64:4 Missing overload implementation [42]: Overloaded function `MyAbstractBase.not_abstract` must have an implementation.
21-
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`.
22-
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`.
23-
overloads_definitions.py:88:4 Incompatible overload [43]: This definition does not have the same decorators as the preceding overload(s).
24-
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`.
25-
overloads_definitions.py:97:4 Incompatible overload [43]: This definition does not have the same decorators as the preceding overload(s).
26-
overloads_definitions.py:128:4 Incompatible overload [43]: This definition does not have the same decorators as the preceding overload(s).
27-
overloads_definitions.py:139:4 Incompatible overload [43]: This definition does not have the same decorators as the preceding overload(s).
28-
overloads_definitions.py:204:4 Invalid override [40]: `overloads_definitions.Child.final_method` cannot override final method defined in `Base`.
29-
overloads_definitions.py:220:4 Incompatible overload [43]: This definition does not have the same decorators as the preceding overload(s).
30-
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`.
31-
overloads_definitions.py:239:4 Incompatible overload [43]: This definition does not have the same decorators as the preceding overload(s).
19+
overloads_definitions.py:49:4 Missing overload implementation [42]: Overloaded function `MyAbstractBase.func4` must have an implementation.
20+
overloads_definitions.py:59:4 Missing overload implementation [42]: Overloaded function `MyAbstractBase.not_abstract` must have an implementation.
21+
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`.
22+
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`.
23+
overloads_definitions.py:81:4 Incompatible overload [43]: This definition does not have the same decorators as the preceding overload(s).
24+
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`.
25+
overloads_definitions.py:90:4 Incompatible overload [43]: This definition does not have the same decorators as the preceding overload(s).
26+
overloads_definitions.py:117:4 Incompatible overload [43]: This definition does not have the same decorators as the preceding overload(s).
27+
overloads_definitions.py:127:4 Incompatible overload [43]: This definition does not have the same decorators as the preceding overload(s).
28+
overloads_definitions.py:181:4 Invalid override [40]: `overloads_definitions.Child.final_method` cannot override final method defined in `Base`.
29+
overloads_definitions.py:198:4 Incompatible overload [43]: This definition does not have the same decorators as the preceding overload(s).
30+
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`.
31+
overloads_definitions.py:215:4 Incompatible overload [43]: This definition does not have the same decorators as the preceding overload(s).
3232
"""

conformance/results/pyre/overloads_definitions_stub.toml

+15-17
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,22 @@ Expects @final and @override to be present on all overloads, not just first.
44
"""
55
conformance_automated = "Fail"
66
errors_diff = """
7-
Line 168: Expected 1 errors
8-
Lines 80, 82, 85, 87: Expected error (tag 'invalid_final')
9-
Lines 96, 98, 101: Expected error (tag 'invalid_final_2')
10-
Lines 122, 128, 129, 133: Expected error (tag 'override-final')
11-
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).']
12-
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).']
13-
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).']
14-
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).']
15-
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).']
7+
Lines 67, 69, 71, 73: Expected error (tag 'invalid_final')
8+
Lines 80, 82, 84, 86: Expected error (tag 'invalid_final_2')
9+
Lines 102, 107, 108, 111, 113: Expected error (tag 'override-final')
10+
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).']
11+
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).']
12+
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).']
13+
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).']
1614
"""
1715
output = """
1816
overloads_definitions_stub.pyi:14:0 Incompatible overload [43]: At least two overload signatures must be present.
19-
overloads_definitions_stub.pyi:43:4 Incompatible overload [43]: This definition does not have the same decorators as the preceding overload(s).
20-
overloads_definitions_stub.pyi:52:4 Incompatible overload [43]: This definition does not have the same decorators as the preceding overload(s).
21-
overloads_definitions_stub.pyi:75:4 Incompatible overload [43]: This definition does not have the same decorators as the preceding overload(s).
22-
overloads_definitions_stub.pyi:91:4 Incompatible overload [43]: This definition does not have the same decorators as the preceding overload(s).
23-
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`.
24-
overloads_definitions_stub.pyi:146:4 Incompatible overload [43]: This definition does not have the same decorators as the preceding overload(s).
25-
overloads_definitions_stub.pyi:162:4 Incompatible overload [43]: This definition does not have the same decorators as the preceding overload(s).
26-
overloads_definitions_stub.pyi:174:4 Incompatible overload [43]: This definition does not have the same decorators as the preceding overload(s).
17+
overloads_definitions_stub.pyi:37:4 Incompatible overload [43]: This definition does not have the same decorators as the preceding overload(s).
18+
overloads_definitions_stub.pyi:44:4 Incompatible overload [43]: This definition does not have the same decorators as the preceding overload(s).
19+
overloads_definitions_stub.pyi:63:4 Incompatible overload [43]: This definition does not have the same decorators as the preceding overload(s).
20+
overloads_definitions_stub.pyi:76:4 Incompatible overload [43]: This definition does not have the same decorators as the preceding overload(s).
21+
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`.
22+
overloads_definitions_stub.pyi:125:4 Incompatible overload [43]: This definition does not have the same decorators as the preceding overload(s).
23+
overloads_definitions_stub.pyi:138:4 Incompatible overload [43]: This definition does not have the same decorators as the preceding overload(s).
24+
overloads_definitions_stub.pyi:147:4 Incompatible overload [43]: This definition does not have the same decorators as the preceding overload(s).
2725
"""

conformance/results/pyre/version.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
version = "pyre 0.9.23"
2-
test_duration = 7.4
2+
test_duration = 6.3

0 commit comments

Comments
 (0)