forked from M-Labs/artiq
parent
7986391422
commit
86ceee570f
|
@ -1004,6 +1004,17 @@ class Inferencer(algorithm.Visitor):
|
|||
elif keyword.arg in typ_optargs:
|
||||
self._unify(keyword.value.type, typ_optargs[keyword.arg],
|
||||
keyword.value.loc, None)
|
||||
else:
|
||||
note = diagnostic.Diagnostic("note",
|
||||
"extraneous argument", {},
|
||||
keyword.loc)
|
||||
diag = diagnostic.Diagnostic("error",
|
||||
"this function of type {type} does not accept argument '{name}'",
|
||||
{"type": types.TypePrinter().name(node.func.type),
|
||||
"name": keyword.arg},
|
||||
node.func.loc, [], [note])
|
||||
self.engine.process(diag)
|
||||
return
|
||||
passed_args[keyword.arg] = keyword.arg_loc
|
||||
|
||||
for formalname in typ_args:
|
||||
|
|
|
@ -18,3 +18,6 @@ f(1, x=1)
|
|||
|
||||
# CHECK-L: ${LINE:+1}: error: mandatory argument 'x' is not passed
|
||||
f()
|
||||
|
||||
# CHECK: ${LINE:+1}: error: this function of type .* does not accept argument 'q'
|
||||
f(1, q=1)
|
||||
|
|
Loading…
Reference in New Issue