Improve error reporting: do-keyword missing in a query
- Dominant language
- F#
- Stars
- 4.3k
- Forks
- 876
- Avg merge
- 4d 11h
- Merged PRs (30d)
- 131
Description
# What
The following code results in an error message which could be improved upon: -
```fsharp
let x =
query {
for i in [|1;2;3|]
where (i<2)
select i
}
```
The error is: -
`error FS0010: Unexpected identifier in expression. Expected '->' or other token.`
# Why
The for-in-do-syntax (`for i in [|1;2;3|] do`) differs from other languages, and `do` is kind of non-intuitive here, so it is easy to forget. Also the error message is very cryptic and underlines the next statement (here `where`) so the developer tries to seek the problem from wrong place.
# How
A better error might be something that would mention what is the actual problem here, that you need the do-keyword.
Related to #1103
Contributor guide
Assessment
This issue has not been assessed yet.