Skip to content

Commit 52b104d

Browse files
committed
fix expressions
1 parent 6107e05 commit 52b104d

File tree

3 files changed

+50
-4
lines changed

3 files changed

+50
-4
lines changed

src/fsharp/vs/Exprs.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ module FSharpExprConvert =
429429
let contf2 =
430430
match laterArgs with
431431
| [] -> contf
432-
| _ -> (fun subCallR -> (subCallR, laterArgs) ||> List.fold (fun fR arg -> E.Application (Mk2 cenv arg fR,[],[ConvExpr cenv env arg])))
432+
| _ -> (fun subCallR -> (subCallR, laterArgs) ||> List.fold (fun fR arg -> E.Application (Mk2 cenv arg fR,[],[ConvExpr cenv env arg])) |> contf)
433433

434434
if isMember then
435435
let callArgs = (objArgs::untupledCurriedArgs) |> List.concat

src/fsharp/vs/Symbols.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ type FSharpSymbol(cenv:cenv, item: (unit -> Item), access: (FSharpSymbol -> CcuT
168168
member x.FullName = ItemDescriptionsImpl.FullNameOfItem cenv.g x.Item
169169

170170
member x.DeclarationLocation = ItemDescriptionsImpl.rangeOfItem cenv.g None x.Item
171-
171+
172172
member x.ImplementationLocation = ItemDescriptionsImpl.rangeOfItem cenv.g (Some(false)) x.Item
173173

174174
member x.SignatureLocation = ItemDescriptionsImpl.rangeOfItem cenv.g (Some(true)) x.Item

tests/service/ExprTests.fs

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,37 @@ let testFunctionThatUsesPatternMatchingOnOptions2(x) =
352352
353353
let testFunctionThatUsesConditionalOnOptions2(x: int option) =
354354
if x.IsSome then 1 else 2
355+
356+
let f x y = x+y
357+
let g = f 1
358+
let h = (g 2) + 3
359+
360+
type TestFuncProp() =
361+
member this.Id = fun x -> x
362+
363+
let wrong = TestFuncProp().Id 0 = 0
364+
365+
let start name =
366+
name, "1"
367+
368+
let last (name, values) =
369+
printf "Last: Name='%s', Values='%s'" name values
370+
371+
let test7() =
372+
start "Test" |> last
373+
374+
let rec badLoop : (int -> int) =
375+
() // so that it is a function value
376+
fun x -> badLoop (x + 1)
377+
378+
module LetLambda =
379+
let f =
380+
() // so that it is a function value
381+
fun a b -> a + b
382+
383+
let letLambdaRes = [ 1, 2 ] |> List.map (fun (a, b) -> LetLambda.f a b)
384+
385+
355386
"""
356387
File.WriteAllText(fileName1, fileSource1)
357388

@@ -376,9 +407,10 @@ let bool2 = false
376407
let ``Test Declarations project1`` () =
377408
let wholeProjectResults = checker.ParseAndCheckProject(Project1.options) |> Async.RunSynchronously
378409

379-
wholeProjectResults.Errors.Length |> shouldEqual 2 // recursive value warning
410+
wholeProjectResults.Errors.Length |> shouldEqual 3 // recursive value warning
380411
wholeProjectResults.Errors.[0].Severity |> shouldEqual FSharpErrorSeverity.Warning
381412
wholeProjectResults.Errors.[1].Severity |> shouldEqual FSharpErrorSeverity.Warning
413+
wholeProjectResults.Errors.[2].Severity |> shouldEqual FSharpErrorSeverity.Warning
382414

383415
wholeProjectResults.AssemblyContents.ImplementationFiles.Length |> shouldEqual 2
384416
let file1 = wholeProjectResults.AssemblyContents.ImplementationFiles.[0]
@@ -454,7 +486,21 @@ let ``Test Declarations project1`` () =
454486
"let testFunctionThatUsesPatternMatchingOnLists(x) = match (if x.Isop_ColonColon then (if x.Tail.Isop_ColonColon then (if x.Tail.Tail.Isop_Nil then $2 else $3) else $1) else $0) targets ... @ (188,10--188,11)";
455487
"let testFunctionThatUsesPatternMatchingOnOptions(x) = match (if x.IsSome then $1 else $0) targets ... @ (195,10--195,11)";
456488
"let testFunctionThatUsesPatternMatchingOnOptions2(x) = match (if x.IsSome then $1 else $0) targets ... @ (200,10--200,11)";
457-
"let testFunctionThatUsesConditionalOnOptions2(x) = (if x.get_IsSome() () then 1 else 2) @ (205,4--205,29)"]
489+
"let testFunctionThatUsesConditionalOnOptions2(x) = (if x.get_IsSome() () then 1 else 2) @ (205,4--205,29)"
490+
"let f(x) (y) = Operators.op_Addition<Microsoft.FSharp.Core.int,Microsoft.FSharp.Core.int,Microsoft.FSharp.Core.int> (x,y) @ (207,12--207,15)";
491+
"let g = let x: Microsoft.FSharp.Core.int = 1 in fun y -> M.f (x,y) @ (208,8--208,11)";
492+
"let h = Operators.op_Addition<Microsoft.FSharp.Core.int,Microsoft.FSharp.Core.int,Microsoft.FSharp.Core.int> (M.g () 2,3) @ (209,8--209,17)";
493+
"type TestFuncProp";
494+
"member .ctor(unitVar0) = (Object..ctor (); ()) @ (211,5--211,17)";
495+
"member get_Id(this) (unitVar1) = fun x -> x @ (212,21--212,31)";
496+
"let wrong = Operators.op_Equality<Microsoft.FSharp.Core.int> (new TestFuncProp(()).get_Id(()) 0,0) @ (214,12--214,35)";
497+
"let start(name) = (name,"1") @ (217,4--217,13)";
498+
"let last(name,values) = let clo1: Microsoft.FSharp.Core.string -> Microsoft.FSharp.Core.string -> Microsoft.FSharp.Core.unit = ExtraTopLevelOperators.PrintFormat<Microsoft.FSharp.Core.string -> Microsoft.FSharp.Core.string -> Microsoft.FSharp.Core.unit> (new PrintfFormat`5("Last: Name='%s', Values='%s'") :> Microsoft.FSharp.Core.Printf.TextWriterFormat<(Microsoft.FSharp.Core.string -> Microsoft.FSharp.Core.string -> Microsoft.FSharp.Core.unit)>) in fun arg10 -> let clo2: Microsoft.FSharp.Core.string -> Microsoft.FSharp.Core.unit = clo1 arg10 in fun arg20 -> clo2 arg20 name values @ (220,4--220,53)";
499+
"let test7(unitVar0) = Operators.op_PipeRight<Microsoft.FSharp.Core.string * Microsoft.FSharp.Core.string,Microsoft.FSharp.Core.unit> (M.start<Microsoft.FSharp.Core.string> ("Test"),last) @ (223,4--223,24)";
500+
"let badLoop = badLoop@225.Force<Microsoft.FSharp.Core.int -> Microsoft.FSharp.Core.int>(()) @ (225,8--225,15)";
501+
"type LetLambda";
502+
"let f = ((); fun a -> fun b -> Operators.op_Addition<Microsoft.FSharp.Core.int,Microsoft.FSharp.Core.int,Microsoft.FSharp.Core.int> (a,b)) @ (231,8--232,24)";
503+
"let letLambdaRes = Operators.op_PipeRight<(Microsoft.FSharp.Core.int * Microsoft.FSharp.Core.int) Microsoft.FSharp.Collections.list,Microsoft.FSharp.Core.int Microsoft.FSharp.Collections.list> (Cons((1,2),Empty()),let mapping: Microsoft.FSharp.Core.int * Microsoft.FSharp.Core.int -> Microsoft.FSharp.Core.int = fun tupledArg -> let a: Microsoft.FSharp.Core.int = tupledArg.Item0 in let b: Microsoft.FSharp.Core.int = tupledArg.Item1 in (LetLambda.f () a) b in fun list -> ListModule.Map<Microsoft.FSharp.Core.int * Microsoft.FSharp.Core.int,Microsoft.FSharp.Core.int> (mapping,list)) @ (234,19--234,71)"]
458504
()
459505

460506
//---------------------------------------------------------------------------------------------------------

0 commit comments

Comments
 (0)