Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/Compiler/Checking/CheckExpressions.fs
Original file line number Diff line number Diff line change
Expand Up @@ -9438,7 +9438,8 @@ and GetNewInferenceTypeForMethodArg (cenv: cenv) env tpenv x =
GetNewInferenceTypeForMethodArg cenv env tpenv a
| SynExpr.AddressOf (true, a, _, m) ->
mkByrefTyWithInference g (GetNewInferenceTypeForMethodArg cenv env tpenv a) (NewByRefKindInferenceType g m)
| SynExpr.Lambda (body = a) ->
| SynExpr.Lambda (body = a)
| SynExpr.DotLambda (expr = a) ->
mkFunTy g (NewInferenceType g) (GetNewInferenceTypeForMethodArg cenv env tpenv a)
| SynExpr.Quote (_, raw, a, _, _) ->
if raw then mkRawQuotedExprTy g
Expand Down
2 changes: 1 addition & 1 deletion src/Compiler/Checking/MethodCalls.fs
Original file line number Diff line number Diff line change
Expand Up @@ -841,7 +841,7 @@ let InferLambdaArgsForLambdaPropagation origRhsExpr =
match e with
| SynExpr.Lambda (body = rest) -> 1 + loop rest
| SynExpr.MatchLambda _ -> 1
| SynExpr.DotLambda _ -> 1
| SynExpr.DotLambda (expr = body) -> 1 + loop body
| _ -> 0
loop origRhsExpr

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,4 +224,20 @@ let c : string = let _ = "test" in "asd" |> _.ToString()
|> withLangVersion80
|> typecheck
|> shouldFail
|> withSingleDiagnostic (Warning 3570, Line 3, Col 43, Line 3, Col 44, "The meaning of _ is ambiguous here. It cannot be used for a discarded variable and a function shorthand in the same scope.")
|> withSingleDiagnostic (Warning 3570, Line 3, Col 43, Line 3, Col 44, "The meaning of _ is ambiguous here. It cannot be used for a discarded variable and a function shorthand in the same scope.")

[<Fact>]
let ``DotLambda selector converted to Func when used in LINQ`` () =
FSharp """open System.Linq
let _ = [""; ""; ""].Select(fun x -> x.Length)
let _ = [""; ""; ""].Select(_.Length)
let _ = [""; ""; ""].Select _.Length

let asQ = [""; ""; ""].AsQueryable()
let _ = asQ.Select(fun x -> x.Length)
let _ = asQ.Select(_.Length)
let _ = asQ.Select _.Length
"""
|> withLangVersion80
|> typecheck
|> shouldSucceed