From b292c2f3eda92c0e37991e3f23c4f1127a6299bf Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Sat, 6 Apr 2024 08:08:54 -0400 Subject: [PATCH] Conformance tests: Fix automated checking on overloads_basic.py --- conformance/results/mypy/overloads_basic.toml | 6 +----- conformance/results/pyre/overloads_basic.toml | 4 +--- conformance/results/pyright/overloads_basic.toml | 6 +----- conformance/results/pytype/overloads_basic.toml | 4 ++-- conformance/tests/overloads_basic.py | 12 ++++++------ 5 files changed, 11 insertions(+), 21 deletions(-) diff --git a/conformance/results/mypy/overloads_basic.toml b/conformance/results/mypy/overloads_basic.toml index ea9ac9962..6a7966962 100644 --- a/conformance/results/mypy/overloads_basic.toml +++ b/conformance/results/mypy/overloads_basic.toml @@ -7,10 +7,6 @@ overloads_basic.py:37: note: def __getitem__(self, slice, /) -> bytes overloads_basic.py:62: error: Single overload definition, multiple required [misc] overloads_basic.py:74: error: An overloaded function outside a stub file must have an implementation [no-overload-impl] """ -conformance_automated = "Fail" +conformance_automated = "Pass" errors_diff = """ -Line 64: Expected 1 errors -Line 76: Expected 1 errors -Line 62: Unexpected errors ['overloads_basic.py:62: error: Single overload definition, multiple required [misc]'] -Line 74: Unexpected errors ['overloads_basic.py:74: error: An overloaded function outside a stub file must have an implementation [no-overload-impl]'] """ diff --git a/conformance/results/pyre/overloads_basic.toml b/conformance/results/pyre/overloads_basic.toml index 7f8da3834..7de070af9 100644 --- a/conformance/results/pyre/overloads_basic.toml +++ b/conformance/results/pyre/overloads_basic.toml @@ -8,7 +8,5 @@ overloads_basic.py:75:0 Missing overload implementation [42]: Overloaded functio """ conformance_automated = "Fail" errors_diff = """ -Line 64: Expected 1 errors -Line 76: Expected 1 errors -Line 75: Unexpected errors ['overloads_basic.py:75:0 Missing overload implementation [42]: Overloaded function `func2` must have an implementation.'] +Lines 62, 63: Expected error (tag 'func1') """ diff --git a/conformance/results/pyright/overloads_basic.toml b/conformance/results/pyright/overloads_basic.toml index 8f601518a..a4f03e2f5 100644 --- a/conformance/results/pyright/overloads_basic.toml +++ b/conformance/results/pyright/overloads_basic.toml @@ -6,10 +6,6 @@ overloads_basic.py:37:1 - error: Argument of type "Literal['']" cannot be assign overloads_basic.py:63:5 - error: "func1" is marked as overload, but additional overloads are missing (reportInconsistentOverload) overloads_basic.py:75:5 - error: "func2" is marked as overload, but no implementation is provided (reportNoOverloadImplementation) """ -conformance_automated = "Fail" +conformance_automated = "Pass" errors_diff = """ -Line 64: Expected 1 errors -Line 76: Expected 1 errors -Line 63: Unexpected errors ['overloads_basic.py:63:5 - error: "func1" is marked as overload, but additional overloads are missing (reportInconsistentOverload)'] -Line 75: Unexpected errors ['overloads_basic.py:75:5 - error: "func2" is marked as overload, but no implementation is provided (reportNoOverloadImplementation)'] """ diff --git a/conformance/results/pytype/overloads_basic.toml b/conformance/results/pytype/overloads_basic.toml index d06b2e630..8d90cba20 100644 --- a/conformance/results/pytype/overloads_basic.toml +++ b/conformance/results/pytype/overloads_basic.toml @@ -10,8 +10,8 @@ File "overloads_basic.py", line 58, in map: bad return type [bad-return-type] """ conformance_automated = "Fail" errors_diff = """ -Line 64: Expected 1 errors -Line 76: Expected 1 errors +Lines 62, 63: Expected error (tag 'func1') +Lines 74, 75: Expected error (tag 'func2') Line 31: Unexpected errors ['File "overloads_basic.py", line 31, in __getitem__: bad return type [bad-return-type]'] Line 58: Unexpected errors ['File "overloads_basic.py", line 58, in map: bad return type [bad-return-type]'] """ diff --git a/conformance/tests/overloads_basic.py b/conformance/tests/overloads_basic.py index d5fb2bada..86c81765d 100644 --- a/conformance/tests/overloads_basic.py +++ b/conformance/tests/overloads_basic.py @@ -59,9 +59,9 @@ def map(func: Any, iter1: Any, iter2: Any = ...) -> Any: # At least two overload signatures should be provided. -@overload -def func1() -> None: - ... # E: At least two overloads must be present +@overload # E[func1] +def func1() -> None: # E[func1]: At least two overloads must be present + ... def func1() -> None: @@ -71,9 +71,9 @@ def func1() -> None: # > In regular modules, a series of @overload-decorated definitions must be # > followed by exactly one non-@overload-decorated definition (for the same # > function/method). -@overload -def func2(x: int) -> int: - ... # E: no implementation +@overload # E[func2] +def func2(x: int) -> int: # E[func2]: no implementation + ... @overload