From ef9e61525720c4e80f4476727ee82212e2d3106f Mon Sep 17 00:00:00 2001 From: Edgar Gonzalez Date: Sun, 8 Sep 2024 16:32:00 +0100 Subject: [PATCH 1/7] Better `CE` error reporting when using `use!` with `and!` --- .../CheckComputationExpressions.fs | 10 +++++-- .../Language/ComputationExpressionTests.fs | 30 +++++++++++++++++++ 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/src/Compiler/Checking/Expressions/CheckComputationExpressions.fs b/src/Compiler/Checking/Expressions/CheckComputationExpressions.fs index a5c533d8bfd..5d92f502966 100644 --- a/src/Compiler/Checking/Expressions/CheckComputationExpressions.fs +++ b/src/Compiler/Checking/Expressions/CheckComputationExpressions.fs @@ -1987,12 +1987,16 @@ let rec TryTranslateComputationExpression Some(translatedCtxt bindExpr) - // 'use! pat = e1 ... in e2' where 'pat' is not a simple name --> error - | SynExpr.LetOrUseBang(isUse = true; pat = pat; andBangs = andBangs) -> + // 'use! pat = e1 ... in e2' where 'pat' is not a simple name -> error + | SynExpr.LetOrUseBang(bindDebugPoint = spBind; isUse = true; pat = pat; andBangs = andBangs) -> if isNil andBangs then error (Error(FSComp.SR.tcInvalidUseBangBinding (), pat.Range)) else - error (Error(FSComp.SR.tcInvalidUseBangBindingNoAndBangs (), comp.Range)) + let mBind = + match spBind with + | DebugPointAtBinding.Yes m -> m + | _ -> pat.Range + error (Error(FSComp.SR.tcInvalidUseBangBindingNoAndBangs (), mBind)) // 'let! pat1 = expr1 and! pat2 = expr2 in ...' --> // build.BindN(expr1, expr2, ...) diff --git a/tests/FSharp.Compiler.ComponentTests/Language/ComputationExpressionTests.fs b/tests/FSharp.Compiler.ComponentTests/Language/ComputationExpressionTests.fs index af588b04975..90ec325424c 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/ComputationExpressionTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/ComputationExpressionTests.fs @@ -152,3 +152,33 @@ let x = A.Prop { return 0 } |> compile |> shouldSucceed |> ignore + + [] + let ``use! may not be combined with and!`` () = + Fsx """ +module Result = + let zip x1 x2 = + match x1,x2 with + | Ok x1res, Ok x2res -> Ok (x1res, x2res) + | Error e, _ -> Error e + | _, Error e -> Error e + +type ResultBuilder() = + member _.MergeSources(t1: Result<'T,'U>, t2: Result<'T1,'U>) = Result.zip t1 t2 + member _.BindReturn(x: Result<'T,'U>, f) = Result.map f x + +let result = ResultBuilder() + +let run r2 r3 = + result { + use! b = r2 + and! c = r3 + return b - c + } + """ + |> ignoreWarnings + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Error 3345, Line 17, Col 9, Line 17, Col 20, "use! may not be combined with and!") + ] \ No newline at end of file From bdf11ecdce01f4ab31fde8aa1d6934886a5d3188 Mon Sep 17 00:00:00 2001 From: Edgar Gonzalez Date: Sun, 8 Sep 2024 16:43:42 +0100 Subject: [PATCH 2/7] release notes --- docs/release-notes/.FSharp.Compiler.Service/9.0.100.md | 1 + src/Compiler/Checking/Expressions/CheckComputationExpressions.fs | 1 + 2 files changed, 2 insertions(+) diff --git a/docs/release-notes/.FSharp.Compiler.Service/9.0.100.md b/docs/release-notes/.FSharp.Compiler.Service/9.0.100.md index 27e8ed7350a..d2c56ea1172 100644 --- a/docs/release-notes/.FSharp.Compiler.Service/9.0.100.md +++ b/docs/release-notes/.FSharp.Compiler.Service/9.0.100.md @@ -41,6 +41,7 @@ * Applied nullable reference types to FSharp.Compiler.Service itself ([PR #15310](https://github.com/dotnet/fsharp/pull/15310)) * Ensure that isinteractive multi-emit backing fields are not public. ([Issue #17439](https://github.com/dotnet/fsharp/issues/17438)), ([PR #17439](https://github.com/dotnet/fsharp/pull/17439)) * Better error reporting for unions with duplicated fields. ([PR #17521](https://github.com/dotnet/fsharp/pull/17521)) +* Better CE error reporting when using `use!` with `and!` ([PR #17671](https://github.com/dotnet/fsharp/pull/17671)) * Optimize ILTypeDef interface impls reading from metadata. ([PR #17382](https://github.com/dotnet/fsharp/pull/17382)) ### Breaking Changes diff --git a/src/Compiler/Checking/Expressions/CheckComputationExpressions.fs b/src/Compiler/Checking/Expressions/CheckComputationExpressions.fs index 5d92f502966..298c0b6fe91 100644 --- a/src/Compiler/Checking/Expressions/CheckComputationExpressions.fs +++ b/src/Compiler/Checking/Expressions/CheckComputationExpressions.fs @@ -1996,6 +1996,7 @@ let rec TryTranslateComputationExpression match spBind with | DebugPointAtBinding.Yes m -> m | _ -> pat.Range + error (Error(FSComp.SR.tcInvalidUseBangBindingNoAndBangs (), mBind)) // 'let! pat1 = expr1 and! pat2 = expr2 in ...' --> From f133ae061c468a0188a34fc59f7c7c3fdde18f83 Mon Sep 17 00:00:00 2001 From: Edgar Gonzalez Date: Sun, 8 Sep 2024 18:11:16 +0100 Subject: [PATCH 3/7] use `and!` range instead of `use!` --- .../CheckComputationExpressions.fs | 12 ++-- src/Compiler/SyntaxTree/SyntaxTree.fs | 4 ++ src/Compiler/SyntaxTree/SyntaxTree.fsi | 3 + .../Language/ComputationExpressionTests.fs | 67 ++++++++++++++++++- 4 files changed, 79 insertions(+), 7 deletions(-) diff --git a/src/Compiler/Checking/Expressions/CheckComputationExpressions.fs b/src/Compiler/Checking/Expressions/CheckComputationExpressions.fs index 298c0b6fe91..5e7ddfaec0a 100644 --- a/src/Compiler/Checking/Expressions/CheckComputationExpressions.fs +++ b/src/Compiler/Checking/Expressions/CheckComputationExpressions.fs @@ -1988,16 +1988,16 @@ let rec TryTranslateComputationExpression Some(translatedCtxt bindExpr) // 'use! pat = e1 ... in e2' where 'pat' is not a simple name -> error - | SynExpr.LetOrUseBang(bindDebugPoint = spBind; isUse = true; pat = pat; andBangs = andBangs) -> + | SynExpr.LetOrUseBang(isUse = true; pat = pat; andBangs = andBangs) -> if isNil andBangs then error (Error(FSComp.SR.tcInvalidUseBangBinding (), pat.Range)) else - let mBind = - match spBind with - | DebugPointAtBinding.Yes m -> m - | _ -> pat.Range + let m = + match andBangs with + | [] -> comp.Range + | h :: _ -> h.Range - error (Error(FSComp.SR.tcInvalidUseBangBindingNoAndBangs (), mBind)) + error (Error(FSComp.SR.tcInvalidUseBangBindingNoAndBangs (), m)) // 'let! pat1 = expr1 and! pat2 = expr2 in ...' --> // build.BindN(expr1, expr2, ...) diff --git a/src/Compiler/SyntaxTree/SyntaxTree.fs b/src/Compiler/SyntaxTree/SyntaxTree.fs index 5a9b158875d..77c701589ff 100644 --- a/src/Compiler/SyntaxTree/SyntaxTree.fs +++ b/src/Compiler/SyntaxTree/SyntaxTree.fs @@ -870,6 +870,10 @@ type SynExprAndBang = range: range * trivia: SynExprAndBangTrivia + member x.Range = + match x with + | SynExprAndBang(range = range) -> range + [] type SynExprRecordField = | SynExprRecordField of diff --git a/src/Compiler/SyntaxTree/SyntaxTree.fsi b/src/Compiler/SyntaxTree/SyntaxTree.fsi index 9c7b83083df..96fc4f23a54 100644 --- a/src/Compiler/SyntaxTree/SyntaxTree.fsi +++ b/src/Compiler/SyntaxTree/SyntaxTree.fsi @@ -982,6 +982,9 @@ type SynExprAndBang = range: range * trivia: SynExprAndBangTrivia + /// Gets the syntax range of this construct + member Range: range + [] type SynExprRecordField = | SynExprRecordField of diff --git a/tests/FSharp.Compiler.ComponentTests/Language/ComputationExpressionTests.fs b/tests/FSharp.Compiler.ComponentTests/Language/ComputationExpressionTests.fs index 90ec325424c..42fdcd3ba6d 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/ComputationExpressionTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/ComputationExpressionTests.fs @@ -180,5 +180,70 @@ let run r2 r3 = |> typecheck |> shouldFail |> withDiagnostics [ - (Error 3345, Line 17, Col 9, Line 17, Col 20, "use! may not be combined with and!") + (Error 3345, Line 18, Col 9, Line 18, Col 20, "use! may not be combined with and!") + ] + + [] + let ``multiple use! may not be combined with and!`` () = + Fsx """ +module Result = + let zip x1 x2 = + match x1,x2 with + | Ok x1res, Ok x2res -> Ok (x1res, x2res) + | Error e, _ -> Error e + | _, Error e -> Error e + +type ResultBuilder() = + member _.MergeSources(t1: Result<'T,'U>, t2: Result<'T1,'U>) = Result.zip t1 t2 + member _.BindReturn(x: Result<'T,'U>, f) = Result.map f x + +let result = ResultBuilder() + +let run r2 r3 = + result { + use! b = r2 + and! c = r3 + use! d = r2 + return b - c + } + """ + |> ignoreWarnings + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Error 3345, Line 18, Col 9, Line 18, Col 20, "use! may not be combined with and!") + ] + + [] + let ``multiple use! may not be combined with multiple and!`` () = + Fsx """ +module Result = + let zip x1 x2 = + match x1,x2 with + | Ok x1res, Ok x2res -> Ok (x1res, x2res) + | Error e, _ -> Error e + | _, Error e -> Error e + +type ResultBuilder() = + member _.MergeSources(t1: Result<'T,'U>, t2: Result<'T1,'U>) = Result.zip t1 t2 + member _.BindReturn(x: Result<'T,'U>, f) = Result.map f x + member _.BindReturn(x: Result<'T,'U>, f) = Result.map f x + member _.Bind(x: Result<'T,'U>, f) = Result.bind f x + +let result = ResultBuilder() + +let run r2 r3 = + result { + let! c = r3 + and! c = r3 + use! b = r2 + and! c = r3 + return b - c + } + """ + |> ignoreWarnings + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Error 3345, Line 22, Col 9, Line 22, Col 20, "use! may not be combined with and!") ] \ No newline at end of file From 74c935316530d24e092690755322ae6659f8fec7 Mon Sep 17 00:00:00 2001 From: Edgar Gonzalez Date: Sun, 8 Sep 2024 19:09:37 +0100 Subject: [PATCH 4/7] Add AndBangKeyword trivia range --- .../Checking/Expressions/CheckComputationExpressions.fs | 2 +- src/Compiler/SyntaxTree/SyntaxTree.fs | 4 ++++ src/Compiler/SyntaxTree/SyntaxTree.fsi | 3 +++ src/Compiler/SyntaxTree/SyntaxTrivia.fs | 1 + src/Compiler/SyntaxTree/SyntaxTrivia.fsi | 3 ++- src/Compiler/pars.fsy | 6 ++++-- 6 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/Compiler/Checking/Expressions/CheckComputationExpressions.fs b/src/Compiler/Checking/Expressions/CheckComputationExpressions.fs index 5e7ddfaec0a..3a3682fbf53 100644 --- a/src/Compiler/Checking/Expressions/CheckComputationExpressions.fs +++ b/src/Compiler/Checking/Expressions/CheckComputationExpressions.fs @@ -1995,7 +1995,7 @@ let rec TryTranslateComputationExpression let m = match andBangs with | [] -> comp.Range - | h :: _ -> h.Range + | h :: _ -> h.Trivia.AndBangKeyword error (Error(FSComp.SR.tcInvalidUseBangBindingNoAndBangs (), m)) diff --git a/src/Compiler/SyntaxTree/SyntaxTree.fs b/src/Compiler/SyntaxTree/SyntaxTree.fs index 77c701589ff..50c81fdcc58 100644 --- a/src/Compiler/SyntaxTree/SyntaxTree.fs +++ b/src/Compiler/SyntaxTree/SyntaxTree.fs @@ -874,6 +874,10 @@ type SynExprAndBang = match x with | SynExprAndBang(range = range) -> range + member this.Trivia = + match this with + | SynExprAndBang(trivia = trivia) -> trivia + [] type SynExprRecordField = | SynExprRecordField of diff --git a/src/Compiler/SyntaxTree/SyntaxTree.fsi b/src/Compiler/SyntaxTree/SyntaxTree.fsi index 96fc4f23a54..2cc6b14947a 100644 --- a/src/Compiler/SyntaxTree/SyntaxTree.fsi +++ b/src/Compiler/SyntaxTree/SyntaxTree.fsi @@ -985,6 +985,9 @@ type SynExprAndBang = /// Gets the syntax range of this construct member Range: range + /// Gets the trivia associated with this construct + member Trivia: SynExprAndBangTrivia + [] type SynExprRecordField = | SynExprRecordField of diff --git a/src/Compiler/SyntaxTree/SyntaxTrivia.fs b/src/Compiler/SyntaxTree/SyntaxTrivia.fs index 82c581520b4..f259746cfff 100644 --- a/src/Compiler/SyntaxTree/SyntaxTrivia.fs +++ b/src/Compiler/SyntaxTree/SyntaxTrivia.fs @@ -270,6 +270,7 @@ type SynBindingTrivia = [] type SynExprAndBangTrivia = { + AndBangKeyword: range EqualsRange: range InKeyword: range option } diff --git a/src/Compiler/SyntaxTree/SyntaxTrivia.fsi b/src/Compiler/SyntaxTree/SyntaxTrivia.fsi index 79c7903e78c..567586081f2 100644 --- a/src/Compiler/SyntaxTree/SyntaxTrivia.fsi +++ b/src/Compiler/SyntaxTree/SyntaxTrivia.fsi @@ -334,9 +334,10 @@ type SynBindingTrivia = [] type SynExprAndBangTrivia = { + /// The syntax range of the `and!` keyword + AndBangKeyword: range /// The syntax range of the `=` token. EqualsRange: range - /// The syntax range of the `in` keyword. InKeyword: range option } diff --git a/src/Compiler/pars.fsy b/src/Compiler/pars.fsy index e355a31e2f3..06c108e9b4d 100644 --- a/src/Compiler/pars.fsy +++ b/src/Compiler/pars.fsy @@ -4078,7 +4078,8 @@ moreBinders: let mEquals = rhs parseState 3 let m = unionRanges (rhs parseState 1) $4.Range let mIn = rhs parseState 5 - SynExprAndBang(spBind, $1, true, $2, $4, m, { EqualsRange = mEquals; InKeyword = Some mIn }) :: $6 } + let trivia = { AndBangKeyword = rhs parseState 1; EqualsRange = mEquals; InKeyword = Some mIn } + SynExprAndBang(spBind, $1, true, $2, $4, m, trivia) :: $6 } | OAND_BANG headBindingPattern EQUALS typedSequentialExprBlock hardwhiteDefnBindingsTerminator opt_OBLOCKSEP moreBinders %prec expr_let { let report, mIn, _ = $5 @@ -4086,7 +4087,8 @@ moreBinders: let spBind = DebugPointAtBinding.Yes(rhs2 parseState 1 5) (* TODO Pretty sure this is wrong *) let mEquals = rhs parseState 3 let m = unionRanges (rhs parseState 1) $4.Range - SynExprAndBang(spBind, $1, true, $2, $4, m, { EqualsRange = mEquals; InKeyword = mIn }) :: $7 } + let trivia = { AndBangKeyword = rhs parseState 1; EqualsRange = mEquals; InKeyword = mIn } + SynExprAndBang(spBind, $1, true, $2, $4, m, trivia) :: $7 } | %prec prec_no_more_attr_bindings { [] } From 4e5ae979e34ed1b717955f28ba6261a3153c78f7 Mon Sep 17 00:00:00 2001 From: Edgar Gonzalez Date: Sun, 8 Sep 2024 19:09:48 +0100 Subject: [PATCH 5/7] Update tests --- .../Language/ComputationExpressionTests.fs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/FSharp.Compiler.ComponentTests/Language/ComputationExpressionTests.fs b/tests/FSharp.Compiler.ComponentTests/Language/ComputationExpressionTests.fs index 42fdcd3ba6d..d5c6a5a0a63 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/ComputationExpressionTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/ComputationExpressionTests.fs @@ -180,7 +180,7 @@ let run r2 r3 = |> typecheck |> shouldFail |> withDiagnostics [ - (Error 3345, Line 18, Col 9, Line 18, Col 20, "use! may not be combined with and!") + (Error 3345, Line 18, Col 9, Line 18, Col 13, "use! may not be combined with and!") ] [] @@ -211,7 +211,7 @@ let run r2 r3 = |> typecheck |> shouldFail |> withDiagnostics [ - (Error 3345, Line 18, Col 9, Line 18, Col 20, "use! may not be combined with and!") + (Error 3345, Line 18, Col 9, Line 18, Col 13, "use! may not be combined with and!") ] [] @@ -245,5 +245,5 @@ let run r2 r3 = |> typecheck |> shouldFail |> withDiagnostics [ - (Error 3345, Line 22, Col 9, Line 22, Col 20, "use! may not be combined with and!") + (Error 3345, Line 22, Col 9, Line 22, Col 13, "use! may not be combined with and!") ] \ No newline at end of file From 3f88f833dfef88cb1d2aa770ed57dc3676d40666 Mon Sep 17 00:00:00 2001 From: Edgar Gonzalez Date: Sun, 8 Sep 2024 19:25:50 +0100 Subject: [PATCH 6/7] surface area --- ...p.Compiler.Service.SurfaceArea.netstandard20.debug.bsl | 8 +++++++- ...Compiler.Service.SurfaceArea.netstandard20.release.bsl | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.debug.bsl b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.debug.bsl index 58e660c6ae1..03b461d6a54 100644 --- a/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.debug.bsl +++ b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.debug.bsl @@ -7740,8 +7740,12 @@ FSharp.Compiler.Syntax.SynExprAndBang: FSharp.Compiler.Syntax.SynExpr get_body() FSharp.Compiler.Syntax.SynExprAndBang: FSharp.Compiler.Syntax.SynExprAndBang NewSynExprAndBang(FSharp.Compiler.Syntax.DebugPointAtBinding, Boolean, Boolean, FSharp.Compiler.Syntax.SynPat, FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range, FSharp.Compiler.SyntaxTrivia.SynExprAndBangTrivia) FSharp.Compiler.Syntax.SynExprAndBang: FSharp.Compiler.Syntax.SynPat get_pat() FSharp.Compiler.Syntax.SynExprAndBang: FSharp.Compiler.Syntax.SynPat pat +FSharp.Compiler.Syntax.SynExprAndBang: FSharp.Compiler.SyntaxTrivia.SynExprAndBangTrivia Trivia +FSharp.Compiler.Syntax.SynExprAndBang: FSharp.Compiler.SyntaxTrivia.SynExprAndBangTrivia get_Trivia() FSharp.Compiler.Syntax.SynExprAndBang: FSharp.Compiler.SyntaxTrivia.SynExprAndBangTrivia get_trivia() FSharp.Compiler.Syntax.SynExprAndBang: FSharp.Compiler.SyntaxTrivia.SynExprAndBangTrivia trivia +FSharp.Compiler.Syntax.SynExprAndBang: FSharp.Compiler.Text.Range Range +FSharp.Compiler.Syntax.SynExprAndBang: FSharp.Compiler.Text.Range get_Range() FSharp.Compiler.Syntax.SynExprAndBang: FSharp.Compiler.Text.Range get_range() FSharp.Compiler.Syntax.SynExprAndBang: FSharp.Compiler.Text.Range range FSharp.Compiler.Syntax.SynExprAndBang: Int32 Tag @@ -10139,12 +10143,14 @@ FSharp.Compiler.SyntaxTrivia.SynEnumCaseTrivia: Microsoft.FSharp.Core.FSharpOpti FSharp.Compiler.SyntaxTrivia.SynEnumCaseTrivia: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range] get_BarRange() FSharp.Compiler.SyntaxTrivia.SynEnumCaseTrivia: System.String ToString() FSharp.Compiler.SyntaxTrivia.SynEnumCaseTrivia: Void .ctor(Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range], FSharp.Compiler.Text.Range) +FSharp.Compiler.SyntaxTrivia.SynExprAndBangTrivia: FSharp.Compiler.Text.Range AndBangKeyword FSharp.Compiler.SyntaxTrivia.SynExprAndBangTrivia: FSharp.Compiler.Text.Range EqualsRange +FSharp.Compiler.SyntaxTrivia.SynExprAndBangTrivia: FSharp.Compiler.Text.Range get_AndBangKeyword() FSharp.Compiler.SyntaxTrivia.SynExprAndBangTrivia: FSharp.Compiler.Text.Range get_EqualsRange() FSharp.Compiler.SyntaxTrivia.SynExprAndBangTrivia: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range] InKeyword FSharp.Compiler.SyntaxTrivia.SynExprAndBangTrivia: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range] get_InKeyword() FSharp.Compiler.SyntaxTrivia.SynExprAndBangTrivia: System.String ToString() -FSharp.Compiler.SyntaxTrivia.SynExprAndBangTrivia: Void .ctor(FSharp.Compiler.Text.Range, Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range]) +FSharp.Compiler.SyntaxTrivia.SynExprAndBangTrivia: Void .ctor(FSharp.Compiler.Text.Range, FSharp.Compiler.Text.Range, Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range]) FSharp.Compiler.SyntaxTrivia.SynExprAnonRecdTrivia: FSharp.Compiler.Text.Range OpeningBraceRange FSharp.Compiler.SyntaxTrivia.SynExprAnonRecdTrivia: FSharp.Compiler.Text.Range get_OpeningBraceRange() FSharp.Compiler.SyntaxTrivia.SynExprAnonRecdTrivia: System.String ToString() diff --git a/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.release.bsl b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.release.bsl index 58e660c6ae1..03b461d6a54 100644 --- a/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.release.bsl +++ b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.release.bsl @@ -7740,8 +7740,12 @@ FSharp.Compiler.Syntax.SynExprAndBang: FSharp.Compiler.Syntax.SynExpr get_body() FSharp.Compiler.Syntax.SynExprAndBang: FSharp.Compiler.Syntax.SynExprAndBang NewSynExprAndBang(FSharp.Compiler.Syntax.DebugPointAtBinding, Boolean, Boolean, FSharp.Compiler.Syntax.SynPat, FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range, FSharp.Compiler.SyntaxTrivia.SynExprAndBangTrivia) FSharp.Compiler.Syntax.SynExprAndBang: FSharp.Compiler.Syntax.SynPat get_pat() FSharp.Compiler.Syntax.SynExprAndBang: FSharp.Compiler.Syntax.SynPat pat +FSharp.Compiler.Syntax.SynExprAndBang: FSharp.Compiler.SyntaxTrivia.SynExprAndBangTrivia Trivia +FSharp.Compiler.Syntax.SynExprAndBang: FSharp.Compiler.SyntaxTrivia.SynExprAndBangTrivia get_Trivia() FSharp.Compiler.Syntax.SynExprAndBang: FSharp.Compiler.SyntaxTrivia.SynExprAndBangTrivia get_trivia() FSharp.Compiler.Syntax.SynExprAndBang: FSharp.Compiler.SyntaxTrivia.SynExprAndBangTrivia trivia +FSharp.Compiler.Syntax.SynExprAndBang: FSharp.Compiler.Text.Range Range +FSharp.Compiler.Syntax.SynExprAndBang: FSharp.Compiler.Text.Range get_Range() FSharp.Compiler.Syntax.SynExprAndBang: FSharp.Compiler.Text.Range get_range() FSharp.Compiler.Syntax.SynExprAndBang: FSharp.Compiler.Text.Range range FSharp.Compiler.Syntax.SynExprAndBang: Int32 Tag @@ -10139,12 +10143,14 @@ FSharp.Compiler.SyntaxTrivia.SynEnumCaseTrivia: Microsoft.FSharp.Core.FSharpOpti FSharp.Compiler.SyntaxTrivia.SynEnumCaseTrivia: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range] get_BarRange() FSharp.Compiler.SyntaxTrivia.SynEnumCaseTrivia: System.String ToString() FSharp.Compiler.SyntaxTrivia.SynEnumCaseTrivia: Void .ctor(Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range], FSharp.Compiler.Text.Range) +FSharp.Compiler.SyntaxTrivia.SynExprAndBangTrivia: FSharp.Compiler.Text.Range AndBangKeyword FSharp.Compiler.SyntaxTrivia.SynExprAndBangTrivia: FSharp.Compiler.Text.Range EqualsRange +FSharp.Compiler.SyntaxTrivia.SynExprAndBangTrivia: FSharp.Compiler.Text.Range get_AndBangKeyword() FSharp.Compiler.SyntaxTrivia.SynExprAndBangTrivia: FSharp.Compiler.Text.Range get_EqualsRange() FSharp.Compiler.SyntaxTrivia.SynExprAndBangTrivia: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range] InKeyword FSharp.Compiler.SyntaxTrivia.SynExprAndBangTrivia: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range] get_InKeyword() FSharp.Compiler.SyntaxTrivia.SynExprAndBangTrivia: System.String ToString() -FSharp.Compiler.SyntaxTrivia.SynExprAndBangTrivia: Void .ctor(FSharp.Compiler.Text.Range, Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range]) +FSharp.Compiler.SyntaxTrivia.SynExprAndBangTrivia: Void .ctor(FSharp.Compiler.Text.Range, FSharp.Compiler.Text.Range, Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range]) FSharp.Compiler.SyntaxTrivia.SynExprAnonRecdTrivia: FSharp.Compiler.Text.Range OpeningBraceRange FSharp.Compiler.SyntaxTrivia.SynExprAnonRecdTrivia: FSharp.Compiler.Text.Range get_OpeningBraceRange() FSharp.Compiler.SyntaxTrivia.SynExprAnonRecdTrivia: System.String ToString() From cd51175faa79c1bbb9099532cb54c68dab346cd3 Mon Sep 17 00:00:00 2001 From: Edgar Gonzalez Date: Sun, 8 Sep 2024 20:07:27 +0100 Subject: [PATCH 7/7] Update SyntaxTreeTests --- ...angHaveRangeThatStartsAtAndAndEndsAfterExpression.fs.bsl | 6 ++++-- ...ExprAndBangRangeStartsAtAndAndEndsAfterExpression.fs.bsl | 3 ++- ...ynExprLetOrUseBangContainsTheRangeOfTheEqualsSign.fs.bsl | 3 ++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/service/data/SyntaxTree/ComputationExpression/MultipleSynExprAndBangHaveRangeThatStartsAtAndAndEndsAfterExpression.fs.bsl b/tests/service/data/SyntaxTree/ComputationExpression/MultipleSynExprAndBangHaveRangeThatStartsAtAndAndEndsAfterExpression.fs.bsl index a5a22fcb93f..2c7ca108bc8 100644 --- a/tests/service/data/SyntaxTree/ComputationExpression/MultipleSynExprAndBangHaveRangeThatStartsAtAndAndEndsAfterExpression.fs.bsl +++ b/tests/service/data/SyntaxTree/ComputationExpression/MultipleSynExprAndBangHaveRangeThatStartsAtAndAndEndsAfterExpression.fs.bsl @@ -26,7 +26,8 @@ ImplFile App (NonAtomic, false, Ident getFoo, Const (Unit, (4,22--4,24)), (4,15--4,24)), - (4,4--4,24), { EqualsRange = (4,13--4,14) + (4,4--4,24), { AndBangKeyword = (4,4--4,8) + EqualsRange = (4,13--4,14) InKeyword = Some (4,25--4,27) }); SynExprAndBang (Yes (5,4--6,10), false, true, @@ -35,7 +36,8 @@ ImplFile App (NonAtomic, false, Ident getMeh, Const (Unit, (5,22--5,24)), (5,15--5,24)), - (5,4--5,24), { EqualsRange = (5,13--5,14) + (5,4--5,24), { AndBangKeyword = (5,4--5,8) + EqualsRange = (5,13--5,14) InKeyword = None })], YieldOrReturn ((false, true), Ident bar, (6,4--6,14)), (3,4--6,14), { EqualsRange = Some (3,13--3,14) }), diff --git a/tests/service/data/SyntaxTree/ComputationExpression/SynExprAndBangRangeStartsAtAndAndEndsAfterExpression.fs.bsl b/tests/service/data/SyntaxTree/ComputationExpression/SynExprAndBangRangeStartsAtAndAndEndsAfterExpression.fs.bsl index 837d642b442..105a94f5b46 100644 --- a/tests/service/data/SyntaxTree/ComputationExpression/SynExprAndBangRangeStartsAtAndAndEndsAfterExpression.fs.bsl +++ b/tests/service/data/SyntaxTree/ComputationExpression/SynExprAndBangRangeStartsAtAndAndEndsAfterExpression.fs.bsl @@ -25,7 +25,8 @@ ImplFile App (NonAtomic, false, Ident getFoo, Const (Unit, (5,22--5,24)), (5,15--5,24)), - (5,4--5,24), { EqualsRange = (5,13--5,14) + (5,4--5,24), { AndBangKeyword = (5,4--5,8) + EqualsRange = (5,13--5,14) InKeyword = None })], YieldOrReturn ((false, true), Ident bar, (7,4--7,14)), (3,4--7,14), { EqualsRange = Some (3,13--3,14) }), diff --git a/tests/service/data/SyntaxTree/Expression/SynExprLetOrUseBangContainsTheRangeOfTheEqualsSign.fs.bsl b/tests/service/data/SyntaxTree/Expression/SynExprLetOrUseBangContainsTheRangeOfTheEqualsSign.fs.bsl index 6f2b839ce00..7dfd05fc1ad 100644 --- a/tests/service/data/SyntaxTree/Expression/SynExprLetOrUseBangContainsTheRangeOfTheEqualsSign.fs.bsl +++ b/tests/service/data/SyntaxTree/Expression/SynExprLetOrUseBangContainsTheRangeOfTheEqualsSign.fs.bsl @@ -22,7 +22,8 @@ ImplFile App (NonAtomic, false, Ident someFunction, Const (Unit, (4,26--4,28)), (4,13--4,28)), - (4,4--4,28), { EqualsRange = (4,11--4,12) + (4,4--4,28), { AndBangKeyword = (4,4--4,8) + EqualsRange = (4,11--4,12) InKeyword = None })], YieldOrReturn ((false, true), Const (Unit, (5,11--5,13)), (5,4--5,13)),