mirror of
https://github.com/unisonweb/unison.git
synced 2024-10-05 06:07:21 +03:00
Update parser-typechecker/src/Unison/PrintError.hs
Co-authored-by: Paul Chiusano <paul.chiusano@gmail.com>
This commit is contained in:
parent
3ebf9f137e
commit
01ad6fc9b4
@ -611,19 +611,16 @@ renderTypeError e env src curPath = case e of
|
||||
(annotatedAsErrorSite src loc)
|
||||
UnknownTerm {..}
|
||||
| Var.typeOf unknownTermV == Var.MissingResult ->
|
||||
mconcat
|
||||
[ "The last statement of a block must be an expression, ",
|
||||
"but this is a definition:\n\n",
|
||||
annotatedAsErrorSite src termSite,
|
||||
"\nI don't know what the result of this block should be.\n",
|
||||
"Did you forget to add an expression at the end of the block?\n",
|
||||
case expectedType of
|
||||
Type.Var' (TypeVar.Existential {}) -> "I don't know what type it should be either."
|
||||
_ ->
|
||||
"It should be of type "
|
||||
<> style Type1 (renderType' env expectedType)
|
||||
<> "."
|
||||
]
|
||||
Pr.lines [
|
||||
Pr.wrap "The last element of a block must be an expression, but this is a definition:",
|
||||
"",
|
||||
annotatedAsErrorSite src termSite,
|
||||
Pr.wrap $ "Try adding an expression at the end of the block." <> msg
|
||||
]
|
||||
where
|
||||
msg = case expectedType of
|
||||
Type.Var' (TypeVar.Existential {}) -> mempty
|
||||
_ -> Pr.wrap $ "It should be of type " <> Pr.group (style Type1 (renderType' env expectedType) <> ".")
|
||||
UnknownTerm {..} ->
|
||||
let (correct, wrongTypes, wrongNames) =
|
||||
foldr sep id suggestions ([], [], [])
|
||||
|
Loading…
Reference in New Issue
Block a user