Skip to content

Commit

Permalink
Fix #1577, fix #1130
Browse files Browse the repository at this point in the history
  • Loading branch information
paf31 committed Oct 29, 2015
1 parent a70e397 commit c059120
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
13 changes: 9 additions & 4 deletions src/Language/PureScript/Errors.hs
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ data ErrorMessageHint
| ErrorCheckingAccessor Expr String
| ErrorCheckingType Expr Type
| ErrorCheckingKind Type
| ErrorCheckingGuard
| ErrorInferringType Expr
| ErrorInApplication Expr Type Expr
| ErrorInDataConstructor ProperName
Expand Down Expand Up @@ -530,15 +531,15 @@ prettyPrintSingleError full level e = prettyPrintErrorMessage <$> onTypesInError
, indent $ prettyPrintValue expr
]) binding
renderSimpleErrorMessage (TypesDoNotUnify t1 t2)
= paras [ line "Could not match expected type"
= paras [ line "Could not match type"
, indent $ typeAsBox t1
, line "with actual type"
, line "with type"
, indent $ typeAsBox t2
]
renderSimpleErrorMessage (KindsDoNotUnify k1 k2) =
paras [ line "Could not match expected kind"
paras [ line "Could not match kind"
, indent $ line $ prettyPrintKind k1
, line "with actual kind"
, line "with kind"
, indent $ line $ prettyPrintKind k2
]
renderSimpleErrorMessage (ConstrainedTypeUnified t1 t2) =
Expand Down Expand Up @@ -730,6 +731,10 @@ prettyPrintSingleError full level e = prettyPrintErrorMessage <$> onTypesInError
, typeAsBox ty
]
]
renderHint ErrorCheckingGuard detail =
paras [ detail
, line "while checking the type of a guard clause"
]
renderHint (ErrorInferringType expr) detail =
paras [ detail
, Box.hsep 1 Box.top [ line "while inferring the type of"
Expand Down
2 changes: 1 addition & 1 deletion src/Language/PureScript/TypeChecker/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ checkBinders nvals ret (CaseAlternative binders result : bs) = do
case result of
Left gs -> do
gs' <- forM gs $ \(grd, val) -> do
grd' <- check grd tyBoolean
grd' <- rethrow (addHint ErrorCheckingGuard) $ check grd tyBoolean
val' <- TypedValue True <$> check val ret <*> pure ret
return (grd', val')
return $ Left gs'
Expand Down

0 comments on commit c059120

Please sign in to comment.