match expressions missing inside task ce confusing error
is this related to the same? this is annoying with match expressions inside task ce...
in my case the reason was just the missing _ in:
| _ ->
for all cases, so I think the error is misleading, should suggest missing match case instead.
i didn't see it right away because the compiler error was not useful...
Originally posted by @jkone27 in https://github.com/dotnet/fsharp/issues/4653#issuecomment-1662393389
Interestingly enough, I believe this only happens when there is no space between | and ->.
Without the space, the |-> is considered to be an operator.
Perhaps this is more something an IDE could point out, that you probably meant | _ ->.
I'm not sure though.
here is a small test fsx to give it a go
type SomeUnion =
| First
| Second
| Third
let testMatch su =
match su with
| First -> "hey"
|-> "hello" // should maybe hint | _ -> or match case is given (?)
let testMatchTwo su =
task {
let z = Some(1)
match z with
|Some(n) ->
return ""
|-> // should maybe hint | _ -> or match case is given (?) error disappears here
let! x = Task.Delay(200)
return "hello" // construct may only be used inside a CE (?) no mention of |->
}