@@ -129,13 +129,20 @@ def _unify(self, typea, typeb, loca, locb):
129
129
"expression of type {typeb}" ,
130
130
{"typeb" : types .TypePrinter ().name (typeb )},
131
131
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 ])
139
146
self .engine .process (diag )
140
147
141
148
def visit_FunctionDef (self , node ):
0 commit comments