From 8a65266f14e4841562bc18e91848d6cf7f93752d Mon Sep 17 00:00:00 2001 From: whitequark Date: Thu, 2 Jul 2015 20:06:07 +0300 Subject: [PATCH] Improve builtin call error message. --- artiq/compiler/transforms/inferencer.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/artiq/compiler/transforms/inferencer.py b/artiq/compiler/transforms/inferencer.py index f4aa14d5e..0eac54604 100644 --- a/artiq/compiler/transforms/inferencer.py +++ b/artiq/compiler/transforms/inferencer.py @@ -374,9 +374,13 @@ class Inferencer(algorithm.Visitor): node.func.loc) 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", - "{func} cannot be invoked with these arguments", - {"func": typ.name}, + "{func} cannot be invoked with the arguments ({args})", + {"func": typ.name, "args": ", ".join(args)}, node.func.loc, notes=valid_forms) self.engine.process(diag)