@@ -663,7 +663,7 @@ def overload_call_target(self, arg_types: List[Type], arg_kinds: List[int],
663
663
best_match = 0
664
664
for typ in overload .items ():
665
665
similarity = self .erased_signature_similarity (arg_types , arg_kinds , arg_names ,
666
- typ )
666
+ typ , context = context )
667
667
if similarity > 0 and similarity >= best_match :
668
668
if (match and not is_same_type (match [- 1 ].ret_type ,
669
669
typ .ret_type ) and
@@ -702,12 +702,14 @@ def overload_call_target(self, arg_types: List[Type], arg_kinds: List[int],
702
702
# matching signature, or default to the first one if none
703
703
# match.
704
704
for m in match :
705
- if self .match_signature_types (arg_types , arg_kinds , arg_names , m ):
705
+ if self .match_signature_types (arg_types , arg_kinds , arg_names , m ,
706
+ context = context ):
706
707
return m
707
708
return match [0 ]
708
709
709
710
def erased_signature_similarity (self , arg_types : List [Type ], arg_kinds : List [int ],
710
- arg_names : List [str ], callee : CallableType ) -> int :
711
+ arg_names : List [str ], callee : CallableType ,
712
+ context : Context ) -> int :
711
713
"""Determine whether arguments could match the signature at runtime.
712
714
713
715
Return similarity level (0 = no match, 1 = can match, 2 = non-promotion match). See
@@ -739,14 +741,15 @@ def check_arg(caller_type: Type, original_caller_type: Type, caller_kind: int,
739
741
740
742
try :
741
743
self .check_argument_types (arg_types , arg_kinds , callee , formal_to_actual ,
742
- None , check_arg = check_arg )
744
+ context = context , check_arg = check_arg )
743
745
except Finished :
744
746
pass
745
747
746
748
return similarity
747
749
748
750
def match_signature_types (self , arg_types : List [Type ], arg_kinds : List [int ],
749
- arg_names : List [str ], callee : CallableType ) -> bool :
751
+ arg_names : List [str ], callee : CallableType ,
752
+ context : Context ) -> bool :
750
753
"""Determine whether arguments types match the signature.
751
754
752
755
Assume that argument counts are compatible.
@@ -768,7 +771,7 @@ def check_arg(caller_type: Type, original_caller_type: Type, caller_kind: int,
768
771
ok = False
769
772
770
773
self .check_argument_types (arg_types , arg_kinds , callee , formal_to_actual ,
771
- None , check_arg = check_arg )
774
+ context = context , check_arg = check_arg )
772
775
return ok
773
776
774
777
def apply_generic_arguments (self , callable : CallableType , types : List [Type ],
0 commit comments