@@ -241,10 +241,20 @@ unifyRigid context maybeSuper maybeName otherContent =
241 return ()
241 return ()
243 Var Flex otherMaybeSuper _ ->
243 Var Flex otherMaybeSuper _ ->
244− if maybeSuper == otherMaybeSuper then
244+ case (maybeSuper, otherMaybeSuper) of
245− merge context (Var Rigid maybeSuper maybeName)
246+ merge context (Var Rigid maybeSuper maybeName)
248+ (Nothing, Just _) ->
249+ mismatch context (Just (badRigid maybeName))
251+ (Just super, Just otherSuper) ->
252+ case combineSupers super otherSuper of
253+ Right newSuper | newSuper == otherSuper ->
254+ merge context otherContent
247− mismatch context (Just (badRigid maybeName))
257+ mismatch context (Just (badRigid maybeName))
249 Var Rigid _ otherMaybeName ->
259 Var Rigid _ otherMaybeName ->
250 mismatch context $ Just $
260 mismatch context $ Just $
@@ -279,10 +289,13 @@ unifySuper context super otherContent =
279 mismatch context (Just (doubleBad (errorSuper super) (Error.Rigid maybeName)))
289 mismatch context (Just (doubleBad (errorSuper super) (Error.Rigid maybeName)))
281 Var Rigid (Just otherSuper) maybeName ->
291 Var Rigid (Just otherSuper) maybeName ->
282− if super == otherSuper then
292+ case combineSupers super otherSuper of
293+ Right newSuper | newSuper == super ->
283− merge context otherContent
294+ merge context otherContent
297+ mismatch context $ Just $
285− mismatch context (Just (doubleBad (errorSuper super) (Error.Rigid maybeName)))
298+ doubleBad (errorSuper super) (Error.Rigid maybeName)
287 Var Flex Nothing _ ->
300 Var Flex Nothing _ ->
288 merge context (Var Flex (Just super) Nothing)
301 merge context (Var Flex (Just super) Nothing)