Skip to content

Commit

Permalink
Shorten the unification error message when too redundant.
Browse files Browse the repository at this point in the history
whitequark committed May 29, 2015
1 parent abbc87e commit 56d1a9b
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions artiq/py2llvm/typing.py
Original file line number Diff line number Diff line change
@@ -129,13 +129,20 @@ def _unify(self, typea, typeb, loca, locb):
"expression of type {typeb}",
{"typeb": types.TypePrinter().name(typeb)},
locb)
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])
if e.typea.find() == typea.find() and e.typeb.find() == typeb.find():
diag = diagnostic.Diagnostic('fatal',
"cannot unify {typea} with {typeb}",
{"typea": types.TypePrinter().name(typea),
"typeb": types.TypePrinter().name(typeb)},
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)

def visit_FunctionDef(self, node):

0 comments on commit 56d1a9b

Please sign in to comment.