Skip to content

Commit 56d1a9b

Browse files
author
whitequark
committedMay 29, 2015
Shorten the unification error message when too redundant.
1 parent abbc87e commit 56d1a9b

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed
 

Diff for: ‎artiq/py2llvm/typing.py

+14-7
Original file line numberDiff line numberDiff line change
@@ -129,13 +129,20 @@ def _unify(self, typea, typeb, loca, locb):
129129
"expression of type {typeb}",
130130
{"typeb": types.TypePrinter().name(typeb)},
131131
locb)
132-
diag = diagnostic.Diagnostic('fatal',
133-
"cannot unify {typea} with {typeb}: {fraga} is incompatible with {fragb}",
134-
{"typea": types.TypePrinter().name(typea),
135-
"typeb": types.TypePrinter().name(typeb),
136-
"fraga": types.TypePrinter().name(e.typea),
137-
"fragb": types.TypePrinter().name(e.typeb),},
138-
loca, [locb], notes=[note1, note2])
132+
if e.typea.find() == typea.find() and e.typeb.find() == typeb.find():
133+
diag = diagnostic.Diagnostic('fatal',
134+
"cannot unify {typea} with {typeb}",
135+
{"typea": types.TypePrinter().name(typea),
136+
"typeb": types.TypePrinter().name(typeb)},
137+
loca, [locb], notes=[note1, note2])
138+
else: # give more detail
139+
diag = diagnostic.Diagnostic('fatal',
140+
"cannot unify {typea} with {typeb}: {fraga} is incompatible with {fragb}",
141+
{"typea": types.TypePrinter().name(typea),
142+
"typeb": types.TypePrinter().name(typeb),
143+
"fraga": types.TypePrinter().name(e.typea),
144+
"fragb": types.TypePrinter().name(e.typeb),},
145+
loca, [locb], notes=[note1, note2])
139146
self.engine.process(diag)
140147

141148
def visit_FunctionDef(self, node):

0 commit comments

Comments
 (0)
Please sign in to comment.