git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Improve some error messages #289 #290
eb505edPhil Freeman
RELEASE-0.5.md+1
@@ -37,6 +37,7 @@
37- Let bindings can now define functions with binders (paf31)
37- Let bindings can now define functions with binders (paf31)
38- Case statements and functions which do not pattern match on their arguments now generate smaller code (paf31)
38- Case statements and functions which do not pattern match on their arguments now generate smaller code (paf31)
39- Imported type class instances are now exported (paf31)
39- Imported type class instances are now exported (paf31)
40+- Some error messages were improved (paf31)
40
41
41### Bug Fixes
42### Bug Fixes
42
43
src/Language/PureScript/TypeChecker/Types.hs+4−1
@@ -118,6 +118,9 @@ unifyTypes t1 t2 = rethrow (\e -> "Error unifying type " ++ prettyPrintType t1 +
118 unifyTypes' r1 r2@RCons{} = unifyRows r1 r2
118 unifyTypes' r1 r2@RCons{} = unifyRows r1 r2
119 unifyTypes' r1@REmpty r2 = unifyRows r1 r2
119 unifyTypes' r1@REmpty r2 = unifyRows r1 r2
120 unifyTypes' r1 r2@REmpty = unifyRows r1 r2
120 unifyTypes' r1 r2@REmpty = unifyRows r1 r2
121+ unifyTypes' t@(ConstrainedType _ _) _ = throwError $ "Attempted to unify a constrained type " ++ prettyPrintType t ++
122+ " with another type."
123+ unifyTypes' t3 t4@(ConstrainedType _ _) = unifyTypes' t4 t3
121 unifyTypes' t3 t4 = throwError $ "Cannot unify " ++ prettyPrintType t3 ++ " with " ++ prettyPrintType t4 ++ "."
124 unifyTypes' t3 t4 = throwError $ "Cannot unify " ++ prettyPrintType t3 ++ " with " ++ prettyPrintType t4 ++ "."
122
125
123-- |
126-- |
@@ -321,7 +324,7 @@ escapeCheck value ty = do
321 let allUnknowns = findAllTypes value
324 let allUnknowns = findAllTypes value
322 forM_ allUnknowns $ \t -> do
325 forM_ allUnknowns $ \t -> do
323 let unsolvedUnknowns = nub . unknowns $ subst $? t
326 let unsolvedUnknowns = nub . unknowns $ subst $? t
324− guardWith "Escape check fails" $ null $ unsolvedUnknowns \\ visibleUnknowns
327+ guardWith "An unsolved type variable disappeared during type checking." $ null $ unsolvedUnknowns \\ visibleUnknowns
325
328
326-- |
329-- |
327-- Find all type annotations occuring inside a value
330-- Find all type annotations occuring inside a value