on master help sign in
Propagate errors / possibly fix unranked crash!
4b25980Evan Czaplicki
compiler/src/Type/Unify.hs+6−6
@@ -215,7 +215,7 @@ actuallyUnify context@(Context _ (Descriptor firstContent _ _ _) _ (Descriptor s
215 Error ->
215 Error ->
216 -- If there was an error, just pretend it is okay. This lets us avoid
216 -- If there was an error, just pretend it is okay. This lets us avoid
217 -- "cascading" errors where one problem manifests as multiple message.
217 -- "cascading" errors where one problem manifests as multiple message.
218− return ()
218+ merge context Error
219
219
220
220
221
221
@@ -226,7 +226,7 @@ unifyFlex :: Context -> Content -> Content -> Unify ()
226unifyFlex context content otherContent =
226unifyFlex context content otherContent =
227 case otherContent of
227 case otherContent of
228 Error ->
228 Error ->
229− return ()
229+ merge context Error
230
230
231 -- TODO see if wildcarding makes a noticable perf difference
231 -- TODO see if wildcarding makes a noticable perf difference
232
232
@@ -289,7 +289,7 @@ unifyRigid context maybeSuper content otherContent =
289 mismatch
289 mismatch
290
290
291 Error ->
291 Error ->
292− return ()
292+ merge context Error
293
293
294
294
295
295
@@ -348,7 +348,7 @@ unifyFlexSuper context super content otherContent =
348 subUnify (_first context) realVar
348 subUnify (_first context) realVar
349
349
350 Error ->
350 Error ->
351− return ()
351+ merge context Error
352
352
353
353
354combineRigidSupers :: SuperType -> SuperType -> Bool
354combineRigidSupers :: SuperType -> SuperType -> Bool
@@ -493,7 +493,7 @@ unifyAlias context home name args realVar otherContent =
493 subUnify realVar (_second context)
493 subUnify realVar (_second context)
494
494
495 Error ->
495 Error ->
496− return ()
496+ merge context Error
497
497
498
498
499unifyAliasArgs :: [Variable] -> Context -> [(N.Name,Variable)] -> [(N.Name,Variable)] -> ([Variable] -> () -> IO r) -> ([Variable] -> () -> IO r) -> IO r
499unifyAliasArgs :: [Variable] -> Context -> [(N.Name,Variable)] -> [(N.Name,Variable)] -> ([Variable] -> () -> IO r) -> ([Variable] -> () -> IO r) -> IO r
@@ -597,7 +597,7 @@ unifyStructure context flatType content otherContent =
597 mismatch
597 mismatch
598
598
599 Error ->
599 Error ->
600− return ()
600+ merge context Error
601
601
602
602
603
603