forked from M-Labs/artiq
1
0
Fork 0

Shorten the unification error message when too redundant.

This commit is contained in:
whitequark 2015-05-29 10:01:22 +03:00
parent abbc87e981
commit 56d1a9bc57
1 changed files with 14 additions and 7 deletions

View File

@ -129,13 +129,20 @@ class Inferencer(algorithm.Transformer):
"expression of type {typeb}", "expression of type {typeb}",
{"typeb": types.TypePrinter().name(typeb)}, {"typeb": types.TypePrinter().name(typeb)},
locb) locb)
diag = diagnostic.Diagnostic('fatal', if e.typea.find() == typea.find() and e.typeb.find() == typeb.find():
"cannot unify {typea} with {typeb}: {fraga} is incompatible with {fragb}", diag = diagnostic.Diagnostic('fatal',
{"typea": types.TypePrinter().name(typea), "cannot unify {typea} with {typeb}",
"typeb": types.TypePrinter().name(typeb), {"typea": types.TypePrinter().name(typea),
"fraga": types.TypePrinter().name(e.typea), "typeb": types.TypePrinter().name(typeb)},
"fragb": types.TypePrinter().name(e.typeb),}, loca, [locb], notes=[note1, note2])
loca, [locb], notes=[note1, note2]) else: # give more detail
diag = diagnostic.Diagnostic('fatal',
"cannot unify {typea} with {typeb}: {fraga} is incompatible with {fragb}",
{"typea": types.TypePrinter().name(typea),
"typeb": types.TypePrinter().name(typeb),
"fraga": types.TypePrinter().name(e.typea),
"fragb": types.TypePrinter().name(e.typeb),},
loca, [locb], notes=[note1, note2])
self.engine.process(diag) self.engine.process(diag)
def visit_FunctionDef(self, node): def visit_FunctionDef(self, node):