forked from python/mypy
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix compatibility checks for conditional function definitions using d…
…ecorators (python#18020) Fixes python#17211, resolves this `# TODO`: https://github.com/python/mypy/blob/e106dd7a0653c24d67597adf3ae6939d7ff9a376/test-data/unit/check-functions.test#L1486-L1494 ### Before ```python from typing import Callable def dec(f: object) -> Callable[[int], None]: raise NotImplementedError if int(): def f(x: str) -> None: pass else: @dec def f() -> None: pass # uh oh! passes without error ``` ### After ```python from typing import Callable def dec(f: object) -> Callable[[int], None]: raise NotImplementedError if int(): def f(x: str) -> None: pass else: @dec def f() -> None: pass # E: All conditional function variants must have identical signatures \ # N: Original: \ # N: def f(x: str) -> None \ # N: Redefinition: \ # N: def f(int, /) -> None ```
- Loading branch information
1 parent
e106dd7
commit 60d1b37
Showing
4 changed files
with
60 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters