Skip to content

Commit b71990a

Browse files
committed
Small recfactoring to remove the implementation signature fallback to pass mypy_primer
1 parent d4da7cb commit b71990a

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

mypy/checker.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2500,8 +2500,19 @@ def check_override(
25002500
if isinstance(override, Overloaded) and isinstance(original, CallableType):
25012501
if not self.is_forward_op_method(name):
25022502
if all(is_subtype(item.ret_type, original.ret_type) for item in override.items):
2503+
# Return True to maintain backwards compatibility with existing mypy_primer
25032504
return True
2504-
2505+
if isinstance(node, OverloadedFuncDef) and node.impl and node.impl.type:
2506+
impl_type = node.impl.type
2507+
if is_subtype(impl_type, original, ignore_pos_arg_names=True):
2508+
return True
2509+
proper_impl_type = get_proper_type(impl_type)
2510+
if isinstance(proper_impl_type, CallableType):
2511+
if any(
2512+
isinstance(get_proper_type(tp), AnyType)
2513+
for tp in proper_impl_type.arg_types
2514+
):
2515+
return True
25052516
if not is_subtype(override, original, ignore_pos_arg_names=True):
25062517
fail = True
25072518
elif isinstance(override, Overloaded) and self.is_forward_op_method(name):

0 commit comments

Comments
 (0)