Skip to content

Commit

Permalink
error rename
Browse files Browse the repository at this point in the history
  • Loading branch information
katconnors committed Jul 30, 2024
1 parent a9c5d57 commit e28d3a4
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 9 deletions.
4 changes: 2 additions & 2 deletions docs/source/error_code_list.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1150,7 +1150,7 @@ types you expect.
See :ref:`overloading <function-overloading>` for more explanation.


.. _code-overloaded-function-matching:
.. _code-overload-cannot-match:

Check error code of overload function signature match
--------------------------------------------------------------------------
Expand All @@ -1163,7 +1163,7 @@ Check error code of overload function signature match
def process(response1: float,response2: float) -> float:
...
@overload
def process(response1: int,response2: int) -> int: # E: Overloaded function signature 2 will never be matched: signature 1's parameter type(s) are the same or broader [overloaded-function-matching]
def process(response1: int,response2: int) -> int: # E: Overloaded function signature 2 will never be matched: signature 1's parameter type(s) are the same or broader [overload-cannot-match]
...
def process(response1,response2)-> Union[float,int]:
Expand Down
1 change: 0 additions & 1 deletion mypy/checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,6 @@ def check_overlapping_overloads(self, defn: OverloadedFuncDef) -> None:
continue

if overload_can_never_match(sig1, sig2):

self.msg.overloaded_signature_will_never_match(i + 1, i + j + 2, item2.func)
elif not is_descriptor_get:
# Note: we force mypy to check overload signatures in strict-optional mode
Expand Down
5 changes: 2 additions & 3 deletions mypy/errorcodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,6 @@ def __hash__(self) -> int:
default_enabled=False,
)


# Syntax errors are often blocking.
SYNTAX: Final[ErrorCode] = ErrorCode("syntax", "Report syntax errors", "General")

Expand All @@ -274,8 +273,8 @@ def __hash__(self) -> int:
# This is a catch-all for remaining uncategorized errors.
MISC: Final[ErrorCode] = ErrorCode("misc", "Miscellaneous other checks", "General")

OVERLOADED_FUNCTION_MATCHING: Final[ErrorCode] = ErrorCode(
"overloaded-function-matching",
OVERLOAD_CANNOT_MATCH: Final[ErrorCode] = ErrorCode(
"overload-cannot-match",
"Warn user about signature matching for overloaded functions.",
"General",
sub_code_of=MISC,
Expand Down
2 changes: 1 addition & 1 deletion mypy/message_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,5 +365,5 @@ def with_additional_msg(self, info: str) -> ErrorMessage:

# Overloads
OVERLOADED_FUNCTION_SIGNATURE: Final = ErrorMessage(
"Overloaded function signature {} will never be matched", codes.OVERLOADED_FUNCTION_MATCHING
"Overloaded function signature {} will never be matched", codes.OVERLOAD_CANNOT_MATCH
)
2 changes: 1 addition & 1 deletion mypy/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -1653,7 +1653,7 @@ def overloaded_signature_will_never_match(
index1=index1, index2=index2
),
context,
code=codes.OVERLOADED_FUNCTION_MATCHING,
code=codes.OVERLOAD_CANNOT_MATCH,
)

def overloaded_signatures_typevar_specific(self, index: int, context: Context) -> None:
Expand Down
2 changes: 1 addition & 1 deletion test-data/unit/check-errorcodes.test
Original file line number Diff line number Diff line change
Expand Up @@ -1205,7 +1205,7 @@ from typing import overload, Union
def process(response1: float,response2: float) -> float:
...
@overload
def process(response1: int,response2: int) -> int: # E: Overloaded function signature 2 will never be matched: signature 1's parameter type(s) are the same or broader [overloaded-function-matching]
def process(response1: int,response2: int) -> int: # E: Overloaded function signature 2 will never be matched: signature 1's parameter type(s) are the same or broader [overload-cannot-match]
...

def process(response1,response2)-> Union[float,int]:
Expand Down

0 comments on commit e28d3a4

Please sign in to comment.