dotnet / dotnet/fsharp

Improve errors for incorrect overloads used in custom operations

Open
#10,167 1 comment 0 reactions 0 assignees View on GitHub
Area-Diagnostics Feature Request
Dominant language
F#
Stars
4.3k
Forks
876
Avg merge
4d 11h
Merged PRs (30d)
131

Description

https://github.com/dotnet/fsharp/pull/9400 exposed an issue:

```fsharp
let q2 =
query {
for d in [1..10] do
where (d > 3)
select d
}
```

This code is incorrect. It used to give only 1 confusing error message:

`error FS3099: 'where' is used with an incorrect number of arguments. This is a custom operation in this query or computation expression. Expected 1 argument(s), but given 3.`

It now gives 3 confusing error messages:

`error FS3095: 'select' is not used correctly. This is a custom operation in this query or computation expression.`

`error FS0039: The value or constructor 'd' is not defined.`

`error FS0501: The member or object constructor 'Where' takes 2 argument(s) but is here given 4. The required signature is 'member Linq.QueryBuilder.Where : source:Linq.QuerySource<'T,'Q> * predicate:('T -> bool) -> Linq.QuerySource<'T,'Q>'.`

We should see what we can do about this. The previous state of the world was never good. But it is worse now.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.