@@ -2481,6 +2481,17 @@ 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 (arg_type ):
2490+ is_mapping = is_subtype (
2491+ arg_type , self .chk .named_type ("_typeshed.SupportsKeysAndGetItem" )
2492+ )
2493+ self .msg .invalid_keyword_var_arg (arg_type , is_mapping , context )
2494+
24842495 for i , actuals in enumerate (formal_to_actual ):
24852496 orig_callee_arg_type = get_proper_type (callee .arg_types [i ])
24862497
@@ -2573,15 +2584,6 @@ def check_argument_types(
25732584 if actual_type is None :
25742585 continue # Some kind of error was already reported.
25752586 # 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 )
25852587 expanded_actual = mapper .expand_actual_type (
25862588 actual_type ,
25872589 actual_kind ,
0 commit comments