|
40 | 40 | from mypy.checkmember import map_type_from_supertype, bind_self, erase_to_bound
|
41 | 41 | from mypy import messages
|
42 | 42 | from mypy.subtypes import (
|
43 |
| - is_subtype, is_equivalent, is_proper_subtype, is_more_precise, restrict_subtype_away, |
44 |
| - is_subtype_ignoring_tvars |
| 43 | + is_subtype, is_equivalent, is_proper_subtype, is_more_precise, |
| 44 | + restrict_subtype_away, is_subtype_ignoring_tvars |
45 | 45 | )
|
46 | 46 | from mypy.maptype import map_instance_to_supertype
|
47 | 47 | from mypy.semanal import fill_typevars, set_callable_name, refers_to_fullname
|
@@ -835,7 +835,7 @@ def check_inplace_operator_method(self, defn: FuncBase) -> None:
|
835 | 835 | def check_getattr_method(self, typ: CallableType, context: Context) -> None:
|
836 | 836 | method_type = CallableType([AnyType(), self.named_type('builtins.str')],
|
837 | 837 | [nodes.ARG_POS, nodes.ARG_POS],
|
838 |
| - [None], |
| 838 | + [None, None], |
839 | 839 | AnyType(),
|
840 | 840 | self.named_type('builtins.function'))
|
841 | 841 | if not is_subtype(typ, method_type):
|
@@ -936,7 +936,7 @@ def check_override(self, override: FunctionLike, original: FunctionLike,
|
936 | 936 | """
|
937 | 937 | # Use boolean variable to clarify code.
|
938 | 938 | fail = False
|
939 |
| - if not is_subtype(override, original): |
| 939 | + if not is_subtype(override, original, ignore_pos_arg_names=True): |
940 | 940 | fail = True
|
941 | 941 | elif (not isinstance(original, Overloaded) and
|
942 | 942 | isinstance(override, Overloaded) and
|
@@ -1043,7 +1043,7 @@ def check_compatibility(self, name: str, base1: TypeInfo,
|
1043 | 1043 | # Method override
|
1044 | 1044 | first_sig = bind_self(first_type)
|
1045 | 1045 | second_sig = bind_self(second_type)
|
1046 |
| - ok = is_subtype(first_sig, second_sig) |
| 1046 | + ok = is_subtype(first_sig, second_sig, ignore_pos_arg_names=True) |
1047 | 1047 | elif first_type and second_type:
|
1048 | 1048 | ok = is_equivalent(first_type, second_type)
|
1049 | 1049 | else:
|
|
0 commit comments