@@ -4,15 +4,6 @@ open FSharp.Compiler.Service.Tests.Common
44open FSharp.Compiler .Syntax
55open FSharp.Compiler .SyntaxTrivia
66open NUnit.Framework
7-
8- open Xunit
9- // [<Fact>]
10- // let ``Thomas`` () =
11- // let ast = """_.ToString.ToString "b" """ |> getParseResults
12- // let ast = """_.x""" |> getParseResults
13- // let ast = """_.x()""" |> getParseResults
14- // Assert.Fail (ast.ToString())
15-
167[<Test>]
178let ``SynExpr.Do contains the range of the do keyword`` () =
189 let ast = """ let a =
@@ -502,3 +493,29 @@ type CFoo() =
502493 assertRange ( 7 , 4 ) ( 7 , 67 ) m
503494 | _ -> Assert.Fail $" Could not get valid AST, got {ast}"
504495
496+ [<Test>]
497+ let ``SynExpr.DotLambda has correct ranges and trivia`` () =
498+ let ast =
499+ getParseResults """
500+ let e1 : obj [] -> string = _(*test*).(*test*)[5].ToString()
501+ """
502+
503+ match ast with
504+ | ParsedInput.ImplFile( ParsedImplFileInput( contents = [
505+ SynModuleOrNamespace.SynModuleOrNamespace( decls = [
506+ SynModuleDecl.Let( bindings =
507+ [ SynBinding.SynBinding( expr =
508+ SynExpr.Typed( expr =
509+ SynExpr.DotLambda(
510+ SynExpr.App( range = innerRange),
511+ dlRange,
512+ { UnderscoreRange = urange; DotRange = dRange }
513+ )))])
514+ ])
515+ ])) ->
516+ assertRange ( 2 , 28 ) ( 2 , 60 ) dlRange
517+ assertRange ( 2 , 28 ) ( 2 , 29 ) urange
518+ assertRange ( 2 , 37 ) ( 2 , 38 ) dRange
519+ assertRange ( 2 , 46 ) ( 2 , 60 ) innerRange
520+ Assert.Pass()
521+ | _ -> Assert.Fail $" Could not get valid AST, got {ast}"
0 commit comments