Skip to content

Commit cfc4fa6

Browse files
committed
corrected unification of generic type vars
1 parent 992b70b commit cfc4fa6

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

frege/compiler/tc/Util.fr

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -445,12 +445,22 @@ unifyVar ex tv lrtau = do
445445
Right tau -> unified ex ty tau
446446
Nothing -> either unbound unbound lrtau
447447
where
448-
unbound (Meta tv2)
448+
unbound (t2@Meta tv2)
449+
| Just tau1 (Meta tv).bounds, Just tau2 t2.bounds = do
450+
u unified ex tau1 tau2
451+
when (u) do
452+
writeTv tv t2
453+
g <- getST
454+
E.logmsg TRACET (getpos ex) (text ("unifyVar: "
455+
++ show tv.uid ++ " "
456+
++ tv.nice g
457+
++ " :: " ++ show tv.kind))
458+
pure u
449459
| Nothing KI.unifyKind tv.kind tv2.kind = do
450460
g getST
451461
E.error (getpos ex) (text "Kind error in unification of "
452-
</> (text (tv.nicer g) <+> text "::" <+> text (show tv.kind) <+> text " with")
453-
</> (text (tv2.nicer g) <+> text "::" <+> text (show tv2.kind)))
462+
</> (text (tv.nicer g) <+> text "::" <+> text (tv.kind.nicer g) <+> text " with")
463+
</> (text (tv2.nicer g) <+> text "::" <+> text (tv2.kind.nicer g)))
454464
pure false
455465
unbound tau = do -- unifyUnboundVar
456466
g <- getST

0 commit comments

Comments
 (0)