mirror of https://github.com/m-labs/artiq.git
Improve builtin call error message.
This commit is contained in:
parent
196acb37f6
commit
8a65266f14
|
@ -374,9 +374,13 @@ class Inferencer(algorithm.Visitor):
|
||||||
node.func.loc)
|
node.func.loc)
|
||||||
|
|
||||||
def diagnose(valid_forms):
|
def diagnose(valid_forms):
|
||||||
|
printer = types.TypePrinter()
|
||||||
|
args = [printer.name(arg.type) for arg in node.args]
|
||||||
|
args += ["%s=%s" % (kw.arg, printer.name(kw.value.type)) for kw in node.keywords]
|
||||||
|
|
||||||
diag = diagnostic.Diagnostic("error",
|
diag = diagnostic.Diagnostic("error",
|
||||||
"{func} cannot be invoked with these arguments",
|
"{func} cannot be invoked with the arguments ({args})",
|
||||||
{"func": typ.name},
|
{"func": typ.name, "args": ", ".join(args)},
|
||||||
node.func.loc, notes=valid_forms)
|
node.func.loc, notes=valid_forms)
|
||||||
self.engine.process(diag)
|
self.engine.process(diag)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue