@@ -2481,6 +2481,19 @@ def check_argument_types(
24812481 check_arg = check_arg or self .check_arg
24822482 # Keep track of consumed tuple *arg items.
24832483 mapper = ArgTypeExpander (self .argument_infer_context ())
2484+
2485+ for arg_type , arg_kind in zip (arg_types , arg_kinds ):
2486+ arg_type = get_proper_type (arg_type )
2487+ if arg_kind == nodes .ARG_STAR and not self .is_valid_var_arg (arg_type ):
2488+ self .msg .invalid_var_arg (arg_type , context )
2489+ if arg_kind == nodes .ARG_STAR2 and not self .is_valid_keyword_var_arg (
2490+ arg_type
2491+ ):
2492+ is_mapping = is_subtype (
2493+ arg_type , self .chk .named_type ("_typeshed.SupportsKeysAndGetItem" )
2494+ )
2495+ self .msg .invalid_keyword_var_arg (arg_type , is_mapping , context )
2496+
24842497 for i , actuals in enumerate (formal_to_actual ):
24852498 orig_callee_arg_type = get_proper_type (callee .arg_types [i ])
24862499
@@ -2573,15 +2586,6 @@ def check_argument_types(
25732586 if actual_type is None :
25742587 continue # Some kind of error was already reported.
25752588 # Check that a *arg is valid as varargs.
2576- if actual_kind == nodes .ARG_STAR and not self .is_valid_var_arg (actual_type ):
2577- self .msg .invalid_var_arg (actual_type , context )
2578- if actual_kind == nodes .ARG_STAR2 and not self .is_valid_keyword_var_arg (
2579- actual_type
2580- ):
2581- is_mapping = is_subtype (
2582- actual_type , self .chk .named_type ("_typeshed.SupportsKeysAndGetItem" )
2583- )
2584- self .msg .invalid_keyword_var_arg (actual_type , is_mapping , context )
25852589 expanded_actual = mapper .expand_actual_type (
25862590 actual_type ,
25872591 actual_kind ,
0 commit comments