diff --git a/src/fsharp/pars.fsy b/src/fsharp/pars.fsy index b03987165bb..3a43237d7e4 100644 --- a/src/fsharp/pars.fsy +++ b/src/fsharp/pars.fsy @@ -3834,7 +3834,7 @@ parenExpr: | LPAREN parenExprBody ends_other_than_rparen_coming_soon_or_recover { if not $3 then reportParseErrorAt (rhs parseState 1) (FSComp.SR.parsUnmatchedParen()) - let lhsm = unionRangeWithPos (rhs parseState 1) (rhs parseState 3).Start + let lhsm = unionRangeWithPos (rhs parseState 1) (rhs parseState 2).End SynExpr.Paren(exprFromParseError ($2 lhsm), rhs parseState 1, None, lhsm) } | LPAREN error rparen diff --git a/src/fsharp/service/ServiceParamInfoLocations.fs b/src/fsharp/service/ServiceParamInfoLocations.fs index 7295e2e08e6..685471f18fb 100755 --- a/src/fsharp/service/ServiceParamInfoLocations.fs +++ b/src/fsharp/service/ServiceParamInfoLocations.fs @@ -100,7 +100,7 @@ module internal NoteworthyParamInfoLocationsImpl = let inner = traverseSynExpr synExpr match inner with | None -> - if AstTraversal.rangeContainsPosEdgesExclusive parenRange pos then + if AstTraversal.rangeContainsPosLeftEdgeExclusiveAndRightEdgeInclusive parenRange pos then let commasAndCloseParen = ((synExprList, commaRanges@[parenRange]) ||> List.map2 (fun e c -> c.End, getNamedParamName e)) let r = Found (parenRange.Start, commasAndCloseParen, rpRangeOpt.IsSome) r, None diff --git a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.ParameterInfo.fs b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.ParameterInfo.fs index 058fe998a13..58b58c6cc5d 100644 --- a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.ParameterInfo.fs +++ b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.ParameterInfo.fs @@ -1278,85 +1278,6 @@ We really need to rewrite some code paths here to use the real parse tree rather arr.[1] <- ^System.Int32.Parse^(^$ namespace^ Other""") - [] - member public this.``LocationOfParams.UnmatchedParens.Bug91609.Ok``() = - this.TestParameterInfoLocationOfParams(""" - let arr = Array.create 4 1 - arr.[1] <- ^System.Int32.Parse^(^$ - let squares3 = () - ^type Expr = class end - let rec Evaluate (env:Map) exp = ()""") - - [] - member public this.``LocationOfParams.UnmatchedParens.Bug91609.AlsoOk``() = - this.TestParameterInfoLocationOfParams(""" - let arr = Array.create 4 1 - arr.[1] <- System.Int32.Parse(int(int(int(^int^(^$ - let squares3 = () - ^type Expr = class end - let rec Evaluate (env:Map) exp = ()""") - - [] - member public this.``LocationOfParams.UnmatchedParens.Bug91609.NowGood``() = - // This case originally failed, by Design, as there is a finite limit to how many unmatched parens we can handle before the parser gives up and fails catastrophically. - // However now that we recover from more kinds of tokens, e.g. OBLOCKEND, we can easily go much much deeper, and so this case (and most practical cases) now succeeds. - this.TestParameterInfoLocationOfParams(""" - let arr = Array.create 4 1 - arr.[1] <- System.Int32.Parse(int(int(int(int(int(int(^int^(^$ - let squares3 = () - ^type Expr = class end - let rec Evaluate (env:Map) exp = ()""") - - [] - member public this.``LocationOfParams.UnmatchedParens.Bug150492.Case1``() = - this.TestParameterInfoLocationOfParams(""" - module Inner = - ^System.Console.Write^(^$ - let y = 4 - ^type Foo() = inherit obj() - [] - do () """) - - [] - member public this.``LocationOfParams.UnmatchedParens.Bug150492.Case2``() = - // like previous test, but with explicit begin-end at module - this.TestParameterInfoLocationOfParams(""" - module Inner = begin - ^System.Console.Write^(^$ - let y = 4 - ^end - type Foo() = inherit obj() - [] - do () """) - - [] - member public this.``LocationOfParams.UnmatchedParens.Bug150492.Case1.WhenExtraModule``() = - this.TestParameterInfoLocationOfParams(""" - module Program - let xxx = 42 - type FooBaz() = class end - module Inner = - ^System.Console.Write^(^$ - let y = 4 - ^type Foo() = inherit obj() - [] - do () """) - - [] - member public this.``LocationOfParams.UnmatchedParens.Bug150492.Case2.OkWhenExtraModule``() = - // like previous test, but with explicit begin-end at module - this.TestParameterInfoLocationOfParams(""" - module Program - let xxx = 42 - type FooBaz() = class end - module Inner = begin - ^System.Console.Write^(^$ - let y = 4 - ^end - type Foo() = inherit obj() - [] - do () """) - [] member this.``LocationOfParams.InheritsClause.Bug192134``() = this.TestParameterInfoLocationOfParams(""" @@ -1396,30 +1317,6 @@ We really need to rewrite some code paths here to use the real parse tree rather while true do ($) """) - [] - member public this.``LocationOfParams.UnmatchedParensBeforeModuleKeyword.Bug245850.Case1a``() = - this.TestParameterInfoLocationOfParams(""" - module Repro = - for a in ^System.Int16.TryParse^(^$ - ^module AA = - let x = 10 """) - - [] - member public this.``LocationOfParams.UnmatchedParensBeforeModuleKeyword.Bug245850.Case1b``() = - this.TestParameterInfoLocationOfParams(""" - module Repro = - for a in ^System.Int16.TryParse^(^"4$2" - ^module AA = - let x = 10 """) - - [] - member public this.``LocationOfParams.UnmatchedParensBeforeModuleKeyword.Bug245850.Case1c``() = - this.TestParameterInfoLocationOfParams(""" - module Repro = - for a in ^System.Int16.TryParse^(^"4$2",^ - ^module AA = - let x = 10 """) - [] member public this.``LocationOfParams.UnmatchedParensBeforeModuleKeyword.Bug245850.Case2a``() = this.TestParameterInfoLocationOfParams(""" @@ -1428,78 +1325,6 @@ We really need to rewrite some code paths here to use the real parse tree rather ^module AA = let x = 10 """) - [] - member public this.``LocationOfParams.UnmatchedParensBeforeModuleKeyword.Bug245850.Case2b``() = - this.TestParameterInfoLocationOfParams(""" - module Repro = - query { for a in ^System.Int16.TryParse^(^"4$2" - ^module AA = - let x = 10 """) - - [] - member public this.``LocationOfParams.UnmatchedParensBeforeModuleKeyword.Bug245850.Case2c``() = - this.TestParameterInfoLocationOfParams(""" - module Repro = - query { for a in ^System.Int16.TryParse^(^"4$2",^ - ^module AA = - let x = 10 """) - - [] - [] - member public this.``LocationOfParams.QueryCustomOperation.Bug222128``() = - this.TestParameterInfoLocationOfParams(""" - type T() = - member x.GetCollection() = [1;2;3;4] - let q2 = query { - for e in T().GetCollection() do - where (e > 250) - ^skip^(^$ - ^} """) - - [] - member public this.``LocationOfParams.QueryCurlies.Bug204150.Case1``() = - this.TestParameterInfoLocationOfParams(""" - type T() = - member x.GetCollection() = [1;2;3;4] - open System.Linq - let q6 = - query { - for E in ^T().GetCollection().Aggregate^(^$ - ^} """) - - [] - member public this.``LocationOfParams.QueryCurlies.Bug204150.Case2``() = - this.TestParameterInfoLocationOfParams(""" - type T() = - member x.GetCollection() = [1;2;3;4] - open System.Linq - let q6 = - query { - for E in ^T().GetCollection().Aggregate^(^42$ - ^} """) - - [] - member public this.``LocationOfParams.QueryCurlies.Bug204150.Case3``() = - this.TestParameterInfoLocationOfParams(""" - type T() = - member x.GetCollection() = [1;2;3;4] - open System.Linq - let q6 = - query { - for E in ^T().GetCollection().Aggregate^(^42,^$ - ^} """) - - [] - member public this.``LocationOfParams.QueryCurlies.Bug204150.Case4``() = - this.TestParameterInfoLocationOfParams(""" - type T() = - member x.GetCollection() = [1;2;3;4] - open System.Linq - let q6 = - query { - for E in ^T().GetCollection().Aggregate^(^42,^ 43$ - ^} """) - (* Tests for type provider static argument parameterinfos ------------------------------------------ *) member public this.TestParameterInfoLocationOfParamsWithVariousSurroundingContexts (testLine:string, ?markAtEnd, ?additionalReferenceAssemblies) = diff --git a/vsintegration/tests/UnitTests/SignatureHelpProviderTests.fs b/vsintegration/tests/UnitTests/SignatureHelpProviderTests.fs index b26f786fabb..ae95db5397f 100644 --- a/vsintegration/tests/UnitTests/SignatureHelpProviderTests.fs +++ b/vsintegration/tests/UnitTests/SignatureHelpProviderTests.fs @@ -66,7 +66,7 @@ System.Console.WriteLine(format="Hello, {0}",arg0="World") ("arg0", Some ("[7..64)", 1, 2, Some "arg0")); ("arg0=", Some ("[7..64)", 1, 2, Some "arg0")); ("World", Some ("[7..64)", 1, 2, Some "arg0")); - (")", None)]); + (")", Some("[7..64)", 0, 2, Some "format"))]); ( """ //2 open System @@ -127,6 +127,8 @@ type foo5 = N1.T //Test case 5 ( """let _ = System.DateTime(""", [("let _ = System.DateTime(", Some ("[8..24)", 0, 0, None)) ]) + ( """let _ = System.DateTime(1L,""", + [("let _ = System.DateTime(1L,", Some ("[8..27)", 1, 2, None )) ]) ] let sb = StringBuilder()