Skip to content

Improve errors for incorrect overloads used in custom operations #10167

@cartermp

Description

@cartermp

#9400 exposed an issue:

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    New

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions