Skip to content

Commit

Permalink
Improve error message on passing an argument twice.
Browse files Browse the repository at this point in the history
  • Loading branch information
whitequark committed Aug 8, 2015
1 parent bdcf7f1 commit ee3f35c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions artiq/compiler/transforms/inferencer.py
Expand Up @@ -696,7 +696,7 @@ def visit_CallT(self, node):
return

typ = node.func.type.find()
passed_args = set()
passed_args = dict()

if len(node.args) > typ.arity():
note = diagnostic.Diagnostic("note",
Expand All @@ -714,14 +714,14 @@ def visit_CallT(self, node):
zip(node.args, list(typ.args.items()) + list(typ.optargs.items())):
self._unify(actualarg.type, formaltyp,
actualarg.loc, None)
passed_args.add(formalname)
passed_args[formalname] = actualarg.loc

for keyword in node.keywords:
if keyword.arg in passed_args:
diag = diagnostic.Diagnostic("error",
"the argument '{name}' is already passed",
"the argument '{name}' has been passed earlier as positional",
{"name": keyword.arg},
keyword.arg_loc)
keyword.arg_loc, [passed_args[keyword.arg]])
self.engine.process(diag)
return

Expand Down

0 comments on commit ee3f35c

Please sign in to comment.