Skip to content

Commit

Permalink
FormalArgument#pos can be 0...
Browse files Browse the repository at this point in the history
  • Loading branch information
A5rocks authored May 19, 2022
1 parent a455428 commit 94f4ce1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions mypy/subtypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1210,11 +1210,13 @@ def unify_generic_callable(type: CallableType, target: CallableType,
for i in range(len(target.arg_types)):
if target.arg_names[i]:
c = mypy.constraints.infer_constraints(
argument_names_map[target.arg_names[i]], target.arg_types[i], mypy.constraints.SUPERTYPE_OF)
argument_names_map[target.arg_names[i]],
target.arg_types[i],
mypy.constraints.SUPERTYPE_OF)
constraints.extend(c)
# check pos-only arguments
for arg, target_arg in zip(type.formal_arguments(), target.formal_arguments()):
if arg.pos and target_arg.pos:
if arg.pos is not None and target_arg.pos is not None:
c = mypy.constraints.infer_constraints(
arg.typ, target_arg.typ, mypy.constraints.SUPERTYPE_OF)
constraints.extend(c)
Expand Down

0 comments on commit 94f4ce1

Please sign in to comment.