- 
                Notifications
    You must be signed in to change notification settings 
- Fork 834
Closed
Labels
Area-Compiler-CheckingType checking, attributes and all aspects of logic checkingType checking, attributes and all aspects of logic checkingBugImpact-Medium(Internal MS Team use only) Describes an issue with moderate impact on existing code.(Internal MS Team use only) Describes an issue with moderate impact on existing code.Ready
Milestone
Description
I found this case where function can't be substituted, in relation to implicit conversion to Func<,> delegate.
Repro steps
open System
let ae = new AggregateException()
    
ae.Handle(fun e ->
    match e with
    | :? OperationCanceledException -> true
    | _ -> false        
    )
ae.Handle(function
    | :? OperationCanceledException -> true
    | _ -> false        
    )
ae.Handle(
    Func<exn,bool>(
        function
        | :? OperationCanceledException -> true
        | _ -> false        
    ))I'd expect those three calls to be the same, but the second one doesn't compile.
Actual behavior
This function takes too many arguments, or is used in a context where a function is not expected
The error seems incorrect in that particular context.
Expected behavior
Not sure, but it would make sense if it could compile the same as (fun x -> match x with ...) in that context.
If this can't be fixed in the language, the error could be detected to point user to the preferred solution.
related: #2907
auduchinok, thinkbeforecoding, varon and WarmWinters
Metadata
Metadata
Assignees
Labels
Area-Compiler-CheckingType checking, attributes and all aspects of logic checkingType checking, attributes and all aspects of logic checkingBugImpact-Medium(Internal MS Team use only) Describes an issue with moderate impact on existing code.(Internal MS Team use only) Describes an issue with moderate impact on existing code.Ready
Type
Projects
Status
Done