-
Notifications
You must be signed in to change notification settings - Fork 291
Closed
Description
Normally if you have a line that returns something other than () in a block you get a nice warning about it, e.g.
test =
1
2
I found a value of type: Nat
where I expected to find: Unit
14 | 1
15 | 2
from right here:
14 | 1
Hint: Actions within a block must have type Unit.
Use _ = <expr> to ignore a result.
However, if there's a destructuring bind in the block, the error message mentions a match/with when there isn't one:
type UserId = UserId Nat
testTerm = do
(UserId x) = UserId 88
"testing"
printLine "hello"
printLine "hi"
x
Each case of a match / with expression need to have the same type.
Here, one is: Unit
and another is: Text
6 | "testing"
7 | printLine "hello"
8 | printLine "hi"
9 | x
from these spots, respectively:
6 | "testing"
Also, all of the block is treated as part of the error (lines 6-9) when really the error is just line 6, so the LSP erroneously highlights the entire block.
kubukoz