@@ -353,7 +353,7 @@ def is_callable_subtype(left: CallableType, right: CallableType,
353
353
# This fetches the synthetic argument that's from the *args
354
354
right_by_position = right .argument_by_position (j )
355
355
assert right_by_position is not None
356
- if not is_left_more_general (left_by_position , right_by_position ,
356
+ if not are_args_compatible (left_by_position , right_by_position ,
357
357
ignore_pos_arg_names ):
358
358
return False
359
359
j += 1
@@ -376,7 +376,7 @@ def is_callable_subtype(left: CallableType, right: CallableType,
376
376
# This fetches the synthetic argument that's from the **kwargs
377
377
right_by_name = right .argument_by_name (name )
378
378
assert right_by_name is not None
379
- if not is_left_more_general (left_by_name , right_by_name ,
379
+ if not are_args_compatible (left_by_name , right_by_name ,
380
380
ignore_pos_arg_names ):
381
381
return False
382
382
continue
@@ -421,7 +421,7 @@ def is_callable_subtype(left: CallableType, right: CallableType,
421
421
422
422
assert left_arg is not None
423
423
424
- if not is_left_more_general (left_arg , right_arg , ignore_pos_arg_names ):
424
+ if not are_args_compatible (left_arg , right_arg , ignore_pos_arg_names ):
425
425
return False
426
426
427
427
done_with_positional = False
@@ -462,14 +462,14 @@ def is_callable_subtype(left: CallableType, right: CallableType,
462
462
return False
463
463
464
464
# All *required* left-hand arguments must have a corresponding
465
- # right-hand argument.
465
+ # right-hand argument. Optional args it does not matter.
466
466
if left_arg .required and right_by_pos is None and right_by_name is None :
467
467
return False
468
468
469
469
return True
470
470
471
471
472
- def is_left_more_general (
472
+ def are_args_compatible (
473
473
left : FormalArgument ,
474
474
right : FormalArgument ,
475
475
ignore_pos_arg_names : bool ) -> bool :
0 commit comments