From 1799aaf29034f01357684c7716b6eed8fc76468a Mon Sep 17 00:00:00 2001 From: Edgar Gonzalez Date: Wed, 23 Apr 2025 15:27:24 +0100 Subject: [PATCH 01/24] make attribute targets mismatches a warning and not an error. --- .../Checking/Expressions/CheckExpressions.fs | 2 +- .../AttributeUsage/AttributeUsage.fs | 215 +++++++++--------- .../CustomAttributes/Basic/Basic.fs | 7 +- .../EntryPoint/EntryPoint.fs | 2 +- .../LetBindings/Basic/Basic.fs | 4 +- .../ErrorMessages/TailCallAttribute.fs | 32 +-- 6 files changed, 125 insertions(+), 137 deletions(-) diff --git a/src/Compiler/Checking/Expressions/CheckExpressions.fs b/src/Compiler/Checking/Expressions/CheckExpressions.fs index 5f390038e35..e2d21975311 100644 --- a/src/Compiler/Checking/Expressions/CheckExpressions.fs +++ b/src/Compiler/Checking/Expressions/CheckExpressions.fs @@ -11367,7 +11367,7 @@ and TcAttributeEx canFail (cenv: cenv) (env: TcEnv) attrTgt attrEx (synAttr: Syn if (directedTgts = AttributeTargets.Assembly || directedTgts = AttributeTargets.Module) then error(Error(FSComp.SR.tcAttributeIsNotValidForLanguageElementUseDo(), mAttr)) else - error(Error(FSComp.SR.tcAttributeIsNotValidForLanguageElement(), mAttr)) + warning(Error(FSComp.SR.tcAttributeIsNotValidForLanguageElement(), mAttr)) match ResolveObjectConstructor cenv.nameResolver env.DisplayEnv mAttr ad ty with | Exception _ when canFail = TcCanFail.IgnoreAllErrors || canFail = TcCanFail.IgnoreMemberResoutionError -> [ ], true diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AttributeUsage.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AttributeUsage.fs index c7c2cf72eca..f027745b73e 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AttributeUsage.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AttributeUsage.fs @@ -104,10 +104,10 @@ module CustomAttributes_AttributeUsage = |> verifyCompile |> shouldFail |> withDiagnostics [ - (Error 842, Line 21, Col 21, Line 21, Col 22, "This attribute is not valid for use on this language element") - (Error 842, Line 24, Col 21, Line 24, Col 29, "This attribute is not valid for use on this language element") - (Error 842, Line 27, Col 7, Line 27, Col 16, "This attribute is not valid for use on this language element") - (Error 842, Line 18, Col 7, Line 18, Col 8, "This attribute is not valid for use on this language element") + (Warning 842, Line 21, Col 21, Line 21, Col 22, "This attribute is not valid for use on this language element") + (Warning 842, Line 24, Col 21, Line 24, Col 29, "This attribute is not valid for use on this language element") + (Warning 842, Line 27, Col 7, Line 27, Col 16, "This attribute is not valid for use on this language element") + (Warning 842, Line 18, Col 7, Line 18, Col 8, "This attribute is not valid for use on this language element") ] // SOURCE=E_AttributeTargets02.fs # E_AttributeTargets02.fs @@ -117,9 +117,10 @@ module CustomAttributes_AttributeUsage = |> verifyCompile |> shouldFail |> withDiagnostics [ - (Error 842, Line 14, Col 7, Line 14, Col 34, "This attribute is not valid for use on this language element") - (Error 842, Line 24, Col 7, Line 24, Col 36, "This attribute is not valid for use on this language element") - (Error 842, Line 29, Col 15, Line 29, Col 47, "This attribute is not valid for use on this language element") + (Warning 842, Line 14, Col 7, Line 14, Col 34, "This attribute is not valid for use on this language element") + (Warning 842, Line 24, Col 7, Line 24, Col 36, "This attribute is not valid for use on this language element") + (Warning 842, Line 29, Col 15, Line 29, Col 47, "This attribute is not valid for use on this language element") + (Error 3172, Line 28, Col 14, Line 28, Col 17, "A property's getter and setter must have the same type. Property 'Foo' has getter of type 'int' but setter of type 'obj'.") ] // SOURCE=E_AttributeTargetIsField01.fs # E_AttributeTargetIsField01.fs @@ -140,23 +141,23 @@ module CustomAttributes_AttributeUsage = |> verifyCompile |> shouldFail |> withDiagnostics [ - (Error 842, Line 9, Col 3, Line 9, Col 12, "This attribute is not valid for use on this language element") - (Error 842, Line 12, Col 3, Line 12, Col 12, "This attribute is not valid for use on this language element") - (Error 842, Line 15, Col 3, Line 15, Col 12, "This attribute is not valid for use on this language element") - (Error 842, Line 18, Col 3, Line 18, Col 12, "This attribute is not valid for use on this language element") - (Error 842, Line 21, Col 3, Line 21, Col 12, "This attribute is not valid for use on this language element") - (Error 842, Line 24, Col 3, Line 24, Col 12, "This attribute is not valid for use on this language element") - (Error 842, Line 27, Col 3, Line 27, Col 12, "This attribute is not valid for use on this language element") - (Error 842, Line 30, Col 3, Line 30, Col 12, "This attribute is not valid for use on this language element") - (Error 842, Line 33, Col 3, Line 33, Col 12, "This attribute is not valid for use on this language element") - (Error 842, Line 36, Col 3, Line 36, Col 12, "This attribute is not valid for use on this language element") - (Error 842, Line 39, Col 3, Line 39, Col 12, "This attribute is not valid for use on this language element") - (Error 842, Line 42, Col 3, Line 42, Col 12, "This attribute is not valid for use on this language element") - (Error 842, Line 45, Col 3, Line 45, Col 12, "This attribute is not valid for use on this language element") - (Error 842, Line 49, Col 3, Line 49, Col 12, "This attribute is not valid for use on this language element") - (Error 842, Line 56, Col 3, Line 56, Col 12, "This attribute is not valid for use on this language element") - (Error 842, Line 64, Col 3, Line 64, Col 12, "This attribute is not valid for use on this language element") - (Error 842, Line 66, Col 7, Line 66, Col 16, "This attribute is not valid for use on this language element") + (Warning 842, Line 9, Col 3, Line 9, Col 12, "This attribute is not valid for use on this language element") + (Warning 842, Line 12, Col 3, Line 12, Col 12, "This attribute is not valid for use on this language element") + (Warning 842, Line 15, Col 3, Line 15, Col 12, "This attribute is not valid for use on this language element") + (Warning 842, Line 18, Col 3, Line 18, Col 12, "This attribute is not valid for use on this language element") + (Warning 842, Line 21, Col 3, Line 21, Col 12, "This attribute is not valid for use on this language element") + (Warning 842, Line 24, Col 3, Line 24, Col 12, "This attribute is not valid for use on this language element") + (Warning 842, Line 27, Col 3, Line 27, Col 12, "This attribute is not valid for use on this language element") + (Warning 842, Line 30, Col 3, Line 30, Col 12, "This attribute is not valid for use on this language element") + (Warning 842, Line 33, Col 3, Line 33, Col 12, "This attribute is not valid for use on this language element") + (Warning 842, Line 36, Col 3, Line 36, Col 12, "This attribute is not valid for use on this language element") + (Warning 842, Line 39, Col 3, Line 39, Col 12, "This attribute is not valid for use on this language element") + (Warning 842, Line 42, Col 3, Line 42, Col 12, "This attribute is not valid for use on this language element") + (Warning 842, Line 45, Col 3, Line 45, Col 12, "This attribute is not valid for use on this language element") + (Warning 842, Line 49, Col 3, Line 49, Col 12, "This attribute is not valid for use on this language element") + (Warning 842, Line 56, Col 3, Line 56, Col 12, "This attribute is not valid for use on this language element") + (Warning 842, Line 64, Col 3, Line 64, Col 12, "This attribute is not valid for use on this language element") + (Warning 842, Line 66, Col 7, Line 66, Col 16, "This attribute is not valid for use on this language element") ] // SOURCE=E_AttributeTargetIsField02.fs # E_AttributeTargetIsField02.fs @@ -194,17 +195,17 @@ module CustomAttributes_AttributeUsage = |> verifyCompile |> shouldFail |> withDiagnostics [ - (Error 842, Line 9, Col 3, Line 9, Col 13, "This attribute is not valid for use on this language element") - (Error 842, Line 12, Col 3, Line 12, Col 13, "This attribute is not valid for use on this language element") - (Error 842, Line 15, Col 3, Line 15, Col 13, "This attribute is not valid for use on this language element") - (Error 842, Line 18, Col 3, Line 18, Col 13, "This attribute is not valid for use on this language element") - (Error 842, Line 21, Col 3, Line 21, Col 13, "This attribute is not valid for use on this language element") - (Error 842, Line 24, Col 3, Line 24, Col 13, "This attribute is not valid for use on this language element") - (Error 842, Line 26, Col 7, Line 26, Col 17, "This attribute is not valid for use on this language element") - (Error 842, Line 28, Col 3, Line 28, Col 13, "This attribute is not valid for use on this language element") - (Error 842, Line 31, Col 3, Line 31, Col 13, "This attribute is not valid for use on this language element") - (Error 842, Line 34, Col 3, Line 34, Col 13, "This attribute is not valid for use on this language element") - (Error 842, Line 39, Col 3, Line 39, Col 13, "This attribute is not valid for use on this language element") + (Warning 842, Line 9, Col 3, Line 9, Col 13, "This attribute is not valid for use on this language element") + (Warning 842, Line 12, Col 3, Line 12, Col 13, "This attribute is not valid for use on this language element") + (Warning 842, Line 15, Col 3, Line 15, Col 13, "This attribute is not valid for use on this language element") + (Warning 842, Line 18, Col 3, Line 18, Col 13, "This attribute is not valid for use on this language element") + (Warning 842, Line 21, Col 3, Line 21, Col 13, "This attribute is not valid for use on this language element") + (Warning 842, Line 24, Col 3, Line 24, Col 13, "This attribute is not valid for use on this language element") + (Warning 842, Line 26, Col 7, Line 26, Col 17, "This attribute is not valid for use on this language element") + (Warning 842, Line 28, Col 3, Line 28, Col 13, "This attribute is not valid for use on this language element") + (Warning 842, Line 31, Col 3, Line 31, Col 13, "This attribute is not valid for use on this language element") + (Warning 842, Line 34, Col 3, Line 34, Col 13, "This attribute is not valid for use on this language element") + (Warning 842, Line 39, Col 3, Line 39, Col 13, "This attribute is not valid for use on this language element") ] // SOURCE=E_AttributeTargetIsMethod03.fs # E_AttributeTargetIsMethod03.fs @@ -225,21 +226,21 @@ module CustomAttributes_AttributeUsage = |> verifyCompile |> shouldFail |> withDiagnostics [ - (Error 842, Line 12, Col 6, Line 12, Col 16, "This attribute is not valid for use on this language element") - (Error 842, Line 15, Col 6, Line 15, Col 16, "This attribute is not valid for use on this language element") - (Error 842, Line 18, Col 6, Line 18, Col 16, "This attribute is not valid for use on this language element") - (Error 842, Line 20, Col 10, Line 20, Col 20, "This attribute is not valid for use on this language element") - (Error 842, Line 22, Col 6, Line 22, Col 16, "This attribute is not valid for use on this language element") - (Error 842, Line 25, Col 6, Line 25, Col 16, "This attribute is not valid for use on this language element") - (Error 842, Line 28, Col 6, Line 28, Col 16, "This attribute is not valid for use on this language element") - (Error 842, Line 31, Col 6, Line 31, Col 16, "This attribute is not valid for use on this language element") - (Error 842, Line 34, Col 6, Line 34, Col 16, "This attribute is not valid for use on this language element") - (Error 842, Line 37, Col 6, Line 37, Col 16, "This attribute is not valid for use on this language element") - (Error 842, Line 39, Col 10, Line 39, Col 20, "This attribute is not valid for use on this language element") - (Error 842, Line 41, Col 6, Line 41, Col 16, "This attribute is not valid for use on this language element") - (Error 842, Line 44, Col 6, Line 44, Col 16, "This attribute is not valid for use on this language element") - (Error 842, Line 47, Col 6, Line 47, Col 16, "This attribute is not valid for use on this language element") - (Error 842, Line 52, Col 6, Line 52, Col 16, "This attribute is not valid for use on this language element") + (Warning 842, Line 12, Col 6, Line 12, Col 16, "This attribute is not valid for use on this language element") + (Warning 842, Line 15, Col 6, Line 15, Col 16, "This attribute is not valid for use on this language element") + (Warning 842, Line 18, Col 6, Line 18, Col 16, "This attribute is not valid for use on this language element") + (Warning 842, Line 20, Col 10, Line 20, Col 20, "This attribute is not valid for use on this language element") + (Warning 842, Line 22, Col 6, Line 22, Col 16, "This attribute is not valid for use on this language element") + (Warning 842, Line 25, Col 6, Line 25, Col 16, "This attribute is not valid for use on this language element") + (Warning 842, Line 28, Col 6, Line 28, Col 16, "This attribute is not valid for use on this language element") + (Warning 842, Line 31, Col 6, Line 31, Col 16, "This attribute is not valid for use on this language element") + (Warning 842, Line 34, Col 6, Line 34, Col 16, "This attribute is not valid for use on this language element") + (Warning 842, Line 37, Col 6, Line 37, Col 16, "This attribute is not valid for use on this language element") + (Warning 842, Line 39, Col 10, Line 39, Col 20, "This attribute is not valid for use on this language element") + (Warning 842, Line 41, Col 6, Line 41, Col 16, "This attribute is not valid for use on this language element") + (Warning 842, Line 44, Col 6, Line 44, Col 16, "This attribute is not valid for use on this language element") + (Warning 842, Line 47, Col 6, Line 47, Col 16, "This attribute is not valid for use on this language element") + (Warning 842, Line 52, Col 6, Line 52, Col 16, "This attribute is not valid for use on this language element") ] // SOURCE=E_AttributeTargetIsMethod04.fs # E_AttributeTargetIsMethod04.fs @@ -250,8 +251,8 @@ module CustomAttributes_AttributeUsage = |> verifyCompile |> shouldFail |> withDiagnostics [ - (Error 842, Line 10, Col 3, Line 10, Col 15, "This attribute is not valid for use on this language element") - (Error 842, Line 13, Col 3, Line 13, Col 15, "This attribute is not valid for use on this language element") + (Warning 842, Line 10, Col 3, Line 10, Col 15, "This attribute is not valid for use on this language element") + (Warning 842, Line 13, Col 3, Line 13, Col 15, "This attribute is not valid for use on this language element") ] // SOURCE=E_ConditionalAttribute.fs SCFLAGS="--test:ErrorRanges" # E_ConditionalAttribute.fs @@ -293,7 +294,7 @@ module CustomAttributes_AttributeUsage = |> verifyCompile |> shouldFail |> withDiagnostics [ - (Error 842, Line 12, Col 3, Line 12, Col 6, "This attribute is not valid for use on this language element") + (Warning 842, Line 12, Col 3, Line 12, Col 6, "This attribute is not valid for use on this language element") ] // SOURCE=AttributeTargetIsStruct.fs # AttributeTargetIsStruct.fs @@ -342,18 +343,18 @@ module CustomAttributes_AttributeUsage = |> verifyCompile |> shouldFail |> withDiagnostics [ - (Error 842, Line 13, Col 3, Line 13, Col 14, "This attribute is not valid for use on this language element") - (Error 842, Line 19, Col 3, Line 19, Col 14, "This attribute is not valid for use on this language element") - (Error 842, Line 22, Col 11, Line 22, Col 22, "This attribute is not valid for use on this language element") - (Error 842, Line 25, Col 3, Line 25, Col 14, "This attribute is not valid for use on this language element") - (Error 842, Line 34, Col 3, Line 34, Col 18, "This attribute is not valid for use on this language element") - (Error 842, Line 35, Col 3, Line 35, Col 15, "This attribute is not valid for use on this language element") - (Error 842, Line 40, Col 3, Line 40, Col 14, "This attribute is not valid for use on this language element") - (Error 842, Line 41, Col 3, Line 41, Col 18, "This attribute is not valid for use on this language element") - (Error 842, Line 49, Col 3, Line 49, Col 18, "This attribute is not valid for use on this language element") - (Error 842, Line 50, Col 3, Line 50, Col 15, "This attribute is not valid for use on this language element") - (Error 842, Line 53, Col 3, Line 53, Col 14, "This attribute is not valid for use on this language element") - (Error 842, Line 54, Col 3, Line 54, Col 18, "This attribute is not valid for use on this language element") + (Warning 842, Line 13, Col 3, Line 13, Col 14, "This attribute is not valid for use on this language element") + (Warning 842, Line 19, Col 3, Line 19, Col 14, "This attribute is not valid for use on this language element") + (Warning 842, Line 22, Col 11, Line 22, Col 22, "This attribute is not valid for use on this language element") + (Warning 842, Line 25, Col 3, Line 25, Col 14, "This attribute is not valid for use on this language element") + (Warning 842, Line 34, Col 3, Line 34, Col 18, "This attribute is not valid for use on this language element") + (Warning 842, Line 35, Col 3, Line 35, Col 15, "This attribute is not valid for use on this language element") + (Warning 842, Line 40, Col 3, Line 40, Col 14, "This attribute is not valid for use on this language element") + (Warning 842, Line 41, Col 3, Line 41, Col 18, "This attribute is not valid for use on this language element") + (Warning 842, Line 49, Col 3, Line 49, Col 18, "This attribute is not valid for use on this language element") + (Warning 842, Line 50, Col 3, Line 50, Col 15, "This attribute is not valid for use on this language element") + (Warning 842, Line 53, Col 3, Line 53, Col 14, "This attribute is not valid for use on this language element") + (Warning 842, Line 54, Col 3, Line 54, Col 18, "This attribute is not valid for use on this language element") ] // SOURCE=E_AttributeTargetIsClass.fs # E_AttributeTargetIsClass.fs @@ -372,9 +373,9 @@ module CustomAttributes_AttributeUsage = |> verifyCompile |> shouldFail |> withDiagnostics [ - (Error 842, Line 13, Col 3, Line 13, Col 15, "This attribute is not valid for use on this language element") - (Error 842, Line 19, Col 3, Line 19, Col 15, "This attribute is not valid for use on this language element") - (Error 842, Line 22, Col 10, Line 22, Col 22, "This attribute is not valid for use on this language element") + (Warning 842, Line 13, Col 3, Line 13, Col 15, "This attribute is not valid for use on this language element") + (Warning 842, Line 19, Col 3, Line 19, Col 15, "This attribute is not valid for use on this language element") + (Warning 842, Line 22, Col 10, Line 22, Col 22, "This attribute is not valid for use on this language element") ] // SOURCE=E_AttributeTargetIsClass01.fs # E_AttributeTargetIsClass01.fs @@ -393,8 +394,8 @@ module CustomAttributes_AttributeUsage = |> verifyCompile |> shouldFail |> withDiagnostics [ - (Error 842, Line 7, Col 3, Line 7, Col 18, "This attribute is not valid for use on this language element") - (Error 842, Line 10, Col 10, Line 10, Col 25, "This attribute is not valid for use on this language element") + (Warning 842, Line 7, Col 3, Line 7, Col 18, "This attribute is not valid for use on this language element") + (Warning 842, Line 10, Col 10, Line 10, Col 25, "This attribute is not valid for use on this language element") ] // SOURCE=MarshalAsAttribute.fs # MarshalAsAttribute.fs @@ -480,7 +481,7 @@ module CustomAttributes_AttributeUsage = |> verifyCompile |> shouldFail |> withDiagnostics [ - (Error 842, Line 14, Col 5, Line 14, Col 15, "This attribute is not valid for use on this language element") + (Warning 842, Line 14, Col 5, Line 14, Col 15, "This attribute is not valid for use on this language element") ] // SOURCE=E_AttributeTargetIsField03.fs # E_AttributeTargetIsField03.fs @@ -491,8 +492,8 @@ module CustomAttributes_AttributeUsage = |> verifyCompile |> shouldFail |> withDiagnostics [ - (Error 842, Line 14, Col 5, Line 14, Col 15, "This attribute is not valid for use on this language element") - (Error 842, Line 15, Col 5, Line 15, Col 25, "This attribute is not valid for use on this language element") + (Warning 842, Line 14, Col 5, Line 14, Col 15, "This attribute is not valid for use on this language element") + (Warning 842, Line 15, Col 5, Line 15, Col 25, "This attribute is not valid for use on this language element") ] // SOURCE=E_AttributeTargetIsProperty01.fs # E_AttributeTargetIsField03.fs @@ -511,8 +512,8 @@ module CustomAttributes_AttributeUsage = |> verifyCompile |> shouldFail |> withDiagnostics [ - (Error 842, Line 14, Col 5, Line 14, Col 18, "This attribute is not valid for use on this language element") - (Error 842, Line 15, Col 5, Line 15, Col 25, "This attribute is not valid for use on this language element") + (Warning 842, Line 14, Col 5, Line 14, Col 18, "This attribute is not valid for use on this language element") + (Warning 842, Line 15, Col 5, Line 15, Col 25, "This attribute is not valid for use on this language element") ] // SOURCE=E_AttributeTargetIsCtor01.fs # E_AttributeTargetIsCtor01.fs @@ -531,10 +532,10 @@ module CustomAttributes_AttributeUsage = |> verifyCompile |> shouldFail |> withDiagnostics [ - (Error 842, Line 9, Col 15, Line 9, Col 27, "This attribute is not valid for use on this language element") - (Error 842, Line 11, Col 16, Line 11, Col 28, "This attribute is not valid for use on this language element") - (Error 842, Line 14, Col 15, Line 14, Col 27, "This attribute is not valid for use on this language element") - (Error 842, Line 17, Col 16, Line 17, Col 28, "This attribute is not valid for use on this language element") + (Warning 842, Line 9, Col 15, Line 9, Col 27, "This attribute is not valid for use on this language element") + (Warning 842, Line 11, Col 16, Line 11, Col 28, "This attribute is not valid for use on this language element") + (Warning 842, Line 14, Col 15, Line 14, Col 27, "This attribute is not valid for use on this language element") + (Warning 842, Line 17, Col 16, Line 17, Col 28, "This attribute is not valid for use on this language element") ] // SOURCE=AttributeTargetsIsEnum01.fs # AttributeTargetsIsEnum01.fs @@ -568,10 +569,10 @@ module CustomAttributes_AttributeUsage = |> verifyCompile |> shouldFail |> withDiagnostics [ - (Error 842, Line 19, Col 3, Line 19, Col 15, "This attribute is not valid for use on this language element") - (Error 842, Line 20, Col 3, Line 20, Col 14, "This attribute is not valid for use on this language element") - (Error 842, Line 21, Col 3, Line 21, Col 18, "This attribute is not valid for use on this language element") - (Error 842, Line 22, Col 3, Line 22, Col 17, "This attribute is not valid for use on this language element") + (Warning 842, Line 19, Col 3, Line 19, Col 15, "This attribute is not valid for use on this language element") + (Warning 842, Line 20, Col 3, Line 20, Col 14, "This attribute is not valid for use on this language element") + (Warning 842, Line 21, Col 3, Line 21, Col 18, "This attribute is not valid for use on this language element") + (Warning 842, Line 22, Col 3, Line 22, Col 17, "This attribute is not valid for use on this language element") ] // SOURCE=AttributeTargetsIsDelegate01.fs # AttributeTargetsIsDelegate01.fs @@ -605,10 +606,10 @@ module CustomAttributes_AttributeUsage = |> verifyCompile |> shouldFail |> withDiagnostics [ - (Error 842, Line 19, Col 3, Line 19, Col 14, "This attribute is not valid for use on this language element") - (Error 842, Line 20, Col 3, Line 20, Col 15, "This attribute is not valid for use on this language element") - (Error 842, Line 21, Col 3, Line 21, Col 18, "This attribute is not valid for use on this language element") - (Error 842, Line 22, Col 3, Line 22, Col 13, "This attribute is not valid for use on this language element") + (Warning 842, Line 19, Col 3, Line 19, Col 14, "This attribute is not valid for use on this language element") + (Warning 842, Line 20, Col 3, Line 20, Col 15, "This attribute is not valid for use on this language element") + (Warning 842, Line 21, Col 3, Line 21, Col 18, "This attribute is not valid for use on this language element") + (Warning 842, Line 22, Col 3, Line 22, Col 13, "This attribute is not valid for use on this language element") ] [] @@ -654,10 +655,10 @@ type InterruptibleLazy<'T> private (valueFactory: unit -> 'T) = |> verifyCompile |> shouldFail |> withDiagnostics [ - (Error 842, Line 11, Col 3, Line 11, Col 14, "This attribute is not valid for use on this language element") - (Error 842, Line 14, Col 3, Line 14, Col 15, "This attribute is not valid for use on this language element") - (Error 842, Line 18, Col 3, Line 18, Col 14, "This attribute is not valid for use on this language element") - (Error 842, Line 19, Col 3, Line 19, Col 15, "This attribute is not valid for use on this language element") + (Warning 842, Line 11, Col 3, Line 11, Col 14, "This attribute is not valid for use on this language element") + (Warning 842, Line 14, Col 3, Line 14, Col 15, "This attribute is not valid for use on this language element") + (Warning 842, Line 18, Col 3, Line 18, Col 14, "This attribute is not valid for use on this language element") + (Warning 842, Line 19, Col 3, Line 19, Col 15, "This attribute is not valid for use on this language element") ] // SOURCE= E_AttributeTargetIsClass02.fs # E_AttributeTargetIsClass02.fs @@ -676,18 +677,18 @@ type InterruptibleLazy<'T> private (valueFactory: unit -> 'T) = |> verifyCompile |> shouldFail |> withDiagnostics [ - (Error 842, Line 15, Col 3, Line 15, Col 18, "This attribute is not valid for use on this language element"); - (Error 842, Line 16, Col 3, Line 16, Col 15, "This attribute is not valid for use on this language element") - (Error 842, Line 20, Col 3, Line 20, Col 14, "This attribute is not valid for use on this language element") - (Error 842, Line 21, Col 3, Line 21, Col 18, "This attribute is not valid for use on this language element") - (Error 842, Line 26, Col 3, Line 26, Col 14, "This attribute is not valid for use on this language element") - (Error 842, Line 27, Col 3, Line 27, Col 18, "This attribute is not valid for use on this language element") - (Error 842, Line 34, Col 3, Line 34, Col 14, "This attribute is not valid for use on this language element") - (Error 842, Line 35, Col 3, Line 35, Col 18, "This attribute is not valid for use on this language element") - (Error 842, Line 43, Col 3, Line 43, Col 18, "This attribute is not valid for use on this language element") - (Error 842, Line 44, Col 3, Line 44, Col 15, "This attribute is not valid for use on this language element") - (Error 842, Line 47, Col 3, Line 47, Col 14, "This attribute is not valid for use on this language element") - (Error 842, Line 48, Col 3, Line 48, Col 18, "This attribute is not valid for use on this language element") + (Warning 842, Line 15, Col 3, Line 15, Col 18, "This attribute is not valid for use on this language element"); + (Warning 842, Line 16, Col 3, Line 16, Col 15, "This attribute is not valid for use on this language element") + (Warning 842, Line 20, Col 3, Line 20, Col 14, "This attribute is not valid for use on this language element") + (Warning 842, Line 21, Col 3, Line 21, Col 18, "This attribute is not valid for use on this language element") + (Warning 842, Line 26, Col 3, Line 26, Col 14, "This attribute is not valid for use on this language element") + (Warning 842, Line 27, Col 3, Line 27, Col 18, "This attribute is not valid for use on this language element") + (Warning 842, Line 34, Col 3, Line 34, Col 14, "This attribute is not valid for use on this language element") + (Warning 842, Line 35, Col 3, Line 35, Col 18, "This attribute is not valid for use on this language element") + (Warning 842, Line 43, Col 3, Line 43, Col 18, "This attribute is not valid for use on this language element") + (Warning 842, Line 44, Col 3, Line 44, Col 15, "This attribute is not valid for use on this language element") + (Warning 842, Line 47, Col 3, Line 47, Col 14, "This attribute is not valid for use on this language element") + (Warning 842, Line 48, Col 3, Line 48, Col 18, "This attribute is not valid for use on this language element") ] // SOURCE= CLIMutableAttribute01.fs # CLIMutableAttribute01.fs @@ -756,8 +757,8 @@ type InterruptibleLazy<'T> private (valueFactory: unit -> 'T) = (Error 934, Line 33, Col 10, Line 33, Col 11, "Records, union, abbreviations and struct types cannot have the 'AllowNullLiteral' attribute") (Error 934, Line 36, Col 10, Line 36, Col 11, "Records, union, abbreviations and struct types cannot have the 'AllowNullLiteral' attribute") (Error 934, Line 39, Col 10, Line 39, Col 13, "Records, union, abbreviations and struct types cannot have the 'AllowNullLiteral' attribute") - (Error 842, Line 41, Col 7, Line 41, Col 23, "This attribute is not valid for use on this language element") - (Error 842, Line 44, Col 7, Line 44, Col 23, "This attribute is not valid for use on this language element") + (Warning 842, Line 41, Col 7, Line 41, Col 23, "This attribute is not valid for use on this language element") + (Warning 842, Line 44, Col 7, Line 44, Col 23, "This attribute is not valid for use on this language element") (Error 935, Line 54, Col 10, Line 54, Col 11, "Types with the 'AllowNullLiteral' attribute may only inherit from or implement types which also allow the use of the null literal") ] @@ -775,8 +776,8 @@ type InterruptibleLazy<'T> private (valueFactory: unit -> 'T) = (Error 934, Line 33, Col 10, Line 33, Col 11, "Records, union, abbreviations and struct types cannot have the 'AllowNullLiteral' attribute") (Error 934, Line 36, Col 10, Line 36, Col 11, "Records, union, abbreviations and struct types cannot have the 'AllowNullLiteral' attribute") (Error 934, Line 39, Col 10, Line 39, Col 13, "Records, union, abbreviations and struct types cannot have the 'AllowNullLiteral' attribute") - (Error 842, Line 41, Col 7, Line 41, Col 23, "This attribute is not valid for use on this language element") - (Error 842, Line 44, Col 7, Line 44, Col 23, "This attribute is not valid for use on this language element") + (Warning 842, Line 41, Col 7, Line 41, Col 23, "This attribute is not valid for use on this language element") + (Warning 842, Line 44, Col 7, Line 44, Col 23, "This attribute is not valid for use on this language element") (Error 935, Line 54, Col 10, Line 54, Col 11, "Types with the 'AllowNullLiteral' attribute may only inherit from or implement types which also allow the use of the null literal") ] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/Basic.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/Basic.fs index 1e3c99dc8a5..44ee388af9d 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/Basic.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/Basic/Basic.fs @@ -61,7 +61,7 @@ module CustomAttributes_Basic = |> verifyCompile |> shouldFail |> withDiagnostics [ - (Error 842, Line 15, Col 7, Line 15, Col 17, "This attribute is not valid for use on this language element") + (Warning 842, Line 15, Col 7, Line 15, Col 17, "This attribute is not valid for use on this language element") ] // SOURCE=E_AttributeApplication04.fs SCFLAGS="--test:ErrorRanges" # E_AttributeApplication04.fs @@ -71,7 +71,7 @@ module CustomAttributes_Basic = |> verifyCompile |> shouldFail |> withDiagnostics [ - (Error 842, Line 14, Col 3, Line 14, Col 13, "This attribute is not valid for use on this language element") + (Warning 842, Line 14, Col 3, Line 14, Col 13, "This attribute is not valid for use on this language element") ] // SOURCE=E_AttributeApplication05.fs SCFLAGS="--test:ErrorRanges" # E_AttributeApplication05.fs @@ -81,7 +81,8 @@ module CustomAttributes_Basic = |> verifyCompile |> shouldFail |> withDiagnostics [ - (Error 842, Line 8, Col 7, Line 8, Col 8, "This attribute is not valid for use on this language element") + (Warning 842, Line 8, Col 7, Line 8, Col 8, "This attribute is not valid for use on this language element") + (Error 824, Line 8, Col 7, Line 8, Col 8, "Attributes are not permitted on 'let' bindings in expressions") (Warning 20, Line 8, Col 1, Line 8, Col 31, "The result of this expression has type 'int' and is implicitly ignored. Consider using 'ignore' to discard this value explicitly, e.g. 'expr |> ignore', or 'let' to bind the result to a name, e.g. 'let result = expr'.") ] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/EntryPoint.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/EntryPoint.fs index ce51bcf6c14..38b84fb6498 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/EntryPoint.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/EntryPoint/EntryPoint.fs @@ -75,7 +75,7 @@ module EntryPoint = |> compile |> shouldFail |> withDiagnostics [ - (Error 842, Line 9, Col 3, Line 9, Col 13, """This attribute is not valid for use on this language element""") + (Warning 842, Line 9, Col 3, Line 9, Col 13, """This attribute is not valid for use on this language element""") ] // SOURCE=E_twoattributesonsamefunction001.fs SCFLAGS="--test:ErrorRanges" # E_twoattributesonsamefunction001.fs diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/Basic.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/Basic.fs index c0a19c9ad3e..b59d28cbdd2 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/Basic.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/Basic.fs @@ -53,9 +53,9 @@ module LetBindings_Basic = |> shouldFail |> withDiagnostics [ (Error 683, Line 14, Col 6, Line 14, Col 27, "Attributes are not allowed within patterns") - (Error 842, Line 14, Col 8, Line 14, Col 25, "This attribute is not valid for use on this language element") + (Warning 842, Line 14, Col 8, Line 14, Col 25, "This attribute is not valid for use on this language element") (Error 683, Line 14, Col 42, Line 14, Col 63, "Attributes are not allowed within patterns") - (Error 842, Line 14, Col 44, Line 14, Col 61, "This attribute is not valid for use on this language element") + (Warning 842, Line 14, Col 44, Line 14, Col 61, "This attribute is not valid for use on this language element") ] // SOURCE=E_ErrorsForInlineValue.fs SCFLAGS="--test:ErrorRanges" # E_ErrorsForInlineValue.fs diff --git a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/TailCallAttribute.fs b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/TailCallAttribute.fs index 1b68505ab1e..81ce04fc05a 100644 --- a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/TailCallAttribute.fs +++ b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/TailCallAttribute.fs @@ -245,7 +245,7 @@ namespace N [] let ``Warn successfully for invalid tailcalls in type methods`` () = - """ + FSharp """ namespace N module M = @@ -261,29 +261,12 @@ namespace N printfn "M2 called" this.M1() + 2 // should warn """ - |> FSharp |> withLangVersion80 |> compile |> shouldFail - |> withResults [ - { Error = Warning 3569 - Range = { StartLine = 10 - StartColumn = 17 - EndLine = 10 - EndColumn = 26 } - Message = - "The member or function 'M2' has the 'TailCallAttribute' attribute, but is not being used in a tail recursive way." } - { Error = Warning 3569 - Range = { StartLine = 15 - StartColumn = 17 - EndLine = 15 - EndColumn = 26 } - Message = -#if Debug - "The member or function 'M2' has the 'TailCallAttribute' attribute, but is not being used in a tail recursive way." } -#else - "The member or function 'M1' has the 'TailCallAttribute' attribute, but is not being used in a tail recursive way." } -#endif + |> withDiagnostics [ + (Warning 3569, Line 10, Col 17, Line 10, Col 26, "The member or function 'M2' has the 'TailCallAttribute' attribute, but is not being used in a tail recursive way."); + (Warning 3569, Line 15, Col 17, Line 15, Col 26, "The member or function 'M1' has the 'TailCallAttribute' attribute, but is not being used in a tail recursive way.") ] [] @@ -1481,7 +1464,10 @@ namespace N |> withLangVersionPreview |> compile |> shouldFail - |> withSingleDiagnostic (Error 842, Line 6, Col 11, Line 6, Col 19, "This attribute is not valid for use on this language element") + |> withDiagnostics [ + (Warning 842, Line 6, Col 11, Line 6, Col 19, "This attribute is not valid for use on this language element") + (Warning 3861, Line 7, Col 13, Line 7, Col 18, "The TailCall attribute should only be applied to recursive functions.") + ] [] let ``Error about attribute on recursive let-bound value`` () = @@ -1497,7 +1483,7 @@ namespace N |> withLangVersionPreview |> compile |> shouldFail - |> withSingleDiagnostic (Error 842, Line 6, Col 11, Line 6, Col 19, "This attribute is not valid for use on this language element") + |> withSingleDiagnostic (Warning 842, Line 6, Col 11, Line 6, Col 19, "This attribute is not valid for use on this language element") [] let ``Warn about self-defined attribute`` () = // is the analysis available for users of older FSharp.Core versions From 55507e9e7e98e640678932f96a25cb3bacc82904 Mon Sep 17 00:00:00 2001 From: Edgar Gonzalez Date: Wed, 23 Apr 2025 15:39:04 +0100 Subject: [PATCH 02/24] release notes --- docs/release-notes/.FSharp.Compiler.Service/9.0.300.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/release-notes/.FSharp.Compiler.Service/9.0.300.md b/docs/release-notes/.FSharp.Compiler.Service/9.0.300.md index 16f5721e22a..05e15a667dd 100644 --- a/docs/release-notes/.FSharp.Compiler.Service/9.0.300.md +++ b/docs/release-notes/.FSharp.Compiler.Service/9.0.300.md @@ -48,6 +48,7 @@ * Warning for "useless null handling" works with piped syntax constructs now ([PR #18331](https://github.com/dotnet/fsharp/pull/18331)) * Make indent in generated overridden member code depend on the context, not fix to 4. ([PR #18341](https://github.com/dotnet/fsharp/pull/18341)) * Adjust caller info attribute error message range ([PR #18388](https://github.com/dotnet/fsharp/pull/18388)) +* Make attribute targets mismatch a warning and not an error ([PR #18492](https://github.com/dotnet/fsharp/pull/18492)) ### Breaking Changes * Struct unions with overlapping fields now generate mappings needed for reading via reflection ([Issue #18121](https://github.com/dotnet/fsharp/issues/17797), [PR #18274](https://github.com/dotnet/fsharp/pull/17877)) From 17380183feebe6a1cf30a8f678965b6cd689de82 Mon Sep 17 00:00:00 2001 From: Edgar Gonzalez Date: Wed, 23 Apr 2025 16:19:59 +0100 Subject: [PATCH 03/24] update tests --- .../PatternMatchCompilationTests.fs | 1 + .../Language/StructActivePatternTests.fs | 2 +- tests/fsharp/typecheck/sigs/neg16.bsl | 4 +- tests/fsharp/typecheck/sigs/neg20.bsl | 46 +++++++++---------- tests/fsharp/typecheck/sigs/neg32.bsl | 2 +- .../fsharp/typecheck/sigs/version50/neg20.bsl | 46 +++++++++---------- .../UnitsOfMeasure/WithOOP/E_GenericUOM01.fs | 2 +- 7 files changed, 52 insertions(+), 51 deletions(-) diff --git a/tests/FSharp.Compiler.Service.Tests/PatternMatchCompilationTests.fs b/tests/FSharp.Compiler.Service.Tests/PatternMatchCompilationTests.fs index 1b6d54d3577..cf870698077 100644 --- a/tests/FSharp.Compiler.Service.Tests/PatternMatchCompilationTests.fs +++ b/tests/FSharp.Compiler.Service.Tests/PatternMatchCompilationTests.fs @@ -41,6 +41,7 @@ match () with dumpDiagnostics checkResults |> shouldEqual [ "(3,2--3,25): Attributes are not allowed within patterns" "(3,4--3,23): This attribute is not valid for use on this language element" + "(3,17--3,22): This is not a valid constant expression or custom attribute value" ] diff --git a/tests/fsharp/Compiler/Language/StructActivePatternTests.fs b/tests/fsharp/Compiler/Language/StructActivePatternTests.fs index aac654f549c..4c2451142fa 100644 --- a/tests/fsharp/Compiler/Language/StructActivePatternTests.fs +++ b/tests/fsharp/Compiler/Language/StructActivePatternTests.fs @@ -176,7 +176,7 @@ let (|Foo|_|) x = ValueNone [] let (|Foo|_|) x = ValueNone """ - [|(FSharpDiagnosticSeverity.Error, 842, (2, 3, 2, 9), + [|(FSharpDiagnosticSeverity.Warning, 842, (2, 3, 2, 9), "This attribute is not valid for use on this language element"); (FSharpDiagnosticSeverity.Error, 3350, (3, 6, 3, 13), "Feature 'Boolean-returning and return-type-directed partial active patterns' is not available in F# 8.0. Please use language version 9.0 or greater.")|] diff --git a/tests/fsharp/typecheck/sigs/neg16.bsl b/tests/fsharp/typecheck/sigs/neg16.bsl index 4c2300470f7..448ca9127be 100644 --- a/tests/fsharp/typecheck/sigs/neg16.bsl +++ b/tests/fsharp/typecheck/sigs/neg16.bsl @@ -13,9 +13,9 @@ neg16.fs(44,10,44,11): typecheck error FS0934: Records, union, abbreviations and neg16.fs(47,10,47,13): typecheck error FS0934: Records, union, abbreviations and struct types cannot have the 'AllowNullLiteral' attribute -neg16.fs(49,7,49,23): typecheck error FS0842: This attribute is not valid for use on this language element +neg16.fs(49,7,49,23): typecheck warning FS0842: This attribute is not valid for use on this language element -neg16.fs(52,7,52,23): typecheck error FS0842: This attribute is not valid for use on this language element +neg16.fs(52,7,52,23): typecheck warning FS0842: This attribute is not valid for use on this language element neg16.fs(59,8,59,17): typecheck error FS0001: This expression was expected to have type 'Choice<'a,'b>' diff --git a/tests/fsharp/typecheck/sigs/neg20.bsl b/tests/fsharp/typecheck/sigs/neg20.bsl index 5229dcaacf6..28fa11b53f7 100644 --- a/tests/fsharp/typecheck/sigs/neg20.bsl +++ b/tests/fsharp/typecheck/sigs/neg20.bsl @@ -213,53 +213,53 @@ neg20.fs(190,34,190,39): typecheck error FS0001: This expression was expected to but here has type 'objnull' -neg20.fs(195,5,195,10): typecheck error FS0842: This attribute is not valid for use on this language element +neg20.fs(195,5,195,10): typecheck warning FS0842: This attribute is not valid for use on this language element -neg20.fs(198,5,198,11): typecheck error FS0842: This attribute is not valid for use on this language element +neg20.fs(198,5,198,11): typecheck warning FS0842: This attribute is not valid for use on this language element neg20.fs(202,7,202,9): typecheck error FS0825: The 'DefaultValue' attribute may only be used on 'val' declarations -neg20.fs(204,5,204,14): typecheck error FS0842: This attribute is not valid for use on this language element +neg20.fs(204,5,204,14): typecheck warning FS0842: This attribute is not valid for use on this language element -neg20.fs(207,5,207,11): typecheck error FS0842: This attribute is not valid for use on this language element +neg20.fs(207,5,207,11): typecheck warning FS0842: This attribute is not valid for use on this language element -neg20.fs(210,5,210,12): typecheck error FS0842: This attribute is not valid for use on this language element +neg20.fs(210,5,210,12): typecheck warning FS0842: This attribute is not valid for use on this language element -neg20.fs(213,5,213,33): typecheck error FS0842: This attribute is not valid for use on this language element +neg20.fs(213,5,213,33): typecheck warning FS0842: This attribute is not valid for use on this language element -neg20.fs(216,5,216,12): typecheck error FS0842: This attribute is not valid for use on this language element +neg20.fs(216,5,216,12): typecheck warning FS0842: This attribute is not valid for use on this language element -neg20.fs(219,5,219,15): typecheck error FS0842: This attribute is not valid for use on this language element +neg20.fs(219,5,219,15): typecheck warning FS0842: This attribute is not valid for use on this language element -neg20.fs(222,5,222,31): typecheck error FS0842: This attribute is not valid for use on this language element +neg20.fs(222,5,222,31): typecheck warning FS0842: This attribute is not valid for use on this language element -neg20.fs(225,5,225,22): typecheck error FS0842: This attribute is not valid for use on this language element +neg20.fs(225,5,225,22): typecheck warning FS0842: This attribute is not valid for use on this language element -neg20.fs(228,5,228,23): typecheck error FS0842: This attribute is not valid for use on this language element +neg20.fs(228,5,228,23): typecheck warning FS0842: This attribute is not valid for use on this language element -neg20.fs(231,5,231,21): typecheck error FS0842: This attribute is not valid for use on this language element +neg20.fs(231,5,231,21): typecheck warning FS0842: This attribute is not valid for use on this language element -neg20.fs(234,5,234,34): typecheck error FS0842: This attribute is not valid for use on this language element +neg20.fs(234,5,234,34): typecheck warning FS0842: This attribute is not valid for use on this language element -neg20.fs(237,5,237,34): typecheck error FS0842: This attribute is not valid for use on this language element +neg20.fs(237,5,237,34): typecheck warning FS0842: This attribute is not valid for use on this language element -neg20.fs(240,5,240,23): typecheck error FS0842: This attribute is not valid for use on this language element +neg20.fs(240,5,240,23): typecheck warning FS0842: This attribute is not valid for use on this language element -neg20.fs(243,5,243,23): typecheck error FS0842: This attribute is not valid for use on this language element +neg20.fs(243,5,243,23): typecheck warning FS0842: This attribute is not valid for use on this language element -neg20.fs(249,9,249,27): typecheck error FS0842: This attribute is not valid for use on this language element +neg20.fs(249,9,249,27): typecheck warning FS0842: This attribute is not valid for use on this language element -neg20.fs(255,5,255,28): typecheck error FS0842: This attribute is not valid for use on this language element +neg20.fs(255,5,255,28): typecheck warning FS0842: This attribute is not valid for use on this language element -neg20.fs(258,5,258,38): typecheck error FS0842: This attribute is not valid for use on this language element +neg20.fs(258,5,258,38): typecheck warning FS0842: This attribute is not valid for use on this language element -neg20.fs(261,5,261,17): typecheck error FS0842: This attribute is not valid for use on this language element +neg20.fs(261,5,261,17): typecheck warning FS0842: This attribute is not valid for use on this language element -neg20.fs(265,5,265,24): typecheck error FS0842: This attribute is not valid for use on this language element +neg20.fs(265,5,265,24): typecheck warning FS0842: This attribute is not valid for use on this language element -neg20.fs(268,5,268,27): typecheck error FS0842: This attribute is not valid for use on this language element +neg20.fs(268,5,268,27): typecheck warning FS0842: This attribute is not valid for use on this language element -neg20.fs(271,5,271,15): typecheck error FS0842: This attribute is not valid for use on this language element +neg20.fs(271,5,271,15): typecheck warning FS0842: This attribute is not valid for use on this language element neg20.fs(278,14,278,95): typecheck error FS0507: No accessible member or object constructor named 'ProcessStartInfo' takes 0 arguments. Note the call to this member also provides 2 named arguments. diff --git a/tests/fsharp/typecheck/sigs/neg32.bsl b/tests/fsharp/typecheck/sigs/neg32.bsl index 87fbc723312..376138c1858 100644 --- a/tests/fsharp/typecheck/sigs/neg32.bsl +++ b/tests/fsharp/typecheck/sigs/neg32.bsl @@ -1,5 +1,5 @@ -neg32.fs(17,11,17,56): typecheck error FS0842: This attribute is not valid for use on this language element +neg32.fs(17,11,17,56): typecheck warning FS0842: This attribute is not valid for use on this language element neg32.fs(24,15,24,16): typecheck error FS0043: The member or object constructor 'TryParse' does not take 1 argument(s). An overload was found taking 2 arguments. diff --git a/tests/fsharp/typecheck/sigs/version50/neg20.bsl b/tests/fsharp/typecheck/sigs/version50/neg20.bsl index 394f7777b2a..f85f1d5d14f 100644 --- a/tests/fsharp/typecheck/sigs/version50/neg20.bsl +++ b/tests/fsharp/typecheck/sigs/version50/neg20.bsl @@ -261,53 +261,53 @@ neg20.fs(190,34,190,39): typecheck error FS0001: This expression was expected to but here has type 'objnull' -neg20.fs(195,5,195,10): typecheck error FS0842: This attribute is not valid for use on this language element +neg20.fs(195,5,195,10): typecheck warning FS0842: This attribute is not valid for use on this language element -neg20.fs(198,5,198,11): typecheck error FS0842: This attribute is not valid for use on this language element +neg20.fs(198,5,198,11): typecheck warning FS0842: This attribute is not valid for use on this language element neg20.fs(202,7,202,9): typecheck error FS0825: The 'DefaultValue' attribute may only be used on 'val' declarations -neg20.fs(204,5,204,14): typecheck error FS0842: This attribute is not valid for use on this language element +neg20.fs(204,5,204,14): typecheck warning FS0842: This attribute is not valid for use on this language element -neg20.fs(207,5,207,11): typecheck error FS0842: This attribute is not valid for use on this language element +neg20.fs(207,5,207,11): typecheck warning FS0842: This attribute is not valid for use on this language element -neg20.fs(210,5,210,12): typecheck error FS0842: This attribute is not valid for use on this language element +neg20.fs(210,5,210,12): typecheck warning FS0842: This attribute is not valid for use on this language element -neg20.fs(213,5,213,33): typecheck error FS0842: This attribute is not valid for use on this language element +neg20.fs(213,5,213,33): typecheck warning FS0842: This attribute is not valid for use on this language element -neg20.fs(216,5,216,12): typecheck error FS0842: This attribute is not valid for use on this language element +neg20.fs(216,5,216,12): typecheck warning FS0842: This attribute is not valid for use on this language element -neg20.fs(219,5,219,15): typecheck error FS0842: This attribute is not valid for use on this language element +neg20.fs(219,5,219,15): typecheck warning FS0842: This attribute is not valid for use on this language element -neg20.fs(222,5,222,31): typecheck error FS0842: This attribute is not valid for use on this language element +neg20.fs(222,5,222,31): typecheck warning FS0842: This attribute is not valid for use on this language element -neg20.fs(225,5,225,22): typecheck error FS0842: This attribute is not valid for use on this language element +neg20.fs(225,5,225,22): typecheck warning FS0842: This attribute is not valid for use on this language element -neg20.fs(228,5,228,23): typecheck error FS0842: This attribute is not valid for use on this language element +neg20.fs(228,5,228,23): typecheck warning FS0842: This attribute is not valid for use on this language element -neg20.fs(231,5,231,21): typecheck error FS0842: This attribute is not valid for use on this language element +neg20.fs(231,5,231,21): typecheck warning FS0842: This attribute is not valid for use on this language element -neg20.fs(234,5,234,34): typecheck error FS0842: This attribute is not valid for use on this language element +neg20.fs(234,5,234,34): typecheck warning FS0842: This attribute is not valid for use on this language element -neg20.fs(237,5,237,34): typecheck error FS0842: This attribute is not valid for use on this language element +neg20.fs(237,5,237,34): typecheck warning FS0842: This attribute is not valid for use on this language element -neg20.fs(240,5,240,23): typecheck error FS0842: This attribute is not valid for use on this language element +neg20.fs(240,5,240,23): typecheck warning FS0842: This attribute is not valid for use on this language element -neg20.fs(243,5,243,23): typecheck error FS0842: This attribute is not valid for use on this language element +neg20.fs(243,5,243,23): typecheck warning FS0842: This attribute is not valid for use on this language element -neg20.fs(249,9,249,27): typecheck error FS0842: This attribute is not valid for use on this language element +neg20.fs(249,9,249,27): typecheck warning FS0842: This attribute is not valid for use on this language element -neg20.fs(255,5,255,28): typecheck error FS0842: This attribute is not valid for use on this language element +neg20.fs(255,5,255,28): typecheck warning FS0842: This attribute is not valid for use on this language element -neg20.fs(258,5,258,38): typecheck error FS0842: This attribute is not valid for use on this language element +neg20.fs(258,5,258,38): typecheck warning FS0842: This attribute is not valid for use on this language element -neg20.fs(261,5,261,17): typecheck error FS0842: This attribute is not valid for use on this language element +neg20.fs(261,5,261,17): typecheck warning FS0842: This attribute is not valid for use on this language element -neg20.fs(265,5,265,24): typecheck error FS0842: This attribute is not valid for use on this language element +neg20.fs(265,5,265,24): typecheck warning FS0842: This attribute is not valid for use on this language element -neg20.fs(268,5,268,27): typecheck error FS0842: This attribute is not valid for use on this language element +neg20.fs(268,5,268,27): typecheck warning FS0842: This attribute is not valid for use on this language element -neg20.fs(271,5,271,15): typecheck error FS0842: This attribute is not valid for use on this language element +neg20.fs(271,5,271,15): typecheck warning FS0842: This attribute is not valid for use on this language element neg20.fs(278,14,278,95): typecheck error FS0507: No accessible member or object constructor named 'ProcessStartInfo' takes 0 arguments. Note the call to this member also provides 2 named arguments. diff --git a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/WithOOP/E_GenericUOM01.fs b/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/WithOOP/E_GenericUOM01.fs index 369697935e3..0f27193b5a7 100644 --- a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/WithOOP/E_GenericUOM01.fs +++ b/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/WithOOP/E_GenericUOM01.fs @@ -1,7 +1,7 @@ // #Regression #Conformance #UnitsOfMeasure #ObjectOrientedTypes // Verify error when putting invalid attributes on type arguments // (We should only allow [].) -//This attribute is not valid for use on this language element +//This attribute is not valid for use on this language element open System From 6f2b7064781a2c33c254f17ffac1a31a8cd3f41e Mon Sep 17 00:00:00 2001 From: edgargonzalez Date: Tue, 29 Apr 2025 09:43:56 +0100 Subject: [PATCH 04/24] update baselines --- tests/fsharp/typecheck/sigs/neg16.bsl | 4 +- tests/fsharp/typecheck/sigs/neg20.bsl | 48 ++++++++++--------- tests/fsharp/typecheck/sigs/neg32.bsl | 4 +- .../fsharp/typecheck/sigs/version50/neg20.bsl | 48 ++++++++++--------- 4 files changed, 54 insertions(+), 50 deletions(-) diff --git a/tests/fsharp/typecheck/sigs/neg16.bsl b/tests/fsharp/typecheck/sigs/neg16.bsl index 448ca9127be..4c2300470f7 100644 --- a/tests/fsharp/typecheck/sigs/neg16.bsl +++ b/tests/fsharp/typecheck/sigs/neg16.bsl @@ -13,9 +13,9 @@ neg16.fs(44,10,44,11): typecheck error FS0934: Records, union, abbreviations and neg16.fs(47,10,47,13): typecheck error FS0934: Records, union, abbreviations and struct types cannot have the 'AllowNullLiteral' attribute -neg16.fs(49,7,49,23): typecheck warning FS0842: This attribute is not valid for use on this language element +neg16.fs(49,7,49,23): typecheck error FS0842: This attribute is not valid for use on this language element -neg16.fs(52,7,52,23): typecheck warning FS0842: This attribute is not valid for use on this language element +neg16.fs(52,7,52,23): typecheck error FS0842: This attribute is not valid for use on this language element neg16.fs(59,8,59,17): typecheck error FS0001: This expression was expected to have type 'Choice<'a,'b>' diff --git a/tests/fsharp/typecheck/sigs/neg20.bsl b/tests/fsharp/typecheck/sigs/neg20.bsl index 28fa11b53f7..2ff8515a78a 100644 --- a/tests/fsharp/typecheck/sigs/neg20.bsl +++ b/tests/fsharp/typecheck/sigs/neg20.bsl @@ -213,53 +213,53 @@ neg20.fs(190,34,190,39): typecheck error FS0001: This expression was expected to but here has type 'objnull' -neg20.fs(195,5,195,10): typecheck warning FS0842: This attribute is not valid for use on this language element +neg20.fs(195,5,195,10): typecheck error FS0842: This attribute is not valid for use on this language element -neg20.fs(198,5,198,11): typecheck warning FS0842: This attribute is not valid for use on this language element +neg20.fs(198,5,198,11): typecheck error FS0842: This attribute is not valid for use on this language element neg20.fs(202,7,202,9): typecheck error FS0825: The 'DefaultValue' attribute may only be used on 'val' declarations -neg20.fs(204,5,204,14): typecheck warning FS0842: This attribute is not valid for use on this language element +neg20.fs(204,5,204,14): typecheck error FS0842: This attribute is not valid for use on this language element -neg20.fs(207,5,207,11): typecheck warning FS0842: This attribute is not valid for use on this language element +neg20.fs(207,5,207,11): typecheck error FS0842: This attribute is not valid for use on this language element -neg20.fs(210,5,210,12): typecheck warning FS0842: This attribute is not valid for use on this language element +neg20.fs(210,5,210,12): typecheck error FS0842: This attribute is not valid for use on this language element -neg20.fs(213,5,213,33): typecheck warning FS0842: This attribute is not valid for use on this language element +neg20.fs(213,5,213,33): typecheck error FS0842: This attribute is not valid for use on this language element -neg20.fs(216,5,216,12): typecheck warning FS0842: This attribute is not valid for use on this language element +neg20.fs(216,5,216,12): typecheck error FS0842: This attribute is not valid for use on this language element -neg20.fs(219,5,219,15): typecheck warning FS0842: This attribute is not valid for use on this language element +neg20.fs(219,5,219,15): typecheck error FS0842: This attribute is not valid for use on this language element -neg20.fs(222,5,222,31): typecheck warning FS0842: This attribute is not valid for use on this language element +neg20.fs(222,5,222,31): typecheck error FS0842: This attribute is not valid for use on this language element -neg20.fs(225,5,225,22): typecheck warning FS0842: This attribute is not valid for use on this language element +neg20.fs(225,5,225,22): typecheck error FS0842: This attribute is not valid for use on this language element -neg20.fs(228,5,228,23): typecheck warning FS0842: This attribute is not valid for use on this language element +neg20.fs(228,5,228,23): typecheck error FS0842: This attribute is not valid for use on this language element -neg20.fs(231,5,231,21): typecheck warning FS0842: This attribute is not valid for use on this language element +neg20.fs(231,5,231,21): typecheck error FS0842: This attribute is not valid for use on this language element -neg20.fs(234,5,234,34): typecheck warning FS0842: This attribute is not valid for use on this language element +neg20.fs(234,5,234,34): typecheck error FS0842: This attribute is not valid for use on this language element -neg20.fs(237,5,237,34): typecheck warning FS0842: This attribute is not valid for use on this language element +neg20.fs(237,5,237,34): typecheck error FS0842: This attribute is not valid for use on this language element -neg20.fs(240,5,240,23): typecheck warning FS0842: This attribute is not valid for use on this language element +neg20.fs(240,5,240,23): typecheck error FS0842: This attribute is not valid for use on this language element -neg20.fs(243,5,243,23): typecheck warning FS0842: This attribute is not valid for use on this language element +neg20.fs(243,5,243,23): typecheck error FS0842: This attribute is not valid for use on this language element -neg20.fs(249,9,249,27): typecheck warning FS0842: This attribute is not valid for use on this language element +neg20.fs(249,9,249,27): typecheck error FS0842: This attribute is not valid for use on this language element -neg20.fs(255,5,255,28): typecheck warning FS0842: This attribute is not valid for use on this language element +neg20.fs(255,5,255,28): typecheck error FS0842: This attribute is not valid for use on this language element -neg20.fs(258,5,258,38): typecheck warning FS0842: This attribute is not valid for use on this language element +neg20.fs(258,5,258,38): typecheck error FS0842: This attribute is not valid for use on this language element -neg20.fs(261,5,261,17): typecheck warning FS0842: This attribute is not valid for use on this language element +neg20.fs(261,5,261,17): typecheck error FS0842: This attribute is not valid for use on this language element -neg20.fs(265,5,265,24): typecheck warning FS0842: This attribute is not valid for use on this language element +neg20.fs(265,5,265,24): typecheck error FS0842: This attribute is not valid for use on this language element -neg20.fs(268,5,268,27): typecheck warning FS0842: This attribute is not valid for use on this language element +neg20.fs(268,5,268,27): typecheck error FS0842: This attribute is not valid for use on this language element -neg20.fs(271,5,271,15): typecheck warning FS0842: This attribute is not valid for use on this language element +neg20.fs(271,5,271,15): typecheck error FS0842: This attribute is not valid for use on this language element neg20.fs(278,14,278,95): typecheck error FS0507: No accessible member or object constructor named 'ProcessStartInfo' takes 0 arguments. Note the call to this member also provides 2 named arguments. @@ -294,6 +294,7 @@ neg20.fs(335,11,335,24): typecheck error FS0041: A unique overload for method 'S Known type of argument: 'a0 Candidates: + - System.String(value: System.ReadOnlySpan) : System.String - System.String(value: char array) : System.String - System.String(value: nativeptr) : System.String - System.String(value: nativeptr) : System.String @@ -303,6 +304,7 @@ neg20.fs(336,11,336,22): typecheck error FS0041: A unique overload for method 'G Known type of argument: 'a0 Candidates: + - System.Guid(b: System.ReadOnlySpan) : System.Guid - System.Guid(b: byte array) : System.Guid - System.Guid(g: string) : System.Guid diff --git a/tests/fsharp/typecheck/sigs/neg32.bsl b/tests/fsharp/typecheck/sigs/neg32.bsl index 376138c1858..7649c0719b5 100644 --- a/tests/fsharp/typecheck/sigs/neg32.bsl +++ b/tests/fsharp/typecheck/sigs/neg32.bsl @@ -1,7 +1,7 @@ -neg32.fs(17,11,17,56): typecheck warning FS0842: This attribute is not valid for use on this language element +neg32.fs(17,11,17,56): typecheck error FS0842: This attribute is not valid for use on this language element -neg32.fs(24,15,24,16): typecheck error FS0043: The member or object constructor 'TryParse' does not take 1 argument(s). An overload was found taking 2 arguments. +neg32.fs(24,15,24,16): typecheck error FS0043: The member or object constructor 'TryParse' does not take 1 argument(s). An overload was found taking 4 arguments. neg32.fs(43,17,43,19): typecheck error FS0039: The type parameter 'T is not defined. diff --git a/tests/fsharp/typecheck/sigs/version50/neg20.bsl b/tests/fsharp/typecheck/sigs/version50/neg20.bsl index f85f1d5d14f..d5de8268fab 100644 --- a/tests/fsharp/typecheck/sigs/version50/neg20.bsl +++ b/tests/fsharp/typecheck/sigs/version50/neg20.bsl @@ -261,53 +261,53 @@ neg20.fs(190,34,190,39): typecheck error FS0001: This expression was expected to but here has type 'objnull' -neg20.fs(195,5,195,10): typecheck warning FS0842: This attribute is not valid for use on this language element +neg20.fs(195,5,195,10): typecheck error FS0842: This attribute is not valid for use on this language element -neg20.fs(198,5,198,11): typecheck warning FS0842: This attribute is not valid for use on this language element +neg20.fs(198,5,198,11): typecheck error FS0842: This attribute is not valid for use on this language element neg20.fs(202,7,202,9): typecheck error FS0825: The 'DefaultValue' attribute may only be used on 'val' declarations -neg20.fs(204,5,204,14): typecheck warning FS0842: This attribute is not valid for use on this language element +neg20.fs(204,5,204,14): typecheck error FS0842: This attribute is not valid for use on this language element -neg20.fs(207,5,207,11): typecheck warning FS0842: This attribute is not valid for use on this language element +neg20.fs(207,5,207,11): typecheck error FS0842: This attribute is not valid for use on this language element -neg20.fs(210,5,210,12): typecheck warning FS0842: This attribute is not valid for use on this language element +neg20.fs(210,5,210,12): typecheck error FS0842: This attribute is not valid for use on this language element -neg20.fs(213,5,213,33): typecheck warning FS0842: This attribute is not valid for use on this language element +neg20.fs(213,5,213,33): typecheck error FS0842: This attribute is not valid for use on this language element -neg20.fs(216,5,216,12): typecheck warning FS0842: This attribute is not valid for use on this language element +neg20.fs(216,5,216,12): typecheck error FS0842: This attribute is not valid for use on this language element -neg20.fs(219,5,219,15): typecheck warning FS0842: This attribute is not valid for use on this language element +neg20.fs(219,5,219,15): typecheck error FS0842: This attribute is not valid for use on this language element -neg20.fs(222,5,222,31): typecheck warning FS0842: This attribute is not valid for use on this language element +neg20.fs(222,5,222,31): typecheck error FS0842: This attribute is not valid for use on this language element -neg20.fs(225,5,225,22): typecheck warning FS0842: This attribute is not valid for use on this language element +neg20.fs(225,5,225,22): typecheck error FS0842: This attribute is not valid for use on this language element -neg20.fs(228,5,228,23): typecheck warning FS0842: This attribute is not valid for use on this language element +neg20.fs(228,5,228,23): typecheck error FS0842: This attribute is not valid for use on this language element -neg20.fs(231,5,231,21): typecheck warning FS0842: This attribute is not valid for use on this language element +neg20.fs(231,5,231,21): typecheck error FS0842: This attribute is not valid for use on this language element -neg20.fs(234,5,234,34): typecheck warning FS0842: This attribute is not valid for use on this language element +neg20.fs(234,5,234,34): typecheck error FS0842: This attribute is not valid for use on this language element -neg20.fs(237,5,237,34): typecheck warning FS0842: This attribute is not valid for use on this language element +neg20.fs(237,5,237,34): typecheck error FS0842: This attribute is not valid for use on this language element -neg20.fs(240,5,240,23): typecheck warning FS0842: This attribute is not valid for use on this language element +neg20.fs(240,5,240,23): typecheck error FS0842: This attribute is not valid for use on this language element -neg20.fs(243,5,243,23): typecheck warning FS0842: This attribute is not valid for use on this language element +neg20.fs(243,5,243,23): typecheck error FS0842: This attribute is not valid for use on this language element -neg20.fs(249,9,249,27): typecheck warning FS0842: This attribute is not valid for use on this language element +neg20.fs(249,9,249,27): typecheck error FS0842: This attribute is not valid for use on this language element -neg20.fs(255,5,255,28): typecheck warning FS0842: This attribute is not valid for use on this language element +neg20.fs(255,5,255,28): typecheck error FS0842: This attribute is not valid for use on this language element -neg20.fs(258,5,258,38): typecheck warning FS0842: This attribute is not valid for use on this language element +neg20.fs(258,5,258,38): typecheck error FS0842: This attribute is not valid for use on this language element -neg20.fs(261,5,261,17): typecheck warning FS0842: This attribute is not valid for use on this language element +neg20.fs(261,5,261,17): typecheck error FS0842: This attribute is not valid for use on this language element -neg20.fs(265,5,265,24): typecheck warning FS0842: This attribute is not valid for use on this language element +neg20.fs(265,5,265,24): typecheck error FS0842: This attribute is not valid for use on this language element -neg20.fs(268,5,268,27): typecheck warning FS0842: This attribute is not valid for use on this language element +neg20.fs(268,5,268,27): typecheck error FS0842: This attribute is not valid for use on this language element -neg20.fs(271,5,271,15): typecheck warning FS0842: This attribute is not valid for use on this language element +neg20.fs(271,5,271,15): typecheck error FS0842: This attribute is not valid for use on this language element neg20.fs(278,14,278,95): typecheck error FS0507: No accessible member or object constructor named 'ProcessStartInfo' takes 0 arguments. Note the call to this member also provides 2 named arguments. @@ -342,6 +342,7 @@ neg20.fs(335,11,335,24): typecheck error FS0041: A unique overload for method 'S Known type of argument: 'a0 Candidates: + - System.String(value: System.ReadOnlySpan) : System.String - System.String(value: char array) : System.String - System.String(value: nativeptr) : System.String - System.String(value: nativeptr) : System.String @@ -351,6 +352,7 @@ neg20.fs(336,11,336,22): typecheck error FS0041: A unique overload for method 'G Known type of argument: 'a0 Candidates: + - System.Guid(b: System.ReadOnlySpan) : System.Guid - System.Guid(b: byte array) : System.Guid - System.Guid(g: string) : System.Guid From 75d8f5ef637741991df6c15ae75d202b8412dd65 Mon Sep 17 00:00:00 2001 From: edgargonzalez Date: Tue, 29 Apr 2025 19:33:38 +0100 Subject: [PATCH 05/24] Update baselines --- tests/fsharp/typecheck/sigs/neg20.bsl | 2 -- tests/fsharp/typecheck/sigs/neg32.bsl | 2 +- tests/fsharp/typecheck/sigs/version50/neg20.bsl | 2 -- 3 files changed, 1 insertion(+), 5 deletions(-) diff --git a/tests/fsharp/typecheck/sigs/neg20.bsl b/tests/fsharp/typecheck/sigs/neg20.bsl index 2ff8515a78a..5229dcaacf6 100644 --- a/tests/fsharp/typecheck/sigs/neg20.bsl +++ b/tests/fsharp/typecheck/sigs/neg20.bsl @@ -294,7 +294,6 @@ neg20.fs(335,11,335,24): typecheck error FS0041: A unique overload for method 'S Known type of argument: 'a0 Candidates: - - System.String(value: System.ReadOnlySpan) : System.String - System.String(value: char array) : System.String - System.String(value: nativeptr) : System.String - System.String(value: nativeptr) : System.String @@ -304,7 +303,6 @@ neg20.fs(336,11,336,22): typecheck error FS0041: A unique overload for method 'G Known type of argument: 'a0 Candidates: - - System.Guid(b: System.ReadOnlySpan) : System.Guid - System.Guid(b: byte array) : System.Guid - System.Guid(g: string) : System.Guid diff --git a/tests/fsharp/typecheck/sigs/neg32.bsl b/tests/fsharp/typecheck/sigs/neg32.bsl index 7649c0719b5..87fbc723312 100644 --- a/tests/fsharp/typecheck/sigs/neg32.bsl +++ b/tests/fsharp/typecheck/sigs/neg32.bsl @@ -1,7 +1,7 @@ neg32.fs(17,11,17,56): typecheck error FS0842: This attribute is not valid for use on this language element -neg32.fs(24,15,24,16): typecheck error FS0043: The member or object constructor 'TryParse' does not take 1 argument(s). An overload was found taking 4 arguments. +neg32.fs(24,15,24,16): typecheck error FS0043: The member or object constructor 'TryParse' does not take 1 argument(s). An overload was found taking 2 arguments. neg32.fs(43,17,43,19): typecheck error FS0039: The type parameter 'T is not defined. diff --git a/tests/fsharp/typecheck/sigs/version50/neg20.bsl b/tests/fsharp/typecheck/sigs/version50/neg20.bsl index d5de8268fab..394f7777b2a 100644 --- a/tests/fsharp/typecheck/sigs/version50/neg20.bsl +++ b/tests/fsharp/typecheck/sigs/version50/neg20.bsl @@ -342,7 +342,6 @@ neg20.fs(335,11,335,24): typecheck error FS0041: A unique overload for method 'S Known type of argument: 'a0 Candidates: - - System.String(value: System.ReadOnlySpan) : System.String - System.String(value: char array) : System.String - System.String(value: nativeptr) : System.String - System.String(value: nativeptr) : System.String @@ -352,7 +351,6 @@ neg20.fs(336,11,336,22): typecheck error FS0041: A unique overload for method 'G Known type of argument: 'a0 Candidates: - - System.Guid(b: System.ReadOnlySpan) : System.Guid - System.Guid(b: byte array) : System.Guid - System.Guid(g: string) : System.Guid From 4248f2a9225b2533cb4137d1e1b4311ce9e3cad1 Mon Sep 17 00:00:00 2001 From: Edgar Gonzalez Date: Wed, 30 Apr 2025 21:58:10 +0100 Subject: [PATCH 06/24] Move attribute form logic to an AP --- .../Checking/Expressions/CheckExpressions.fs | 55 +++++++++++-------- 1 file changed, 32 insertions(+), 23 deletions(-) diff --git a/src/Compiler/Checking/Expressions/CheckExpressions.fs b/src/Compiler/Checking/Expressions/CheckExpressions.fs index e2d21975311..567e1da0310 100644 --- a/src/Compiler/Checking/Expressions/CheckExpressions.fs +++ b/src/Compiler/Checking/Expressions/CheckExpressions.fs @@ -3187,6 +3187,24 @@ let BuildRecdFieldSet g m objExpr (rfinfo: RecdFieldInfo) argExpr = let wrap, objExpr, _readonly, _writeonly = mkExprAddrOfExpr g boxity false DefinitelyMutates objExpr None m wrap (mkRecdFieldSetViaExprAddr (objExpr, rfinfo.RecdFieldRef, rfinfo.TypeInst, argExpr, m) ) +// This is used to check the target of an attribute with the form of +// Long Form: [] +// Short Form: [] +let (|LongFormAttrTarget|UnrecognizedLongAttrTarget|ShortFormAttributeTarget|) (targetIndicator: Ident option) = + match targetIndicator with + | Some id when id.idText = "assembly" -> LongFormAttrTarget AttributeTargets.Assembly + | Some id when id.idText = "module" -> LongFormAttrTarget AttributeTargets.Module + | Some id when id.idText = "return" -> LongFormAttrTarget AttributeTargets.ReturnValue + | Some id when id.idText = "field" -> LongFormAttrTarget AttributeTargets.Field + | Some id when id.idText = "property" -> LongFormAttrTarget AttributeTargets.Property + | Some id when id.idText = "method" -> LongFormAttrTarget AttributeTargets.Method + | Some id when id.idText = "param" -> LongFormAttrTarget AttributeTargets.Parameter + | Some id when id.idText = "type" -> LongFormAttrTarget AttributeTargets.TyconDecl + | Some id when id.idText = "constructor" -> LongFormAttrTarget AttributeTargets.Constructor + | Some id when id.idText = "event" -> LongFormAttrTarget AttributeTargets.Event + | Some id -> UnrecognizedLongAttrTarget id + | None -> ShortFormAttributeTarget + //------------------------------------------------------------------------- // Helpers dealing with named and optional args at callsites //------------------------------------------------------------------------- @@ -11344,27 +11362,18 @@ and TcAttributeEx canFail (cenv: cenv) (env: TcEnv) attrTgt attrEx (synAttr: Syn (validOnDefault, inheritedDefault) | _ -> (validOnDefault, inheritedDefault) - let possibleTgts = enum validOn &&& attrTgt - let directedTgts = + let attributeTargets = enum validOn &&& attrTgt + let directedTargets = match targetIndicator with - | Some id when id.idText = "assembly" -> AttributeTargets.Assembly - | Some id when id.idText = "module" -> AttributeTargets.Module - | Some id when id.idText = "return" -> AttributeTargets.ReturnValue - | Some id when id.idText = "field" -> AttributeTargets.Field - | Some id when id.idText = "property" -> AttributeTargets.Property - | Some id when id.idText = "method" -> AttributeTargets.Method - | Some id when id.idText = "param" -> AttributeTargets.Parameter - | Some id when id.idText = "type" -> AttributeTargets.TyconDecl - | Some id when id.idText = "constructor" -> AttributeTargets.Constructor - | Some id when id.idText = "event" -> AttributeTargets.Event - | Some id -> - errorR(Error(FSComp.SR.tcUnrecognizedAttributeTarget(), id.idRange)) - possibleTgts - // mask explicit targets - | _ -> possibleTgts &&& ~~~ attrEx - let constrainedTgts = possibleTgts &&& directedTgts - if constrainedTgts = enum 0 then - if (directedTgts = AttributeTargets.Assembly || directedTgts = AttributeTargets.Module) then + | LongFormAttrTarget attrTarget -> attrTarget + | UnrecognizedLongAttrTarget attrTarget -> + errorR(Error(FSComp.SR.tcUnrecognizedAttributeTarget(), attrTarget.idRange)) + attributeTargets + | ShortFormAttributeTarget -> attributeTargets &&& ~~~ attrEx + + let constrainedTargets = attributeTargets &&& directedTargets + if constrainedTargets = enum 0 then + if (directedTargets = AttributeTargets.Assembly || directedTargets = AttributeTargets.Module) then error(Error(FSComp.SR.tcAttributeIsNotValidForLanguageElementUseDo(), mAttr)) else warning(Error(FSComp.SR.tcAttributeIsNotValidForLanguageElement(), mAttr)) @@ -11428,11 +11437,11 @@ and TcAttributeEx canFail (cenv: cenv) (env: TcEnv) attrTgt attrEx (synAttr: Syn if isStruct then error (Error(FSComp.SR.tcCustomAttributeMustBeReferenceType(), m)) if args.Length <> ilMethRef.ArgTypes.Length then error (Error(FSComp.SR.tcCustomAttributeArgumentMismatch(), m)) let args = args |> List.map mkAttribExpr - Attrib(tcref, ILAttrib ilMethRef, args, namedAttribArgMap, isAppliedToGetterOrSetter, Some constrainedTgts, m) + Attrib(tcref, ILAttrib ilMethRef, args, namedAttribArgMap, isAppliedToGetterOrSetter, Some constrainedTargets, m) | Expr.App (InnerExprPat(ExprValWithPossibleTypeInst(vref, _, _, _)), _, _, args, _) -> let args = args |> List.collect (function Expr.Const (Const.Unit, _, _) -> [] | expr -> tryDestRefTupleExpr expr) |> List.map mkAttribExpr - Attrib(tcref, FSAttrib vref, args, namedAttribArgMap, isAppliedToGetterOrSetter, Some constrainedTgts, mAttr) + Attrib(tcref, FSAttrib vref, args, namedAttribArgMap, isAppliedToGetterOrSetter, Some constrainedTargets, mAttr) | _ -> error (Error(FSComp.SR.tcCustomAttributeMustInvokeConstructor(), mAttr)) @@ -11440,7 +11449,7 @@ and TcAttributeEx canFail (cenv: cenv) (env: TcEnv) attrTgt attrEx (synAttr: Syn | _ -> error(Error(FSComp.SR.tcAttributeExpressionsMustBeConstructorCalls(), mAttr)) - [ (constrainedTgts, attrib) ], false + [ (constrainedTargets, attrib) ], false and TcAttributesWithPossibleTargetsEx canFail (cenv: cenv) env attrTgt attrEx synAttribs = From 835d645b54d8a62345eae9faa805263b4afaff8b Mon Sep 17 00:00:00 2001 From: edgargonzalez Date: Tue, 5 Aug 2025 20:09:34 +0200 Subject: [PATCH 07/24] Unify let, let!, use, use! LetOrUse AST representation. --- .../Checking/CheckRecordSyntaxHelpers.fs | 2 +- .../CheckComputationExpressions.fs | 214 +++++++++++------- .../Checking/Expressions/CheckExpressions.fs | 6 +- .../Expressions/CheckExpressionsOps.fs | 6 +- .../Expressions/CheckSequenceExpressions.fs | 2 +- .../GraphChecking/FileContentMapping.fs | 15 -- .../Service/FSharpParseFileResults.fs | 9 - .../Service/ServiceInterfaceStubGenerator.fs | 9 - src/Compiler/Service/ServiceParseTreeWalk.fs | 14 -- src/Compiler/Service/ServiceParsedInputOps.fs | 19 -- src/Compiler/Service/ServiceStructure.fs | 19 -- src/Compiler/Service/SynExpr.fs | 5 +- src/Compiler/Service/SynPat.fs | 9 +- src/Compiler/SyntaxTree/ParseHelpers.fs | 46 +++- src/Compiler/SyntaxTree/ParseHelpers.fsi | 2 +- src/Compiler/SyntaxTree/SyntaxTree.fs | 12 +- src/Compiler/SyntaxTree/SyntaxTree.fsi | 18 +- src/Compiler/SyntaxTree/SyntaxTreeOps.fs | 10 - ...ervice.SurfaceArea.netstandard20.debug.bsl | 6 +- ...vice.SurfaceArea.netstandard20.release.bsl | 6 +- .../Binding/InlineKeywordInBinding.fs.bsl | 2 +- ...ignShouldBePresentInLocalLetBinding.fs.bsl | 2 +- ...ouldBePresentInLocalLetBindingTyped.fs.bsl | 2 +- ...ldBePresentInSynExprLetOrUseBinding.fs.bsl | 2 +- ...atStartsAtAndAndEndsAfterExpression.fs.bsl | 24 +- ...geStartsAtAndAndEndsAfterExpression.fs.bsl | 24 +- ...LetOrUseContainsTheRangeOfInKeyword.fs.bsl | 4 +- ...BangContainsTheRangeOfTheEqualsSign.fs.bsl | 17 +- ...LetOrUseContainsTheRangeOfInKeyword.fs.bsl | 2 +- ...seDoesNotContainTheRangeOfInKeyword.fs.bsl | 2 +- ...rsDoesNotContainTheRangeOfInKeyword.fs.bsl | 2 +- ...eBindingContainsTheRangeOfInKeyword.fs.bsl | 2 +- .../Try with - Missing expr 04.fs.bsl | 2 +- .../LeadingKeyword/UseKeyword.fs.bsl | 2 +- .../LeadingKeyword/UseRecKeyword.fs.bsl | 2 +- .../RangeOfMultipleSynMatchClause.fs.bsl | 2 +- .../RangeOfSingleSynMatchClause.fs.bsl | 2 +- ...OfSingleSynMatchClauseFollowedByBar.fs.bsl | 2 +- .../Pattern/Typed - Missing type 05.fs.bsl | 2 +- .../Pattern/Typed - Missing type 06.fs.bsl | 2 +- .../Pattern/Typed - Missing type 09.fs.bsl | 2 +- .../Pattern/Typed - Missing type 10.fs.bsl | 2 +- .../Pattern/Typed - Missing type 11.fs.bsl | 2 +- .../Pattern/Typed - Missing type 12.fs.bsl | 2 +- ...nterpolatedStringOffsideInNestedLet.fs.bsl | 2 +- .../SynType/Typed LetBang 01.fs.bsl | 40 ++-- .../SynType/Typed LetBang 02.fs.bsl | 44 ++-- .../SynType/Typed LetBang 03.fs.bsl | 78 ++++--- .../SynType/Typed LetBang 04.fs.bsl | 2 +- .../SynType/Typed LetBang 05.fs.bsl | 77 ++++--- .../SynType/Typed LetBang 06.fs.bsl | 76 ++++--- .../SynType/Typed LetBang 07.fs.bsl | 38 ++-- .../SynType/Typed LetBang 08.fs.bsl | 36 +-- .../SynType/Typed LetBang 09.fs.bsl | 36 +-- .../SynType/Typed LetBang 10.fs.bsl | 32 ++- .../SynType/Typed LetBang 11.fs.bsl | 50 ++-- .../SynType/Typed LetBang 12.fs.bsl | 45 ++-- .../SynType/Typed LetBang 14.fs.bsl | 39 ++-- .../SynType/Typed LetBang 15.fs.bsl | 39 ++-- .../SynType/Typed LetBang 17.fs.bsl | 50 ++-- .../SynType/Typed LetBang 18.fs.bsl | 46 ++-- .../SynType/Typed LetBang 19.fs.bsl | 58 +++-- .../SynType/Typed LetBang 20.fs.bsl | 55 +++-- .../SynType/Typed LetBang AndBang 01.fs.bsl | 40 ++-- .../SynType/Typed LetBang AndBang 02.fs.bsl | 44 ++-- .../SynType/Typed LetBang AndBang 03.fs.bsl | 46 ++-- .../SynType/Typed LetBang AndBang 04.fs.bsl | 44 ++-- .../SynType/Typed LetBang AndBang 05.fs.bsl | 46 ++-- .../SynType/Typed LetBang AndBang 06.fs.bsl | 36 +-- .../SynType/Typed LetBang AndBang 07.fs.bsl | 32 ++- .../SynType/Typed LetBang AndBang 08.fs.bsl | 50 ++-- .../SynType/Typed LetBang AndBang 09.fs.bsl | 45 ++-- .../SynType/Typed LetBang AndBang 10.fs.bsl | 41 ++-- .../SynType/Typed LetBang AndBang 11.fs.bsl | 38 ++-- .../SynType/Typed LetBang AndBang 12.fs.bsl | 30 ++- .../SynType/Typed LetBang AndBang 13.fs.bsl | 53 +++-- .../SynType/Typed LetBang AndBang 14.fs.bsl | 49 ++-- .../SynType/Typed LetBang AndBang 15.fs.bsl | 62 ++--- .../SynType/Typed LetBang AndBang 16.fs.bsl | 60 +++-- .../SynType/Typed LetBang AndBang 17.fs.bsl | 60 +++-- .../SynType/Typed LetBang AndBang 18.fs.bsl | 41 ++-- .../SynType/Typed UseBang 01.fs.bsl | 40 ++-- .../SynType/Typed UseBang 02.fs.bsl | 44 ++-- .../SynType/Typed UseBang 03.fs.bsl | 77 ++++--- .../SynType/Typed UseBang 04.fs.bsl | 76 ++++--- .../SynType/Typed UseBang 05.fs.bsl | 38 ++-- 86 files changed, 1469 insertions(+), 1004 deletions(-) diff --git a/src/Compiler/Checking/CheckRecordSyntaxHelpers.fs b/src/Compiler/Checking/CheckRecordSyntaxHelpers.fs index 697e9a14623..36aec272f56 100644 --- a/src/Compiler/Checking/CheckRecordSyntaxHelpers.fs +++ b/src/Compiler/Checking/CheckRecordSyntaxHelpers.fs @@ -180,4 +180,4 @@ let BindOriginalRecdExpr (withExpr: SynExpr * BlockSeparator) mkRecdExpr = None, SynBindingTrivia.Zero) - SynExpr.LetOrUse(false, false, [ binding ], mkRecdExpr (Some withExpr), mOrigExprSynth, SynExprLetOrUseTrivia.Zero) + SynExpr.LetOrUse(false, false, false, false, [ binding ], mkRecdExpr (Some withExpr), mOrigExprSynth, SynExprLetOrUseTrivia.Zero) diff --git a/src/Compiler/Checking/Expressions/CheckComputationExpressions.fs b/src/Compiler/Checking/Expressions/CheckComputationExpressions.fs index 7f1be3d7bc9..1fd83b2fd6e 100644 --- a/src/Compiler/Checking/Expressions/CheckComputationExpressions.fs +++ b/src/Compiler/Checking/Expressions/CheckComputationExpressions.fs @@ -20,6 +20,7 @@ open FSharp.Compiler.NameResolution open FSharp.Compiler.Syntax.PrettyNaming open FSharp.Compiler.Syntax open FSharp.Compiler.SyntaxTrivia +open FSharp.Compiler.Xml open FSharp.Compiler.SyntaxTreeOps open FSharp.Compiler.Text open FSharp.Compiler.Text.Range @@ -853,29 +854,33 @@ let (|OptionalSequential|) e = [] let (|ExprAsUseBang|_|) expr = match expr with - | SynExpr.LetOrUseBang( - bindDebugPoint = spBind + | SynExpr.LetOrUse( isUse = true isFromSource = isFromSource - pat = pat - rhs = rhsExpr - andBangs = andBangs + isComputed = true + bindings = bindings body = innerComp - trivia = { LetOrUseKeyword = mBind }) -> ValueSome(spBind, isFromSource, pat, rhsExpr, andBangs, innerComp, mBind) + trivia = { LetOrUseKeyword = mBind }) -> + match bindings with + | SynBinding(debugPoint = spBind; headPat = pat; expr = rhsExpr) :: andBangs -> + ValueSome(spBind, isFromSource, pat, rhsExpr, andBangs, innerComp, mBind) + | _ -> ValueNone | _ -> ValueNone [] let (|ExprAsLetBang|_|) expr = match expr with - | SynExpr.LetOrUseBang( - bindDebugPoint = spBind + | SynExpr.LetOrUse( isUse = false isFromSource = isFromSource - pat = letPat - rhs = letRhsExpr - andBangs = andBangBindings + isComputed = true + bindings = bindings body = innerComp - trivia = { LetOrUseKeyword = mBind }) -> ValueSome(spBind, isFromSource, letPat, letRhsExpr, andBangBindings, innerComp, mBind) + trivia = { LetOrUseKeyword = mBind }) -> + match bindings with + | SynBinding(debugPoint = spBind; headPat = letPat; expr = letRhsExpr) :: andBangBindings -> + ValueSome(spBind, isFromSource, letPat, letRhsExpr, andBangBindings, innerComp, mBind) + | _ -> ValueNone | _ -> ValueNone // "cexpr; cexpr" is treated as builder.Combine(cexpr1, cexpr1) @@ -1383,19 +1388,26 @@ let rec TryTranslateComputationExpression let setCondExpr = SynExpr.Set(SynExpr.Ident idCond, SynExpr.Ident idFirst, mGuard) - let bindCondExpr = - SynExpr.LetOrUseBang( - DebugPointAtBinding.NoneAtSticky, - false, - true, - patFirst, - guardExpr, - [], - setCondExpr, - mGuard, - SynExprLetOrUseTrivia.Zero + let binding = + SynBinding( + accessibility = None, + kind = SynBindingKind.Normal, + isInline = false, + isMutable = false, + attributes = [], + xmlDoc = PreXmlDoc.Empty, + valData = SynInfo.emptySynValData, + headPat = patFirst, + returnInfo = None, + expr = guardExpr, + range = guardExpr.Range, + debugPoint = DebugPointAtBinding.NoneAtSticky, + trivia = SynBindingTrivia.Zero ) + let bindCondExpr = + SynExpr.LetOrUse(false, false, true, false, [ binding ], setCondExpr, mGuard, SynExprLetOrUseTrivia.Zero) + let whileExpr = SynExpr.While( DebugPointAtWhile.No, @@ -1411,19 +1423,26 @@ let rec TryTranslateComputationExpression mOrig ) - SynExpr.LetOrUse(false, false, [ condBinding ], whileExpr, mGuard, SynExprLetOrUseTrivia.Zero) + SynExpr.LetOrUse(false, false, false, true, [ condBinding ], whileExpr, mGuard, SynExprLetOrUseTrivia.Zero) + + let binding = + SynBinding( + accessibility = None, + kind = SynBindingKind.Normal, + isInline = false, + isMutable = false, + attributes = [], + xmlDoc = PreXmlDoc.Empty, + valData = SynInfo.emptySynValData, + headPat = patFirst, + returnInfo = None, + expr = guardExpr, + range = guardExpr.Range, + debugPoint = DebugPointAtBinding.NoneAtSticky, + trivia = SynBindingTrivia.Zero + ) - SynExpr.LetOrUseBang( - DebugPointAtBinding.NoneAtSticky, - false, - true, - patFirst, - guardExpr, - [], - body, - mGuard, - SynExprLetOrUseTrivia.Zero - ) + SynExpr.LetOrUse(false, false, true, true, [ binding ], body, mGuard, SynExprLetOrUseTrivia.Zero) TryTranslateComputationExpression ceenv CompExprTranslationPass.Initial q varSpace rewrittenWhileExpr translatedCtxt @@ -1622,23 +1641,30 @@ let rec TryTranslateComputationExpression | DebugPointAtSequential.SuppressStmt -> DebugPointAtBinding.Yes m | DebugPointAtSequential.SuppressNeither -> DebugPointAtBinding.Yes m + let binding = + SynBinding( + accessibility = None, + kind = SynBindingKind.Normal, + isInline = false, + isMutable = false, + attributes = [], + xmlDoc = PreXmlDoc.Empty, + valData = SynInfo.emptySynValData, + headPat = SynPat.Const(SynConst.Unit, rhsExpr.Range), + returnInfo = None, + expr = rhsExpr, + range = rhsExpr.Range, + debugPoint = sp, + trivia = SynBindingTrivia.Zero + ) + Some( TranslateComputationExpression ceenv CompExprTranslationPass.Initial q varSpace - (SynExpr.LetOrUseBang( - sp, - false, - true, - SynPat.Const(SynConst.Unit, rhsExpr.Range), - rhsExpr, - [], - innerComp2, - m, - SynExprLetOrUseTrivia.Zero - )) + (SynExpr.LetOrUse(false, false, true, false, [ binding ], innerComp2, m, SynExprLetOrUseTrivia.Zero)) translatedCtxt ) @@ -1706,7 +1732,7 @@ let rec TryTranslateComputationExpression ) // 'let binds in expr' - | SynExpr.LetOrUse(isRec, false, binds, innerComp, m, trivia) -> + | SynExpr.LetOrUse(isRec, false, isFromSource, isComputed, binds, innerComp, m, trivia) -> // For 'query' check immediately if ceenv.isQuery then @@ -1739,7 +1765,7 @@ let rec TryTranslateComputationExpression Some( TranslateComputationExpression ceenv CompExprTranslationPass.Initial q varSpace innerComp (fun holeFill -> - translatedCtxt (SynExpr.LetOrUse(isRec, false, binds, holeFill, m, trivia))) + translatedCtxt (SynExpr.LetOrUse(isRec, false, isFromSource, isComputed, binds, holeFill, m, trivia))) ) // 'use x = expr in expr' @@ -2383,17 +2409,24 @@ and ConsumeCustomOpClauses // Rebind using either for ... or let!.... let rebind = if maintainsVarSpaceUsingBind then - SynExpr.LetOrUseBang( - DebugPointAtBinding.NoneAtLet, - false, - false, - intoPat, - dataCompAfterOp, - [], - contExpr, - intoPat.Range, - SynExprLetOrUseTrivia.Zero - ) + let binding = + SynBinding( + accessibility = None, + kind = SynBindingKind.Normal, + isInline = false, + isMutable = false, + attributes = [], + xmlDoc = PreXmlDoc.Empty, + valData = SynInfo.emptySynValData, + headPat = intoPat, + returnInfo = None, + expr = dataCompAfterOp, + range = dataCompAfterOp.Range, + debugPoint = DebugPointAtBinding.NoneAtLet, + trivia = SynBindingTrivia.Zero + ) + + SynExpr.LetOrUse(false, false, false, false, [ binding ], contExpr, intoPat.Range, SynExprLetOrUseTrivia.Zero) else SynExpr.ForEach( DebugPointAtFor.No, @@ -2424,13 +2457,29 @@ and ConsumeCustomOpClauses // Rebind using either for ... or let!.... let rebind = if lastUsesBind then - SynExpr.LetOrUseBang( - DebugPointAtBinding.NoneAtLet, + let binding = + SynBinding( + accessibility = None, + kind = SynBindingKind.Normal, + isInline = false, + isMutable = false, + attributes = [], + xmlDoc = PreXmlDoc.Empty, + valData = SynInfo.emptySynValData, + headPat = varSpacePat, + returnInfo = None, + expr = dataCompPrior, + range = dataCompPrior.Range, + debugPoint = DebugPointAtBinding.NoneAtLet, + trivia = SynBindingTrivia.Zero + ) + + SynExpr.LetOrUse( false, false, - varSpacePat, - dataCompPrior, - [], + false, + false, + [ binding ], compClausesExpr, compClausesExpr.Range, SynExprLetOrUseTrivia.Zero @@ -2580,11 +2629,11 @@ and convertSimpleReturnToExpr (ceenv: ComputationExpressionContext<'a>) comp var | Some elseExprOpt -> Some(SynExpr.IfThenElse(guardExpr, thenExpr, elseExprOpt, spIfToThen, isRecovery, mIfToEndOfElseBranch, trivia), None) - | SynExpr.LetOrUse(isRec, false, binds, innerComp, m, trivia) -> + | SynExpr.LetOrUse(isRec, false, isFromSource, isComputed, binds, innerComp, m, trivia) -> match convertSimpleReturnToExpr ceenv comp varSpace innerComp with | None -> None | Some(_, Some _) -> None - | Some(innerExpr, None) -> Some(SynExpr.LetOrUse(isRec, false, binds, innerExpr, m, trivia), None) + | Some(innerExpr, None) -> Some(SynExpr.LetOrUse(isRec, false, isFromSource, isComputed, binds, innerExpr, m, trivia), None) | OptionalSequential(CustomOperationClause ceenv (nm, _, _, mClause, _), _) when customOperationMaintainsVarSpaceUsingBind ceenv nm -> @@ -2625,8 +2674,8 @@ and isSimpleExpr ceenv comp = && (match elseCompOpt with | None -> true | Some c -> isSimpleExpr ceenv c) - | SynExpr.LetOrUse(body = innerComp) -> isSimpleExpr ceenv innerComp - | SynExpr.LetOrUseBang _ -> false + | SynExpr.LetOrUse(isComputed = false; body = innerComp) -> isSimpleExpr ceenv innerComp + | SynExpr.LetOrUse(isComputed = true) -> false | SynExpr.Match(clauses = clauses) -> clauses |> List.forall (fun (SynMatchClause(resultExpr = innerComp)) -> isSimpleExpr ceenv innerComp) @@ -2687,17 +2736,24 @@ and TranslateComputationExpression (ceenv: ComputationExpressionContext<'a>) fir | _ -> SynExpr.YieldOrReturn((false, true), SynExpr.Const(SynConst.Unit, m), m, SynExprYieldOrReturnTrivia.Zero) let letBangBind = - SynExpr.LetOrUseBang( - DebugPointAtBinding.NoneAtDo, - false, - false, - SynPat.Const(SynConst.Unit, mUnit), - rhsExpr, - [], - bodyExpr, - m, - SynExprLetOrUseTrivia.Zero - ) + let binding = + SynBinding( + accessibility = None, + kind = SynBindingKind.Normal, + isInline = false, + isMutable = false, + attributes = [], + xmlDoc = PreXmlDoc.Empty, + valData = SynInfo.emptySynValData, + headPat = SynPat.Const(SynConst.Unit, mUnit), + returnInfo = None, + expr = rhsExpr, + range = rhsExpr.Range, + debugPoint = DebugPointAtBinding.NoneAtDo, + trivia = SynBindingTrivia.Zero + ) + + SynExpr.LetOrUse(false, false, false, true, [ binding ], bodyExpr, m, SynExprLetOrUseTrivia.Zero) TranslateComputationExpression ceenv CompExprTranslationPass.Initial q varSpace letBangBind translatedCtxt diff --git a/src/Compiler/Checking/Expressions/CheckExpressions.fs b/src/Compiler/Checking/Expressions/CheckExpressions.fs index 1d191d77fd7..23ce68b1241 100644 --- a/src/Compiler/Checking/Expressions/CheckExpressions.fs +++ b/src/Compiler/Checking/Expressions/CheckExpressions.fs @@ -6072,7 +6072,7 @@ and TcExprUndelayed (cenv: cenv) (overallTy: OverallTy) env tpenv (synExpr: SynE | SynExpr.DoBang (trivia = { DoBangKeyword = m }) | SynExpr.MatchBang (trivia = { MatchBangKeyword = m }) | SynExpr.WhileBang (range = m) - | SynExpr.LetOrUseBang (trivia = { LetOrUseKeyword = m }) -> + | SynExpr.LetOrUse (isComputed = true; trivia = { LetOrUseKeyword = m }) -> error(Error(FSComp.SR.tcConstructRequiresComputationExpression(), m)) | SynExpr.IndexFromEnd (rightExpr, m) -> @@ -9199,7 +9199,7 @@ and TcImplicitOpItemThen (cenv: cenv) overallTy env id sln tpenv mItem delayed = | SynExpr.YieldOrReturn _ | SynExpr.YieldOrReturnFrom _ | SynExpr.MatchBang _ - | SynExpr.LetOrUseBang _ + | SynExpr.LetOrUse (isComputed = true) | SynExpr.DoBang _ | SynExpr.WhileBang _ | SynExpr.TraitCall _ @@ -10614,7 +10614,7 @@ and TcLinearExprs bodyChecker cenv env overallTy tpenv isCompExpr synExpr cont = TcLinearExprs bodyChecker cenv env2 overallTy tpenv isCompExpr expr2 (fun (expr2R, tpenv) -> cont (Expr.Sequential (expr1R, expr2R, NormalSeq, m), tpenv)) - | SynExpr.LetOrUse (isRec, isUse, binds, body, m, _) when not (isUse && isCompExpr) -> + | SynExpr.LetOrUse (isRec, isUse, _, _, binds, body, m, _) when not (isUse && isCompExpr) -> if isRec then // TcLinearExprs processes at most one recursive binding, this is not tailcalling CheckRecursiveBindingIds binds diff --git a/src/Compiler/Checking/Expressions/CheckExpressionsOps.fs b/src/Compiler/Checking/Expressions/CheckExpressionsOps.fs index 7f5ff2f9f64..636352fb142 100644 --- a/src/Compiler/Checking/Expressions/CheckExpressionsOps.fs +++ b/src/Compiler/Checking/Expressions/CheckExpressionsOps.fs @@ -202,9 +202,6 @@ let YieldFree (cenv: TcFileState) expr = | SynExpr.While(doExpr = body) | SynExpr.WhileBang(doExpr = body) | SynExpr.ForEach(bodyExpr = body) -> YieldFree body - - | SynExpr.LetOrUseBang(body = body) -> YieldFree body - | SynExpr.YieldOrReturn(flags = (true, _)) -> false | _ -> true @@ -232,7 +229,7 @@ let YieldFree (cenv: TcFileState) expr = | SynExpr.WhileBang(doExpr = body) | SynExpr.ForEach(bodyExpr = body) -> YieldFree body - | SynExpr.LetOrUseBang _ + | SynExpr.LetOrUse(isComputed = true) | SynExpr.YieldOrReturnFrom _ | SynExpr.YieldOrReturn _ | SynExpr.ImplicitZero _ @@ -256,7 +253,6 @@ let inline IsSimpleSemicolonSequenceElement expr cenv acceptDeprecated = | SynExpr.LetOrUse _ | SynExpr.Do _ | SynExpr.MatchBang _ - | SynExpr.LetOrUseBang _ | SynExpr.While _ | SynExpr.WhileBang _ -> false | _ -> true diff --git a/src/Compiler/Checking/Expressions/CheckSequenceExpressions.fs b/src/Compiler/Checking/Expressions/CheckSequenceExpressions.fs index 499ed2ca914..3990ce96571 100644 --- a/src/Compiler/Checking/Expressions/CheckSequenceExpressions.fs +++ b/src/Compiler/Checking/Expressions/CheckSequenceExpressions.fs @@ -263,7 +263,7 @@ let TcSequenceExpression (cenv: TcFileState) env tpenv comp (overallTy: OverallT // The 'mBind' is attached to the lambda Some(mkSeqUsing cenv env wholeExprMark bindPatTy genOuterTy inputExpr consumeExpr, tpenv) - | SynExpr.LetOrUseBang(range = m) -> error (Error(FSComp.SR.tcUseForInSequenceExpression (), m)) + | SynExpr.LetOrUse(isComputed = true; range = m) -> error (Error(FSComp.SR.tcUseForInSequenceExpression (), m)) | SynExpr.Match(spMatch, expr, clauses, _m, _trivia) -> let inputExpr, inputTy, tpenv = TcExprOfUnknownType cenv env tpenv expr diff --git a/src/Compiler/Driver/GraphChecking/FileContentMapping.fs b/src/Compiler/Driver/GraphChecking/FileContentMapping.fs index bfcc2600ec0..97fd2e3d987 100644 --- a/src/Compiler/Driver/GraphChecking/FileContentMapping.fs +++ b/src/Compiler/Driver/GraphChecking/FileContentMapping.fs @@ -505,21 +505,6 @@ let visitSynExpr (e: SynExpr) : FileContentEntry list = Continuation.concatenate continuations continuation | SynExpr.YieldOrReturn(expr = expr) -> visit expr continuation | SynExpr.YieldOrReturnFrom(expr = expr) -> visit expr continuation - | SynExpr.LetOrUseBang(pat = pat; rhs = rhs; andBangs = andBangs; body = body) -> - let continuations = - let andBangExprs = List.map (fun (SynBinding(expr = body)) -> body) andBangs - List.map visit (body :: rhs :: andBangExprs) - - let finalContinuation nodes = - [ - yield! List.concat nodes - yield! visitPat pat - for SynBinding(headPat = pat) in andBangs do - yield! visitPat pat - ] - |> continuation - - Continuation.sequence continuations finalContinuation | SynExpr.MatchBang(expr = expr; clauses = clauses) -> visit expr (fun exprNodes -> [ yield! exprNodes; yield! List.collect visitSynMatchClause clauses ] diff --git a/src/Compiler/Service/FSharpParseFileResults.fs b/src/Compiler/Service/FSharpParseFileResults.fs index d9f2df83d30..f5c1d978447 100644 --- a/src/Compiler/Service/FSharpParseFileResults.fs +++ b/src/Compiler/Service/FSharpParseFileResults.fs @@ -762,15 +762,6 @@ type FSharpParseFileResults(diagnostics: FSharpDiagnostic[], input: ParsedInput, yield! walkExpr false e2 yield! walkExpr false e3 - | SynExpr.LetOrUseBang(spBind, _, _, _, rhsExpr, andBangs, bodyExpr, _, _) -> - yield! walkBindSeqPt spBind - yield! walkExpr true rhsExpr - - for SynBinding(debugPoint = andBangSpBind; expr = eAndBang) in andBangs do - yield! walkBindSeqPt andBangSpBind - yield! walkExpr true eAndBang - - yield! walkExpr true bodyExpr ] // Process a class declaration or F# type declaration diff --git a/src/Compiler/Service/ServiceInterfaceStubGenerator.fs b/src/Compiler/Service/ServiceInterfaceStubGenerator.fs index fa13224a927..b6325670b31 100644 --- a/src/Compiler/Service/ServiceInterfaceStubGenerator.fs +++ b/src/Compiler/Service/ServiceInterfaceStubGenerator.fs @@ -956,15 +956,6 @@ module InterfaceStubGenerator = | SynExpr.YieldOrReturnFrom(expr = synExpr) | SynExpr.DoBang(expr = synExpr) -> walkExpr synExpr - | SynExpr.LetOrUseBang(rhs = synExpr1; andBangs = synExprAndBangs; body = synExpr2) -> - [ - yield synExpr1 - for SynBinding(expr = eAndBang) in synExprAndBangs do - yield eAndBang - yield synExpr2 - ] - |> List.tryPick walkExpr - | SynExpr.LibraryOnlyILAssembly _ | SynExpr.LibraryOnlyStaticOptimization _ | SynExpr.LibraryOnlyUnionCaseFieldGet _ diff --git a/src/Compiler/Service/ServiceParseTreeWalk.fs b/src/Compiler/Service/ServiceParseTreeWalk.fs index ce689f8f5d6..da7f1aaadc2 100644 --- a/src/Compiler/Service/ServiceParseTreeWalk.fs +++ b/src/Compiler/Service/ServiceParseTreeWalk.fs @@ -745,20 +745,6 @@ module SyntaxTraversal = ] |> pick expr - | SynExpr.LetOrUseBang(pat = synPat; rhs = synExpr; andBangs = andBangSynExprs; body = synExpr2) -> - [ - yield dive synPat synPat.Range traversePat - yield dive synExpr synExpr.Range traverseSynExpr - yield! - [ - for SynBinding(headPat = andBangSynPat; expr = andBangSynExpr) in andBangSynExprs do - yield (dive andBangSynPat andBangSynPat.Range traversePat) - yield (dive andBangSynExpr andBangSynExpr.Range traverseSynExpr) - ] - yield dive synExpr2 synExpr2.Range traverseSynExpr - ] - |> pick expr - | SynExpr.Dynamic _ | SynExpr.Ident _ | SynExpr.LongIdent _ diff --git a/src/Compiler/Service/ServiceParsedInputOps.fs b/src/Compiler/Service/ServiceParsedInputOps.fs index 585d29787fc..4b5e3cf9028 100644 --- a/src/Compiler/Service/ServiceParsedInputOps.fs +++ b/src/Compiler/Service/ServiceParsedInputOps.fs @@ -848,15 +848,6 @@ module ParsedInput = | SynExpr.Ident ident -> ifPosInRange ident.idRange (fun _ -> Some(EntityKind.FunctionOrValue false)) - | SynExpr.LetOrUseBang(rhs = e1; andBangs = es; body = e2) -> - [ - yield e1 - for SynBinding(expr = eAndBang) in es do - yield eAndBang - yield e2 - ] - |> List.tryPick (walkExprWithKind parentKind) - | SynExpr.TraitCall(TypesForTypar ts, sign, e, _) -> List.tryPick walkType ts |> Option.orElseWith (fun () -> walkMemberSig sign) @@ -2155,16 +2146,6 @@ module ParsedInput = walkExpr e2 walkExpr e3 - | SynExpr.LetOrUseBang(pat = pat; rhs = e1; andBangs = es; body = e2) -> - walkPat pat - walkExpr e1 - - for SynBinding(headPat = patAndBang; expr = eAndBang) in es do - walkPat patAndBang - walkExpr eAndBang - - walkExpr e2 - | SynExpr.TraitCall(TypesForTypar ts, sign, e, _) -> List.iter walkType ts walkMemberSig sign diff --git a/src/Compiler/Service/ServiceStructure.fs b/src/Compiler/Service/ServiceStructure.fs index 8025a7f1b0d..bcf0d8d2bc8 100644 --- a/src/Compiler/Service/ServiceStructure.fs +++ b/src/Compiler/Service/ServiceStructure.fs @@ -258,25 +258,6 @@ module Structure = rcheck Scope.Do Collapse.Below r <| Range.modStart 3 r parseExpr e - | SynExpr.LetOrUseBang(pat = pat; rhs = eLet; andBangs = es; body = eBody) -> - let exprs = - [ - eLet - for SynBinding(expr = eAndBang) in es do - eAndBang - ] - - for e in exprs do - // for `let!`, `use!` or `and!` the pattern begins at the end of the - // keyword so that this scope can be used without adjustment if there is no `=` - // on the same line. If there is an `=` the range will be adjusted during the - // tooltip creation - let r = Range.endToEnd pat.Range e.Range - rcheck Scope.LetOrUseBang Collapse.Below r r - parseExpr e - - parseExpr eBody - | SynExpr.For(doBody = e; range = r) | SynExpr.ForEach(_, _, _, _, _, _, e, r) -> rcheck Scope.For Collapse.Below r r diff --git a/src/Compiler/Service/SynExpr.fs b/src/Compiler/Service/SynExpr.fs index 52c10e8a7a5..9fd1b3a888a 100644 --- a/src/Compiler/Service/SynExpr.fs +++ b/src/Compiler/Service/SynExpr.fs @@ -444,8 +444,7 @@ module SynExpr = [] let (|LetOrUse|_|) = dangling (function - | SynExpr.LetOrUse _ - | SynExpr.LetOrUseBang _ as expr -> Some expr + | SynExpr.LetOrUse _ as expr -> Some expr | _ -> None) /// Matches a dangling sequential expression. @@ -697,7 +696,6 @@ module SynExpr = | _, SyntaxNode.SynExpr(SynExpr.Lazy _ as outer) :: _ | _, SyntaxNode.SynExpr(SynExpr.App(argExpr = SynExpr.Paren(expr = Is expr)) as outer) :: _ | _, SyntaxNode.SynExpr(SynExpr.LetOrUse _ as outer) :: _ - | _, SyntaxNode.SynExpr(SynExpr.LetOrUseBang _ as outer) :: _ | _, SyntaxNode.SynExpr(SynExpr.TryWith _ as outer) :: _ | _, SyntaxNode.SynExpr(SynExpr.TryFinally _ as outer) :: _ | _, SyntaxNode.SynExpr(SynExpr.For _ as outer) :: _ @@ -1211,7 +1209,6 @@ module SynExpr = | SynExpr.Match _, _ | SynExpr.MatchBang _, _ | SynExpr.LetOrUse _, _ - | SynExpr.LetOrUseBang _, _ | SynExpr.Sequential _, _ | SynExpr.Do _, _ | SynExpr.DoBang _, _ diff --git a/src/Compiler/Service/SynPat.fs b/src/Compiler/Service/SynPat.fs index c94448ce318..aea86f1d942 100644 --- a/src/Compiler/Service/SynPat.fs +++ b/src/Compiler/Service/SynPat.fs @@ -92,9 +92,9 @@ module SynPat = // set (x: …, y: …) = … | SynPat.Typed _, SyntaxNode.SynPat(Rightmost(SynPat.Paren(Is pat, _))) :: SyntaxNode.SynMatchClause _ :: _ | Rightmost(SynPat.Typed _), SyntaxNode.SynMatchClause _ :: _ - | SynPat.Typed _, SyntaxNode.SynExpr(SynExpr.LetOrUseBang _) :: _ - | SynPat.Typed _, SyntaxNode.SynPat(SynPat.Tuple(isStruct = false)) :: SyntaxNode.SynExpr(SynExpr.LetOrUseBang _) :: _ - | SynPat.Tuple(isStruct = false; elementPats = AnyTyped), SyntaxNode.SynExpr(SynExpr.LetOrUseBang _) :: _ + | SynPat.Typed _, SyntaxNode.SynExpr(SynExpr.LetOrUse _) :: _ + | SynPat.Typed _, SyntaxNode.SynPat(SynPat.Tuple(isStruct = false)) :: SyntaxNode.SynExpr(SynExpr.LetOrUse _) :: _ + | SynPat.Tuple(isStruct = false; elementPats = AnyTyped), SyntaxNode.SynExpr(SynExpr.LetOrUse _) :: _ | SynPat.Typed _, SyntaxNode.SynPat(SynPat.Tuple(isStruct = false)) :: SyntaxNode.SynBinding _ :: _ | SynPat.Tuple(isStruct = false; elementPats = AnyTyped), SyntaxNode.SynBinding _ :: _ | SynPat.LongIdent(argPats = SynArgPats.Pats(_ :: _)), SyntaxNode.SynBinding _ :: _ @@ -144,7 +144,6 @@ module SynPat = | SyntaxNode.SynExpr(SynExpr.Lambda(body = rhs)) :: _ | SyntaxNode.SynExpr(SynExpr.LetOrUse(body = rhs)) :: _ - | SyntaxNode.SynExpr(SynExpr.LetOrUseBang(body = rhs)) :: _ | SyntaxNode.SynBinding(SynBinding(expr = rhs)) :: _ | SyntaxNode.SynMatchClause(SynMatchClause(resultExpr = rhs)) :: _ -> let rhsRange = rhs.Range @@ -243,7 +242,7 @@ module SynPat = // fun (x) -> … | _, SyntaxNode.SynBinding _ :: _ | _, SyntaxNode.SynExpr(SynExpr.ForEach _) :: _ - | _, SyntaxNode.SynExpr(SynExpr.LetOrUseBang _) :: _ + | _, SyntaxNode.SynExpr(SynExpr.LetOrUse _) :: _ | _, SyntaxNode.SynMatchClause _ :: _ | Atomic, SyntaxNode.SynExpr(SynExpr.Lambda(parsedData = Some _)) :: _ -> false diff --git a/src/Compiler/SyntaxTree/ParseHelpers.fs b/src/Compiler/SyntaxTree/ParseHelpers.fs index 35b8a3d46db..b306bd30637 100644 --- a/src/Compiler/SyntaxTree/ParseHelpers.fs +++ b/src/Compiler/SyntaxTree/ParseHelpers.fs @@ -1066,7 +1066,7 @@ let leadingKeywordIsAbstract = | _ -> false /// Unified helper for creating let/let!/use/use! expressions -/// Creates either SynExpr.LetOrUse or SynExpr.LetOrUseBang based on isBang parameter +/// Creates SynExpr.LetOrUse based on isBang parameter /// Handles all four cases: 'let', 'let!', 'use', and 'use!' let mkLetExpression ( @@ -1081,31 +1081,57 @@ let mkLetExpression if isBang then match bangInfo with | Some(pat, rhs, andBangs, mEquals, isUse) -> - // Create let! or use! expression let spBind = DebugPointAtBinding.Yes(unionRanges mKeyword rhs.Range) + let trivia: SynBindingTrivia = + { + LeadingKeyword = + if isUse then + SynLeadingKeyword.Use mKeyword + else + SynLeadingKeyword.Let mKeyword + InlineKeyword = mIn + EqualsRange = mEquals + } + + let binding = + SynBinding( + accessibility = None, + kind = SynBindingKind.Normal, + isInline = false, + isMutable = false, + attributes = [], + xmlDoc = PreXmlDoc.Empty, + valData = SynInfo.emptySynValData, + headPat = pat, + returnInfo = None, + expr = rhs, + range = mWhole, + debugPoint = spBind, + trivia = trivia + ) + let trivia: SynExprLetOrUseTrivia = { LetOrUseKeyword = mKeyword InKeyword = mIn EqualsRange = mEquals } - // isFromSource is true for user-written code - SynExpr.LetOrUseBang(spBind, isUse, true, pat, rhs, andBangs, body, mWhole, trivia) + + SynExpr.LetOrUse(false, isUse, true, true, binding :: andBangs, body, mWhole, trivia) | None -> SynExpr.FromParseError(body, mWhole) else match bindingInfo with | Some(isRec, BindingSetPreAttrs(_, _, isUse, declsPreAttrs, _)) -> - // Create regular let or use expression let ignoredFreeAttrs, decls = declsPreAttrs [] None - let mWhole' = + let mWhole = match decls with | SynBinding(xmlDoc = xmlDoc) :: _ -> unionRangeWithXmlDoc xmlDoc mWhole | _ -> mWhole if not (isNil ignoredFreeAttrs) then - warning (Error(FSComp.SR.parsAttributesIgnored (), mWhole')) + warning (Error(FSComp.SR.parsAttributesIgnored (), mWhole)) let mIn' = mIn @@ -1127,10 +1153,12 @@ let mkLetExpression SynExpr.LetOrUse( isRec, - isUse, // Pass through the isUse flag from binding info + isUse, + true, + false, decls, body, - mWhole', + mWhole, { LetOrUseKeyword = mLetOrUse InKeyword = mIn' diff --git a/src/Compiler/SyntaxTree/ParseHelpers.fsi b/src/Compiler/SyntaxTree/ParseHelpers.fsi index 03e9e37f274..b233a502853 100644 --- a/src/Compiler/SyntaxTree/ParseHelpers.fsi +++ b/src/Compiler/SyntaxTree/ParseHelpers.fsi @@ -196,7 +196,7 @@ val mkClassMemberLocalBindings: isStatic: bool * initialRangeOpt: range option * attrs: SynAttributes * vis: SynAccess option * BindingSet -> SynMemberDefn -/// Creates either SynExpr.LetOrUse or SynExpr.LetOrUseBang based on isBang parameter +/// Creates SynExpr.LetOrUse based on isBang parameter /// Handles all four cases: 'let', 'let!', 'use', and 'use!' val mkLetExpression: isBang: bool * diff --git a/src/Compiler/SyntaxTree/SyntaxTree.fs b/src/Compiler/SyntaxTree/SyntaxTree.fs index de74d343f7b..0b00adab2da 100644 --- a/src/Compiler/SyntaxTree/SyntaxTree.fs +++ b/src/Compiler/SyntaxTree/SyntaxTree.fs @@ -718,15 +718,12 @@ type SynExpr = | YieldOrReturnFrom of flags: (bool * bool) * expr: SynExpr * range: range * trivia: SynExprYieldOrReturnFromTrivia - | LetOrUse of isRecursive: bool * isUse: bool * bindings: SynBinding list * body: SynExpr * range: range * trivia: SynExprLetOrUseTrivia - - | LetOrUseBang of - bindDebugPoint: DebugPointAtBinding * + | LetOrUse of + isRecursive: bool * isUse: bool * isFromSource: bool * - pat: SynPat * - rhs: SynExpr * - andBangs: SynBinding list * + isComputed: bool * + bindings: SynBinding list * body: SynExpr * range: range * trivia: SynExprLetOrUseTrivia @@ -835,7 +832,6 @@ type SynExpr = | SynExpr.ImplicitZero(range = m) | SynExpr.YieldOrReturn(range = m) | SynExpr.YieldOrReturnFrom(range = m) - | SynExpr.LetOrUseBang(range = m) | SynExpr.MatchBang(range = m) | SynExpr.DoBang(range = m) | SynExpr.WhileBang(range = m) diff --git a/src/Compiler/SyntaxTree/SyntaxTree.fsi b/src/Compiler/SyntaxTree/SyntaxTree.fsi index d6a01186807..3a0d6bf206e 100644 --- a/src/Compiler/SyntaxTree/SyntaxTree.fsi +++ b/src/Compiler/SyntaxTree/SyntaxTree.fsi @@ -878,25 +878,15 @@ type SynExpr = /// F# syntax: let f pat1 .. patN = expr in expr /// F# syntax: let rec f pat1 .. patN = expr in expr /// F# syntax: use pat = expr in expr - | LetOrUse of - isRecursive: bool * - isUse: bool * - bindings: SynBinding list * - body: SynExpr * - range: range * - trivia: SynExprLetOrUseTrivia - /// F# syntax: let! pat = expr in expr /// F# syntax: use! pat = expr in expr /// F# syntax: let! pat = expr and! ... and! ... and! pat = expr in expr - /// Computation expressions only - | LetOrUseBang of - bindDebugPoint: DebugPointAtBinding * + | LetOrUse of + isRecursive: bool * isUse: bool * isFromSource: bool * - pat: SynPat * - rhs: SynExpr * - andBangs: SynBinding list * + isComputed: bool * + bindings: SynBinding list * body: SynExpr * range: range * trivia: SynExprLetOrUseTrivia diff --git a/src/Compiler/SyntaxTree/SyntaxTreeOps.fs b/src/Compiler/SyntaxTree/SyntaxTreeOps.fs index 349c8e8002c..020dc50bebf 100644 --- a/src/Compiler/SyntaxTree/SyntaxTreeOps.fs +++ b/src/Compiler/SyntaxTree/SyntaxTreeOps.fs @@ -209,7 +209,6 @@ let rec IsControlFlowExpression e = // Treat "ident { ... }" as a control flow expression | SynExpr.App(_, _, SynExpr.Ident _, SynExpr.ComputationExpr _, _) | SynExpr.IfThenElse _ - | SynExpr.LetOrUseBang _ | SynExpr.Match _ | SynExpr.TryWith _ | SynExpr.TryFinally _ @@ -981,15 +980,6 @@ let rec synExprContainsError inpExpr = | SynExpr.DotNamedIndexedPropertySet(e1, _, e2, e3, _) -> walkExpr e1 || walkExpr e2 || walkExpr e3 - | SynExpr.LetOrUseBang(rhs = e1; body = e2; andBangs = es) -> - walkExpr e1 - || walkExprs - [ - for SynBinding(expr = e) in es do - yield e - ] - || walkExpr e2 - | SynExpr.InterpolatedString(parts, _, _m) -> parts |> List.choose (function 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 79894ad0ccc..aec5892259d 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 @@ -7207,8 +7207,12 @@ FSharp.Compiler.Syntax.SynExpr+Lazy: FSharp.Compiler.Syntax.SynExpr expr FSharp.Compiler.Syntax.SynExpr+Lazy: FSharp.Compiler.Syntax.SynExpr get_expr() FSharp.Compiler.Syntax.SynExpr+Lazy: FSharp.Compiler.Text.Range get_range() FSharp.Compiler.Syntax.SynExpr+Lazy: FSharp.Compiler.Text.Range range +FSharp.Compiler.Syntax.SynExpr+LetOrUse: Boolean get_isComputed() +FSharp.Compiler.Syntax.SynExpr+LetOrUse: Boolean get_isFromSource() FSharp.Compiler.Syntax.SynExpr+LetOrUse: Boolean get_isRecursive() FSharp.Compiler.Syntax.SynExpr+LetOrUse: Boolean get_isUse() +FSharp.Compiler.Syntax.SynExpr+LetOrUse: Boolean isComputed +FSharp.Compiler.Syntax.SynExpr+LetOrUse: Boolean isFromSource FSharp.Compiler.Syntax.SynExpr+LetOrUse: Boolean isRecursive FSharp.Compiler.Syntax.SynExpr+LetOrUse: Boolean isUse FSharp.Compiler.Syntax.SynExpr+LetOrUse: FSharp.Compiler.Syntax.SynExpr body @@ -7761,7 +7765,7 @@ FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewInterpolatedSt FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewJoinIn(FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range, FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewLambda(Boolean, Boolean, FSharp.Compiler.Syntax.SynSimplePats, FSharp.Compiler.Syntax.SynExpr, Microsoft.FSharp.Core.FSharpOption`1[System.Tuple`2[Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynPat],FSharp.Compiler.Syntax.SynExpr]], FSharp.Compiler.Text.Range, FSharp.Compiler.SyntaxTrivia.SynExprLambdaTrivia) FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewLazy(FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range) -FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewLetOrUse(Boolean, Boolean, Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynBinding], FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range, FSharp.Compiler.SyntaxTrivia.SynExprLetOrUseTrivia) +FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewLetOrUse(Boolean, Boolean, Boolean, Boolean, Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynBinding], FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range, FSharp.Compiler.SyntaxTrivia.SynExprLetOrUseTrivia) FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewLetOrUseBang(FSharp.Compiler.Syntax.DebugPointAtBinding, Boolean, Boolean, FSharp.Compiler.Syntax.SynPat, FSharp.Compiler.Syntax.SynExpr, Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynBinding], FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range, FSharp.Compiler.SyntaxTrivia.SynExprLetOrUseTrivia) FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewLibraryOnlyILAssembly(System.Object, Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynType], Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynExpr], Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynType], FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewLibraryOnlyStaticOptimization(Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynStaticOptimizationConstraint], FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range) 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 79894ad0ccc..aec5892259d 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 @@ -7207,8 +7207,12 @@ FSharp.Compiler.Syntax.SynExpr+Lazy: FSharp.Compiler.Syntax.SynExpr expr FSharp.Compiler.Syntax.SynExpr+Lazy: FSharp.Compiler.Syntax.SynExpr get_expr() FSharp.Compiler.Syntax.SynExpr+Lazy: FSharp.Compiler.Text.Range get_range() FSharp.Compiler.Syntax.SynExpr+Lazy: FSharp.Compiler.Text.Range range +FSharp.Compiler.Syntax.SynExpr+LetOrUse: Boolean get_isComputed() +FSharp.Compiler.Syntax.SynExpr+LetOrUse: Boolean get_isFromSource() FSharp.Compiler.Syntax.SynExpr+LetOrUse: Boolean get_isRecursive() FSharp.Compiler.Syntax.SynExpr+LetOrUse: Boolean get_isUse() +FSharp.Compiler.Syntax.SynExpr+LetOrUse: Boolean isComputed +FSharp.Compiler.Syntax.SynExpr+LetOrUse: Boolean isFromSource FSharp.Compiler.Syntax.SynExpr+LetOrUse: Boolean isRecursive FSharp.Compiler.Syntax.SynExpr+LetOrUse: Boolean isUse FSharp.Compiler.Syntax.SynExpr+LetOrUse: FSharp.Compiler.Syntax.SynExpr body @@ -7761,7 +7765,7 @@ FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewInterpolatedSt FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewJoinIn(FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range, FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewLambda(Boolean, Boolean, FSharp.Compiler.Syntax.SynSimplePats, FSharp.Compiler.Syntax.SynExpr, Microsoft.FSharp.Core.FSharpOption`1[System.Tuple`2[Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynPat],FSharp.Compiler.Syntax.SynExpr]], FSharp.Compiler.Text.Range, FSharp.Compiler.SyntaxTrivia.SynExprLambdaTrivia) FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewLazy(FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range) -FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewLetOrUse(Boolean, Boolean, Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynBinding], FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range, FSharp.Compiler.SyntaxTrivia.SynExprLetOrUseTrivia) +FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewLetOrUse(Boolean, Boolean, Boolean, Boolean, Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynBinding], FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range, FSharp.Compiler.SyntaxTrivia.SynExprLetOrUseTrivia) FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewLetOrUseBang(FSharp.Compiler.Syntax.DebugPointAtBinding, Boolean, Boolean, FSharp.Compiler.Syntax.SynPat, FSharp.Compiler.Syntax.SynExpr, Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynBinding], FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range, FSharp.Compiler.SyntaxTrivia.SynExprLetOrUseTrivia) FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewLibraryOnlyILAssembly(System.Object, Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynType], Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynExpr], Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynType], FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewLibraryOnlyStaticOptimization(Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynStaticOptimizationConstraint], FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range) diff --git a/tests/service/data/SyntaxTree/Binding/InlineKeywordInBinding.fs.bsl b/tests/service/data/SyntaxTree/Binding/InlineKeywordInBinding.fs.bsl index 9d1c6939e3e..e194eb19fab 100644 --- a/tests/service/data/SyntaxTree/Binding/InlineKeywordInBinding.fs.bsl +++ b/tests/service/data/SyntaxTree/Binding/InlineKeywordInBinding.fs.bsl @@ -22,7 +22,7 @@ ImplFile Named (SynIdent (z, None), false, None, (2,15--2,16))], None, (2,11--2,16)), None, LetOrUse - (false, false, + (false, false, true, false, [SynBinding (None, Normal, true, false, [], PreXmlDoc ((3,4), FSharp.Compiler.Xml.XmlDocCollector), diff --git a/tests/service/data/SyntaxTree/Binding/RangeOfEqualSignShouldBePresentInLocalLetBinding.fs.bsl b/tests/service/data/SyntaxTree/Binding/RangeOfEqualSignShouldBePresentInLocalLetBinding.fs.bsl index c54522f64b2..9ff03a69ae4 100644 --- a/tests/service/data/SyntaxTree/Binding/RangeOfEqualSignShouldBePresentInLocalLetBinding.fs.bsl +++ b/tests/service/data/SyntaxTree/Binding/RangeOfEqualSignShouldBePresentInLocalLetBinding.fs.bsl @@ -7,7 +7,7 @@ ImplFile [Expr (Do (LetOrUse - (false, false, + (false, false, true, false, [SynBinding (None, Normal, false, false, [], PreXmlDoc ((3,4), FSharp.Compiler.Xml.XmlDocCollector), diff --git a/tests/service/data/SyntaxTree/Binding/RangeOfEqualSignShouldBePresentInLocalLetBindingTyped.fs.bsl b/tests/service/data/SyntaxTree/Binding/RangeOfEqualSignShouldBePresentInLocalLetBindingTyped.fs.bsl index ce9d335891d..34d155903b7 100644 --- a/tests/service/data/SyntaxTree/Binding/RangeOfEqualSignShouldBePresentInLocalLetBindingTyped.fs.bsl +++ b/tests/service/data/SyntaxTree/Binding/RangeOfEqualSignShouldBePresentInLocalLetBindingTyped.fs.bsl @@ -10,7 +10,7 @@ ImplFile [Expr (Do (LetOrUse - (false, false, + (false, false, true, false, [SynBinding (None, Normal, false, false, [], PreXmlDoc ((3,4), FSharp.Compiler.Xml.XmlDocCollector), diff --git a/tests/service/data/SyntaxTree/Binding/RangeOfLetKeywordShouldBePresentInSynExprLetOrUseBinding.fs.bsl b/tests/service/data/SyntaxTree/Binding/RangeOfLetKeywordShouldBePresentInSynExprLetOrUseBinding.fs.bsl index 2e096ce46f6..c2e98c6a098 100644 --- a/tests/service/data/SyntaxTree/Binding/RangeOfLetKeywordShouldBePresentInSynExprLetOrUseBinding.fs.bsl +++ b/tests/service/data/SyntaxTree/Binding/RangeOfLetKeywordShouldBePresentInSynExprLetOrUseBinding.fs.bsl @@ -16,7 +16,7 @@ ImplFile (None, SynValInfo ([], SynArgInfo ([], false, None)), None), Named (SynIdent (a, None), false, None, (2,4--2,5)), None, LetOrUse - (false, false, + (false, false, true, false, [SynBinding (None, Normal, false, false, [], PreXmlDoc ((3,4), FSharp.Compiler.Xml.XmlDocCollector), diff --git a/tests/service/data/SyntaxTree/ComputationExpression/MultipleSynExprAndBangHaveRangeThatStartsAtAndAndEndsAfterExpression.fs.bsl b/tests/service/data/SyntaxTree/ComputationExpression/MultipleSynExprAndBangHaveRangeThatStartsAtAndAndEndsAfterExpression.fs.bsl index a865a94772e..368037f9df0 100644 --- a/tests/service/data/SyntaxTree/ComputationExpression/MultipleSynExprAndBangHaveRangeThatStartsAtAndAndEndsAfterExpression.fs.bsl +++ b/tests/service/data/SyntaxTree/ComputationExpression/MultipleSynExprAndBangHaveRangeThatStartsAtAndAndEndsAfterExpression.fs.bsl @@ -12,13 +12,25 @@ ImplFile (NonAtomic, false, Ident async, ComputationExpr (false, - LetOrUseBang - (Yes (3,4--3,24), false, true, - Named (SynIdent (bar, None), false, None, (3,9--3,12)), - App - (NonAtomic, false, Ident getBar, - Const (Unit, (3,22--3,24)), (3,15--3,24)), + LetOrUse + (false, false, true, true, [SynBinding + (None, Normal, false, false, [], PreXmlDocEmpty, + SynValData + (None, + SynValInfo ([], SynArgInfo ([], false, None)), + None), + Named + (SynIdent (bar, None), false, None, (3,9--3,12)), + None, + App + (NonAtomic, false, Ident getBar, + Const (Unit, (3,22--3,24)), (3,15--3,24)), + (3,4--6,14), Yes (3,4--3,24), + { LeadingKeyword = Let (3,4--3,8) + InlineKeyword = None + EqualsRange = Some (3,13--3,14) }); + SynBinding (None, Normal, false, false, [], PreXmlDocEmpty, SynValData (None, diff --git a/tests/service/data/SyntaxTree/ComputationExpression/SynExprAndBangRangeStartsAtAndAndEndsAfterExpression.fs.bsl b/tests/service/data/SyntaxTree/ComputationExpression/SynExprAndBangRangeStartsAtAndAndEndsAfterExpression.fs.bsl index c08f43cc9f2..08748e2e1c4 100644 --- a/tests/service/data/SyntaxTree/ComputationExpression/SynExprAndBangRangeStartsAtAndAndEndsAfterExpression.fs.bsl +++ b/tests/service/data/SyntaxTree/ComputationExpression/SynExprAndBangRangeStartsAtAndAndEndsAfterExpression.fs.bsl @@ -12,13 +12,25 @@ ImplFile (NonAtomic, false, Ident async, ComputationExpr (false, - LetOrUseBang - (Yes (3,4--3,24), false, true, - Named (SynIdent (bar, None), false, None, (3,9--3,12)), - App - (NonAtomic, false, Ident getBar, - Const (Unit, (3,22--3,24)), (3,15--3,24)), + LetOrUse + (false, false, true, true, [SynBinding + (None, Normal, false, false, [], PreXmlDocEmpty, + SynValData + (None, + SynValInfo ([], SynArgInfo ([], false, None)), + None), + Named + (SynIdent (bar, None), false, None, (3,9--3,12)), + None, + App + (NonAtomic, false, Ident getBar, + Const (Unit, (3,22--3,24)), (3,15--3,24)), + (3,4--7,14), Yes (3,4--3,24), + { LeadingKeyword = Let (3,4--3,8) + InlineKeyword = None + EqualsRange = Some (3,13--3,14) }); + SynBinding (None, Normal, false, false, [], PreXmlDocEmpty, SynValData (None, diff --git a/tests/service/data/SyntaxTree/Expression/NestedSynExprLetOrUseContainsTheRangeOfInKeyword.fs.bsl b/tests/service/data/SyntaxTree/Expression/NestedSynExprLetOrUseContainsTheRangeOfInKeyword.fs.bsl index fc36bd59dfc..5ff48d7afcc 100644 --- a/tests/service/data/SyntaxTree/Expression/NestedSynExprLetOrUseContainsTheRangeOfInKeyword.fs.bsl +++ b/tests/service/data/SyntaxTree/Expression/NestedSynExprLetOrUseContainsTheRangeOfInKeyword.fs.bsl @@ -17,7 +17,7 @@ ImplFile Pats [Paren (Const (Unit, (2,6--2,8)), (2,6--2,8))], None, (2,4--2,8)), None, LetOrUse - (false, false, + (false, false, true, false, [SynBinding (None, Normal, false, false, [], PreXmlDoc ((3,4), FSharp.Compiler.Xml.XmlDocCollector), @@ -30,7 +30,7 @@ ImplFile InlineKeyword = None EqualsRange = Some (3,10--3,11) })], LetOrUse - (false, false, + (false, false, true, false, [SynBinding (None, Normal, false, false, [], PreXmlDoc ((4,4), FSharp.Compiler.Xml.XmlDocCollector), diff --git a/tests/service/data/SyntaxTree/Expression/SynExprLetOrUseBangContainsTheRangeOfTheEqualsSign.fs.bsl b/tests/service/data/SyntaxTree/Expression/SynExprLetOrUseBangContainsTheRangeOfTheEqualsSign.fs.bsl index 1155c145819..c05c2e7588b 100644 --- a/tests/service/data/SyntaxTree/Expression/SynExprLetOrUseBangContainsTheRangeOfTheEqualsSign.fs.bsl +++ b/tests/service/data/SyntaxTree/Expression/SynExprLetOrUseBangContainsTheRangeOfTheEqualsSign.fs.bsl @@ -11,11 +11,20 @@ ImplFile (NonAtomic, false, Ident comp, ComputationExpr (false, - LetOrUseBang - (Yes (3,4--3,14), false, true, - Named (SynIdent (x, None), false, None, (3,9--3,10)), - Ident y, + LetOrUse + (false, false, true, true, [SynBinding + (None, Normal, false, false, [], PreXmlDocEmpty, + SynValData + (None, + SynValInfo ([], SynArgInfo ([], false, None)), + None), + Named (SynIdent (x, None), false, None, (3,9--3,10)), + None, Ident y, (3,4--5,13), Yes (3,4--3,14), + { LeadingKeyword = Let (3,4--3,8) + InlineKeyword = None + EqualsRange = Some (3,11--3,12) }); + SynBinding (None, Normal, false, false, [], PreXmlDocEmpty, SynValData (None, diff --git a/tests/service/data/SyntaxTree/Expression/SynExprLetOrUseContainsTheRangeOfInKeyword.fs.bsl b/tests/service/data/SyntaxTree/Expression/SynExprLetOrUseContainsTheRangeOfInKeyword.fs.bsl index 37bc9c3b31c..250d3b16d79 100644 --- a/tests/service/data/SyntaxTree/Expression/SynExprLetOrUseContainsTheRangeOfInKeyword.fs.bsl +++ b/tests/service/data/SyntaxTree/Expression/SynExprLetOrUseContainsTheRangeOfInKeyword.fs.bsl @@ -6,7 +6,7 @@ ImplFile ([SynExprLetOrUseContainsTheRangeOfInKeyword], false, AnonModule, [Expr (LetOrUse - (false, false, + (false, false, true, false, [SynBinding (None, Normal, false, false, [], PreXmlDoc ((2,0), FSharp.Compiler.Xml.XmlDocCollector), diff --git a/tests/service/data/SyntaxTree/Expression/SynExprLetOrUseDoesNotContainTheRangeOfInKeyword.fs.bsl b/tests/service/data/SyntaxTree/Expression/SynExprLetOrUseDoesNotContainTheRangeOfInKeyword.fs.bsl index 05a52bec5e5..1568bde4b7a 100644 --- a/tests/service/data/SyntaxTree/Expression/SynExprLetOrUseDoesNotContainTheRangeOfInKeyword.fs.bsl +++ b/tests/service/data/SyntaxTree/Expression/SynExprLetOrUseDoesNotContainTheRangeOfInKeyword.fs.bsl @@ -8,7 +8,7 @@ ImplFile [Expr (Do (LetOrUse - (false, false, + (false, false, true, false, [SynBinding (None, Normal, false, false, [], PreXmlDoc ((3,0), FSharp.Compiler.Xml.XmlDocCollector), diff --git a/tests/service/data/SyntaxTree/Expression/SynExprLetOrUseWhereBodyExprStartsWithTokenOfTwoCharactersDoesNotContainTheRangeOfInKeyword.fs.bsl b/tests/service/data/SyntaxTree/Expression/SynExprLetOrUseWhereBodyExprStartsWithTokenOfTwoCharactersDoesNotContainTheRangeOfInKeyword.fs.bsl index 583e33b78ec..4efd29655d0 100644 --- a/tests/service/data/SyntaxTree/Expression/SynExprLetOrUseWhereBodyExprStartsWithTokenOfTwoCharactersDoesNotContainTheRangeOfInKeyword.fs.bsl +++ b/tests/service/data/SyntaxTree/Expression/SynExprLetOrUseWhereBodyExprStartsWithTokenOfTwoCharactersDoesNotContainTheRangeOfInKeyword.fs.bsl @@ -11,7 +11,7 @@ ImplFile [Expr (Do (LetOrUse - (false, false, + (false, false, true, false, [SynBinding (None, Normal, false, false, [], PreXmlDoc ((3,0), FSharp.Compiler.Xml.XmlDocCollector), diff --git a/tests/service/data/SyntaxTree/Expression/SynExprLetOrUseWithRecursiveBindingContainsTheRangeOfInKeyword.fs.bsl b/tests/service/data/SyntaxTree/Expression/SynExprLetOrUseWithRecursiveBindingContainsTheRangeOfInKeyword.fs.bsl index 692b5495fcb..0f6d62006ba 100644 --- a/tests/service/data/SyntaxTree/Expression/SynExprLetOrUseWithRecursiveBindingContainsTheRangeOfInKeyword.fs.bsl +++ b/tests/service/data/SyntaxTree/Expression/SynExprLetOrUseWithRecursiveBindingContainsTheRangeOfInKeyword.fs.bsl @@ -10,7 +10,7 @@ ImplFile [Expr (Do (LetOrUse - (true, false, + (true, false, true, false, [SynBinding (None, Normal, false, false, [], PreXmlDoc ((3,4), FSharp.Compiler.Xml.XmlDocCollector), diff --git a/tests/service/data/SyntaxTree/Expression/Try with - Missing expr 04.fs.bsl b/tests/service/data/SyntaxTree/Expression/Try with - Missing expr 04.fs.bsl index f3992cf7040..93be9bc6723 100644 --- a/tests/service/data/SyntaxTree/Expression/Try with - Missing expr 04.fs.bsl +++ b/tests/service/data/SyntaxTree/Expression/Try with - Missing expr 04.fs.bsl @@ -7,7 +7,7 @@ ImplFile [Expr (TryWith (LetOrUse - (false, false, + (false, false, true, false, [SynBinding (None, Normal, false, false, [], PreXmlDoc ((5,0), FSharp.Compiler.Xml.XmlDocCollector), diff --git a/tests/service/data/SyntaxTree/LeadingKeyword/UseKeyword.fs.bsl b/tests/service/data/SyntaxTree/LeadingKeyword/UseKeyword.fs.bsl index 1774b119f59..22fb03d8cfa 100644 --- a/tests/service/data/SyntaxTree/LeadingKeyword/UseKeyword.fs.bsl +++ b/tests/service/data/SyntaxTree/LeadingKeyword/UseKeyword.fs.bsl @@ -7,7 +7,7 @@ ImplFile [Expr (Do (LetOrUse - (false, true, + (false, true, true, false, [SynBinding (None, Normal, false, false, [], PreXmlDoc ((3,4), FSharp.Compiler.Xml.XmlDocCollector), diff --git a/tests/service/data/SyntaxTree/LeadingKeyword/UseRecKeyword.fs.bsl b/tests/service/data/SyntaxTree/LeadingKeyword/UseRecKeyword.fs.bsl index aececc8348e..38be60e5029 100644 --- a/tests/service/data/SyntaxTree/LeadingKeyword/UseRecKeyword.fs.bsl +++ b/tests/service/data/SyntaxTree/LeadingKeyword/UseRecKeyword.fs.bsl @@ -7,7 +7,7 @@ ImplFile [Expr (Do (LetOrUse - (true, true, + (true, true, true, false, [SynBinding (None, Normal, false, false, [], PreXmlDoc ((3,4), FSharp.Compiler.Xml.XmlDocCollector), diff --git a/tests/service/data/SyntaxTree/MatchClause/RangeOfMultipleSynMatchClause.fs.bsl b/tests/service/data/SyntaxTree/MatchClause/RangeOfMultipleSynMatchClause.fs.bsl index 19f2154a6c9..0baa92feccc 100644 --- a/tests/service/data/SyntaxTree/MatchClause/RangeOfMultipleSynMatchClause.fs.bsl +++ b/tests/service/data/SyntaxTree/MatchClause/RangeOfMultipleSynMatchClause.fs.bsl @@ -7,7 +7,7 @@ ImplFile [Expr (TryWith (LetOrUse - (false, false, + (false, false, true, false, [SynBinding (None, Normal, false, false, [], PreXmlDoc ((3,4), FSharp.Compiler.Xml.XmlDocCollector), diff --git a/tests/service/data/SyntaxTree/MatchClause/RangeOfSingleSynMatchClause.fs.bsl b/tests/service/data/SyntaxTree/MatchClause/RangeOfSingleSynMatchClause.fs.bsl index e5bbe56cba7..bd05c6d0580 100644 --- a/tests/service/data/SyntaxTree/MatchClause/RangeOfSingleSynMatchClause.fs.bsl +++ b/tests/service/data/SyntaxTree/MatchClause/RangeOfSingleSynMatchClause.fs.bsl @@ -7,7 +7,7 @@ ImplFile [Expr (TryWith (LetOrUse - (false, false, + (false, false, true, false, [SynBinding (None, Normal, false, false, [], PreXmlDoc ((3,4), FSharp.Compiler.Xml.XmlDocCollector), diff --git a/tests/service/data/SyntaxTree/MatchClause/RangeOfSingleSynMatchClauseFollowedByBar.fs.bsl b/tests/service/data/SyntaxTree/MatchClause/RangeOfSingleSynMatchClauseFollowedByBar.fs.bsl index 21f8e8cdb6b..3f955a9be98 100644 --- a/tests/service/data/SyntaxTree/MatchClause/RangeOfSingleSynMatchClauseFollowedByBar.fs.bsl +++ b/tests/service/data/SyntaxTree/MatchClause/RangeOfSingleSynMatchClauseFollowedByBar.fs.bsl @@ -7,7 +7,7 @@ ImplFile [Expr (TryWith (LetOrUse - (false, false, + (false, false, true, false, [SynBinding (None, Normal, false, false, [], PreXmlDoc ((3,4), FSharp.Compiler.Xml.XmlDocCollector), diff --git a/tests/service/data/SyntaxTree/Pattern/Typed - Missing type 05.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Typed - Missing type 05.fs.bsl index d4c056f191b..c3c1bd37e9f 100644 --- a/tests/service/data/SyntaxTree/Pattern/Typed - Missing type 05.fs.bsl +++ b/tests/service/data/SyntaxTree/Pattern/Typed - Missing type 05.fs.bsl @@ -8,7 +8,7 @@ ImplFile (Do (FromParseError (LetOrUse - (false, false, + (false, false, true, false, [SynBinding (None, Normal, false, false, [], PreXmlDoc ((4,4), FSharp.Compiler.Xml.XmlDocCollector), diff --git a/tests/service/data/SyntaxTree/Pattern/Typed - Missing type 06.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Typed - Missing type 06.fs.bsl index 229f126fa39..a38de74e7fe 100644 --- a/tests/service/data/SyntaxTree/Pattern/Typed - Missing type 06.fs.bsl +++ b/tests/service/data/SyntaxTree/Pattern/Typed - Missing type 06.fs.bsl @@ -7,7 +7,7 @@ ImplFile [Expr (Do (LetOrUse - (false, false, + (false, false, true, false, [SynBinding (None, Normal, false, false, [], PreXmlDoc ((4,4), FSharp.Compiler.Xml.XmlDocCollector), diff --git a/tests/service/data/SyntaxTree/Pattern/Typed - Missing type 09.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Typed - Missing type 09.fs.bsl index bf0847e0ea0..cf91e9d594c 100644 --- a/tests/service/data/SyntaxTree/Pattern/Typed - Missing type 09.fs.bsl +++ b/tests/service/data/SyntaxTree/Pattern/Typed - Missing type 09.fs.bsl @@ -7,7 +7,7 @@ ImplFile [Expr (Do (LetOrUse - (false, false, + (false, false, true, false, [SynBinding (None, Normal, false, false, [], PreXmlDoc ((4,4), FSharp.Compiler.Xml.XmlDocCollector), diff --git a/tests/service/data/SyntaxTree/Pattern/Typed - Missing type 10.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Typed - Missing type 10.fs.bsl index 65b1b0d7a95..d76007a4819 100644 --- a/tests/service/data/SyntaxTree/Pattern/Typed - Missing type 10.fs.bsl +++ b/tests/service/data/SyntaxTree/Pattern/Typed - Missing type 10.fs.bsl @@ -7,7 +7,7 @@ ImplFile [Expr (Do (LetOrUse - (false, false, + (false, false, true, false, [SynBinding (None, Normal, false, false, [], PreXmlDoc ((4,4), FSharp.Compiler.Xml.XmlDocCollector), diff --git a/tests/service/data/SyntaxTree/Pattern/Typed - Missing type 11.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Typed - Missing type 11.fs.bsl index 4980b86a481..1afdab1ec2f 100644 --- a/tests/service/data/SyntaxTree/Pattern/Typed - Missing type 11.fs.bsl +++ b/tests/service/data/SyntaxTree/Pattern/Typed - Missing type 11.fs.bsl @@ -7,7 +7,7 @@ ImplFile [Expr (Do (LetOrUse - (false, false, + (false, false, true, false, [SynBinding (None, Normal, false, false, [], PreXmlDoc ((4,4), FSharp.Compiler.Xml.XmlDocCollector), diff --git a/tests/service/data/SyntaxTree/Pattern/Typed - Missing type 12.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Typed - Missing type 12.fs.bsl index b9200e91fd0..1fc723d7ea0 100644 --- a/tests/service/data/SyntaxTree/Pattern/Typed - Missing type 12.fs.bsl +++ b/tests/service/data/SyntaxTree/Pattern/Typed - Missing type 12.fs.bsl @@ -7,7 +7,7 @@ ImplFile [Expr (Do (LetOrUse - (false, false, + (false, false, true, false, [SynBinding (None, Normal, false, false, [], PreXmlDoc ((4,4), FSharp.Compiler.Xml.XmlDocCollector), diff --git a/tests/service/data/SyntaxTree/String/InterpolatedStringOffsideInNestedLet.fs.bsl b/tests/service/data/SyntaxTree/String/InterpolatedStringOffsideInNestedLet.fs.bsl index d8e5ea12eab..5de04dee2f6 100644 --- a/tests/service/data/SyntaxTree/String/InterpolatedStringOffsideInNestedLet.fs.bsl +++ b/tests/service/data/SyntaxTree/String/InterpolatedStringOffsideInNestedLet.fs.bsl @@ -13,7 +13,7 @@ ImplFile (None, SynValInfo ([], SynArgInfo ([], false, None)), None), Named (SynIdent (a, None), false, None, (1,4--1,5)), None, LetOrUse - (false, false, + (false, false, true, false, [SynBinding (None, Normal, false, false, [], PreXmlDoc ((2,4), FSharp.Compiler.Xml.XmlDocCollector), diff --git a/tests/service/data/SyntaxTree/SynType/Typed LetBang 01.fs.bsl b/tests/service/data/SyntaxTree/SynType/Typed LetBang 01.fs.bsl index e0c44d14f8a..0f4d273e213 100644 --- a/tests/service/data/SyntaxTree/SynType/Typed LetBang 01.fs.bsl +++ b/tests/service/data/SyntaxTree/SynType/Typed LetBang 01.fs.bsl @@ -8,21 +8,31 @@ ImplFile (NonAtomic, false, Ident async, ComputationExpr (false, - LetOrUseBang - (Yes (4,4--4,38), false, true, - Typed - (Named (SynIdent (res, None), false, None, (4,9--4,12)), - LongIdent (SynLongIdent ([int], [], [None])), - (4,9--4,17)), - App - (NonAtomic, false, Ident async, - ComputationExpr - (false, - YieldOrReturn - ((false, true), Const (Int32 1, (4,35--4,36)), - (4,28--4,36), - { YieldOrReturnKeyword = (4,28--4,34) }), - (4,26--4,38)), (4,20--4,38)), [], + LetOrUse + (false, false, true, true, + [SynBinding + (None, Normal, false, false, [], PreXmlDocEmpty, + SynValData + (None, + SynValInfo ([], SynArgInfo ([], false, None)), + None), + Typed + (Named + (SynIdent (res, None), false, None, (4,9--4,12)), + LongIdent (SynLongIdent ([int], [], [None])), + (4,9--4,17)), None, + App + (NonAtomic, false, Ident async, + ComputationExpr + (false, + YieldOrReturn + ((false, true), Const (Int32 1, (4,35--4,36)), + (4,28--4,36), + { YieldOrReturnKeyword = (4,28--4,34) }), + (4,26--4,38)), (4,20--4,38)), (4,4--5,14), + Yes (4,4--4,38), { LeadingKeyword = Let (4,4--4,8) + InlineKeyword = None + EqualsRange = Some (4,18--4,19) })], YieldOrReturn ((false, true), Ident res, (5,4--5,14), { YieldOrReturnKeyword = (5,4--5,10) }), (4,4--5,14), diff --git a/tests/service/data/SyntaxTree/SynType/Typed LetBang 02.fs.bsl b/tests/service/data/SyntaxTree/SynType/Typed LetBang 02.fs.bsl index a104e92410c..f8ad3261565 100644 --- a/tests/service/data/SyntaxTree/SynType/Typed LetBang 02.fs.bsl +++ b/tests/service/data/SyntaxTree/SynType/Typed LetBang 02.fs.bsl @@ -8,23 +8,33 @@ ImplFile (NonAtomic, false, Ident async, ComputationExpr (false, - LetOrUseBang - (Yes (4,4--4,40), false, true, - Paren - (Typed - (Named - (SynIdent (res, None), false, None, (4,10--4,13)), - LongIdent (SynLongIdent ([int], [], [None])), - (4,10--4,18)), (4,9--4,19)), - App - (NonAtomic, false, Ident async, - ComputationExpr - (false, - YieldOrReturn - ((false, true), Const (Int32 1, (4,37--4,38)), - (4,30--4,38), - { YieldOrReturnKeyword = (4,30--4,36) }), - (4,28--4,40)), (4,22--4,40)), [], + LetOrUse + (false, false, true, true, + [SynBinding + (None, Normal, false, false, [], PreXmlDocEmpty, + SynValData + (None, + SynValInfo ([], SynArgInfo ([], false, None)), + None), + Paren + (Typed + (Named + (SynIdent (res, None), false, None, + (4,10--4,13)), + LongIdent (SynLongIdent ([int], [], [None])), + (4,10--4,18)), (4,9--4,19)), None, + App + (NonAtomic, false, Ident async, + ComputationExpr + (false, + YieldOrReturn + ((false, true), Const (Int32 1, (4,37--4,38)), + (4,30--4,38), + { YieldOrReturnKeyword = (4,30--4,36) }), + (4,28--4,40)), (4,22--4,40)), (4,4--5,14), + Yes (4,4--4,40), { LeadingKeyword = Let (4,4--4,8) + InlineKeyword = None + EqualsRange = Some (4,20--4,21) })], YieldOrReturn ((false, true), Ident res, (5,4--5,14), { YieldOrReturnKeyword = (5,4--5,10) }), (4,4--5,14), diff --git a/tests/service/data/SyntaxTree/SynType/Typed LetBang 03.fs.bsl b/tests/service/data/SyntaxTree/SynType/Typed LetBang 03.fs.bsl index e0f29e22664..10dd0e5bd4f 100644 --- a/tests/service/data/SyntaxTree/SynType/Typed LetBang 03.fs.bsl +++ b/tests/service/data/SyntaxTree/SynType/Typed LetBang 03.fs.bsl @@ -9,7 +9,7 @@ ImplFile ComputationExpr (false, LetOrUse - (false, false, + (false, false, true, false, [SynBinding (None, Normal, false, false, [], PreXmlDoc ((4,4), FSharp.Compiler.Xml.XmlDocCollector), @@ -43,38 +43,50 @@ ImplFile { LeadingKeyword = Let (4,4--4,7) InlineKeyword = None EqualsRange = Some (4,25--4,26) })], - LetOrUseBang - (Yes (5,4--5,49), false, true, - Paren - (Tuple - (false, - [Typed - (Named - (SynIdent (c, None), false, None, - (5,10--5,11)), - LongIdent (SynLongIdent ([int], [], [None])), - (5,10--5,16)); - Typed - (Named - (SynIdent (d, None), false, None, - (5,18--5,19)), - LongIdent (SynLongIdent ([int], [], [None])), - (5,18--5,24))], [(5,16--5,17)], (5,10--5,24)), - (5,9--5,25)), - App - (NonAtomic, false, Ident async, - ComputationExpr - (false, - YieldOrReturn - ((false, true), - Tuple - (false, - [Const (Int32 1, (5,43--5,44)); - Const (Int32 3, (5,46--5,47))], - [(5,44--5,45)], (5,43--5,47)), - (5,36--5,47), - { YieldOrReturnKeyword = (5,36--5,42) }), - (5,34--5,49)), (5,28--5,49)), [], + LetOrUse + (false, false, true, true, + [SynBinding + (None, Normal, false, false, [], PreXmlDocEmpty, + SynValData + (None, + SynValInfo ([], SynArgInfo ([], false, None)), + None), + Paren + (Tuple + (false, + [Typed + (Named + (SynIdent (c, None), false, None, + (5,10--5,11)), + LongIdent + (SynLongIdent ([int], [], [None])), + (5,10--5,16)); + Typed + (Named + (SynIdent (d, None), false, None, + (5,18--5,19)), + LongIdent + (SynLongIdent ([int], [], [None])), + (5,18--5,24))], [(5,16--5,17)], + (5,10--5,24)), (5,9--5,25)), None, + App + (NonAtomic, false, Ident async, + ComputationExpr + (false, + YieldOrReturn + ((false, true), + Tuple + (false, + [Const (Int32 1, (5,43--5,44)); + Const (Int32 3, (5,46--5,47))], + [(5,44--5,45)], (5,43--5,47)), + (5,36--5,47), + { YieldOrReturnKeyword = (5,36--5,42) }), + (5,34--5,49)), (5,28--5,49)), (5,4--6,24), + Yes (5,4--5,49), + { LeadingKeyword = Let (5,4--5,8) + InlineKeyword = None + EqualsRange = Some (5,26--5,27) })], YieldOrReturn ((false, true), App diff --git a/tests/service/data/SyntaxTree/SynType/Typed LetBang 04.fs.bsl b/tests/service/data/SyntaxTree/SynType/Typed LetBang 04.fs.bsl index cd28aa03595..cf228ae258e 100644 --- a/tests/service/data/SyntaxTree/SynType/Typed LetBang 04.fs.bsl +++ b/tests/service/data/SyntaxTree/SynType/Typed LetBang 04.fs.bsl @@ -11,7 +11,7 @@ ImplFile Tuple (false, [LetOrUse - (false, false, + (false, false, true, false, [SynBinding (None, Normal, false, false, [], PreXmlDoc ((4,4), FSharp.Compiler.Xml.XmlDocCollector), diff --git a/tests/service/data/SyntaxTree/SynType/Typed LetBang 05.fs.bsl b/tests/service/data/SyntaxTree/SynType/Typed LetBang 05.fs.bsl index d93e009f5d7..d56b8878728 100644 --- a/tests/service/data/SyntaxTree/SynType/Typed LetBang 05.fs.bsl +++ b/tests/service/data/SyntaxTree/SynType/Typed LetBang 05.fs.bsl @@ -4,35 +4,54 @@ ImplFile [SynModuleOrNamespace ([Module], false, NamedModule, [Expr - (LetOrUseBang - (Yes (2,0--2,31), false, true, - Typed - (Named (SynIdent (x, None), false, None, (2,5--2,6)), - LongIdent (SynLongIdent ([int], [], [None])), (2,5--2,10)), - App - (NonAtomic, false, Ident async, - ComputationExpr - (false, - YieldOrReturn - ((false, true), Const (Int32 1, (2,28--2,29)), - (2,21--2,29), { YieldOrReturnKeyword = (2,21--2,27) }), - (2,19--2,31)), (2,13--2,31)), [], - LetOrUseBang - (Yes (3,0--3,33), false, true, - Paren - (Typed - (Named (SynIdent (y, None), false, None, (3,6--3,7)), - LongIdent (SynLongIdent ([int], [], [None])), - (3,6--3,11)), (3,5--3,12)), - App - (NonAtomic, false, Ident async, - ComputationExpr - (false, - YieldOrReturn - ((false, true), Const (Int32 2, (3,30--3,31)), - (3,23--3,31), - { YieldOrReturnKeyword = (3,23--3,29) }), - (3,21--3,33)), (3,15--3,33)), [], + (LetOrUse + (false, false, true, true, + [SynBinding + (None, Normal, false, false, [], PreXmlDocEmpty, + SynValData + (None, SynValInfo ([], SynArgInfo ([], false, None)), + None), + Typed + (Named (SynIdent (x, None), false, None, (2,5--2,6)), + LongIdent (SynLongIdent ([int], [], [None])), + (2,5--2,10)), None, + App + (NonAtomic, false, Ident async, + ComputationExpr + (false, + YieldOrReturn + ((false, true), Const (Int32 1, (2,28--2,29)), + (2,21--2,29), + { YieldOrReturnKeyword = (2,21--2,27) }), + (2,19--2,31)), (2,13--2,31)), (2,0--3,33), + Yes (2,0--2,31), { LeadingKeyword = Let (2,0--2,4) + InlineKeyword = None + EqualsRange = Some (2,11--2,12) })], + LetOrUse + (false, false, true, true, + [SynBinding + (None, Normal, false, false, [], PreXmlDocEmpty, + SynValData + (None, SynValInfo ([], SynArgInfo ([], false, None)), + None), + Paren + (Typed + (Named + (SynIdent (y, None), false, None, (3,6--3,7)), + LongIdent (SynLongIdent ([int], [], [None])), + (3,6--3,11)), (3,5--3,12)), None, + App + (NonAtomic, false, Ident async, + ComputationExpr + (false, + YieldOrReturn + ((false, true), Const (Int32 2, (3,30--3,31)), + (3,23--3,31), + { YieldOrReturnKeyword = (3,23--3,29) }), + (3,21--3,33)), (3,15--3,33)), (3,0--3,33), + Yes (3,0--3,33), { LeadingKeyword = Let (3,0--3,4) + InlineKeyword = None + EqualsRange = Some (3,13--3,14) })], ImplicitZero (3,33--3,33), (3,0--3,33), { LetOrUseKeyword = (3,0--3,4) InKeyword = None diff --git a/tests/service/data/SyntaxTree/SynType/Typed LetBang 06.fs.bsl b/tests/service/data/SyntaxTree/SynType/Typed LetBang 06.fs.bsl index 77623805e3a..35f0c186578 100644 --- a/tests/service/data/SyntaxTree/SynType/Typed LetBang 06.fs.bsl +++ b/tests/service/data/SyntaxTree/SynType/Typed LetBang 06.fs.bsl @@ -4,35 +4,53 @@ ImplFile [SynModuleOrNamespace ([Module], false, NamedModule, [Expr - (LetOrUseBang - (Yes (2,0--2,31), false, true, - Typed - (Wild (2,5--2,6), - LongIdent (SynLongIdent ([int], [], [None])), (2,5--2,10)), - App - (NonAtomic, false, Ident async, - ComputationExpr - (false, - YieldOrReturn - ((false, true), Const (Int32 1, (2,28--2,29)), - (2,21--2,29), { YieldOrReturnKeyword = (2,21--2,27) }), - (2,19--2,31)), (2,13--2,31)), [], - LetOrUseBang - (Yes (3,0--3,33), false, true, - Paren - (Typed - (Wild (3,6--3,7), - LongIdent (SynLongIdent ([int], [], [None])), - (3,6--3,11)), (3,5--3,12)), - App - (NonAtomic, false, Ident async, - ComputationExpr - (false, - YieldOrReturn - ((false, true), Const (Int32 2, (3,30--3,31)), - (3,23--3,31), - { YieldOrReturnKeyword = (3,23--3,29) }), - (3,21--3,33)), (3,15--3,33)), [], + (LetOrUse + (false, false, true, true, + [SynBinding + (None, Normal, false, false, [], PreXmlDocEmpty, + SynValData + (None, SynValInfo ([], SynArgInfo ([], false, None)), + None), + Typed + (Wild (2,5--2,6), + LongIdent (SynLongIdent ([int], [], [None])), + (2,5--2,10)), None, + App + (NonAtomic, false, Ident async, + ComputationExpr + (false, + YieldOrReturn + ((false, true), Const (Int32 1, (2,28--2,29)), + (2,21--2,29), + { YieldOrReturnKeyword = (2,21--2,27) }), + (2,19--2,31)), (2,13--2,31)), (2,0--3,33), + Yes (2,0--2,31), { LeadingKeyword = Let (2,0--2,4) + InlineKeyword = None + EqualsRange = Some (2,11--2,12) })], + LetOrUse + (false, false, true, true, + [SynBinding + (None, Normal, false, false, [], PreXmlDocEmpty, + SynValData + (None, SynValInfo ([], SynArgInfo ([], false, None)), + None), + Paren + (Typed + (Wild (3,6--3,7), + LongIdent (SynLongIdent ([int], [], [None])), + (3,6--3,11)), (3,5--3,12)), None, + App + (NonAtomic, false, Ident async, + ComputationExpr + (false, + YieldOrReturn + ((false, true), Const (Int32 2, (3,30--3,31)), + (3,23--3,31), + { YieldOrReturnKeyword = (3,23--3,29) }), + (3,21--3,33)), (3,15--3,33)), (3,0--3,33), + Yes (3,0--3,33), { LeadingKeyword = Let (3,0--3,4) + InlineKeyword = None + EqualsRange = Some (3,13--3,14) })], ImplicitZero (3,33--3,33), (3,0--3,33), { LetOrUseKeyword = (3,0--3,4) InKeyword = None diff --git a/tests/service/data/SyntaxTree/SynType/Typed LetBang 07.fs.bsl b/tests/service/data/SyntaxTree/SynType/Typed LetBang 07.fs.bsl index ec976f9d78d..0abee0c68bc 100644 --- a/tests/service/data/SyntaxTree/SynType/Typed LetBang 07.fs.bsl +++ b/tests/service/data/SyntaxTree/SynType/Typed LetBang 07.fs.bsl @@ -8,20 +8,30 @@ ImplFile (NonAtomic, false, Ident async, ComputationExpr (false, - LetOrUseBang - (Yes (3,4--3,50), false, true, - Paren - (Typed - (Record - ([(([], Name), Some (3,17--3,18), - Named - (SynIdent (name, None), false, None, - (3,19--3,23)))], (3,10--3,25)), - LongIdent (SynLongIdent ([Person], [], [None])), - (3,10--3,33)), (3,9--3,34)), - App - (Atomic, false, Ident asyncPerson, - Const (Unit, (3,48--3,50)), (3,37--3,50)), [], + LetOrUse + (false, false, true, true, + [SynBinding + (None, Normal, false, false, [], PreXmlDocEmpty, + SynValData + (None, + SynValInfo ([], SynArgInfo ([], false, None)), + None), + Paren + (Typed + (Record + ([(([], Name), Some (3,17--3,18), + Named + (SynIdent (name, None), false, None, + (3,19--3,23)))], (3,10--3,25)), + LongIdent (SynLongIdent ([Person], [], [None])), + (3,10--3,33)), (3,9--3,34)), None, + App + (Atomic, false, Ident asyncPerson, + Const (Unit, (3,48--3,50)), (3,37--3,50)), + (3,4--5,15), Yes (3,4--3,50), + { LeadingKeyword = Let (3,4--3,8) + InlineKeyword = None + EqualsRange = Some (3,35--3,36) })], YieldOrReturn ((false, true), Ident name, (5,4--5,15), { YieldOrReturnKeyword = (5,4--5,10) }), (3,4--5,15), diff --git a/tests/service/data/SyntaxTree/SynType/Typed LetBang 08.fs.bsl b/tests/service/data/SyntaxTree/SynType/Typed LetBang 08.fs.bsl index df08719e64d..8bb584f47e5 100644 --- a/tests/service/data/SyntaxTree/SynType/Typed LetBang 08.fs.bsl +++ b/tests/service/data/SyntaxTree/SynType/Typed LetBang 08.fs.bsl @@ -8,19 +8,29 @@ ImplFile (NonAtomic, false, Ident async, ComputationExpr (false, - LetOrUseBang - (Yes (3,4--3,48), false, true, - Typed - (Record - ([(([], Name), Some (3,16--3,17), - Named - (SynIdent (name, None), false, None, - (3,18--3,22)))], (3,9--3,24)), - LongIdent (SynLongIdent ([Person], [], [None])), - (3,9--3,32)), - App - (Atomic, false, Ident asyncPerson, - Const (Unit, (3,46--3,48)), (3,35--3,48)), [], + LetOrUse + (false, false, true, true, + [SynBinding + (None, Normal, false, false, [], PreXmlDocEmpty, + SynValData + (None, + SynValInfo ([], SynArgInfo ([], false, None)), + None), + Typed + (Record + ([(([], Name), Some (3,16--3,17), + Named + (SynIdent (name, None), false, None, + (3,18--3,22)))], (3,9--3,24)), + LongIdent (SynLongIdent ([Person], [], [None])), + (3,9--3,32)), None, + App + (Atomic, false, Ident asyncPerson, + Const (Unit, (3,46--3,48)), (3,35--3,48)), + (3,4--4,15), Yes (3,4--3,48), + { LeadingKeyword = Let (3,4--3,8) + InlineKeyword = None + EqualsRange = Some (3,33--3,34) })], YieldOrReturn ((false, true), Ident name, (4,4--4,15), { YieldOrReturnKeyword = (4,4--4,10) }), (3,4--4,15), diff --git a/tests/service/data/SyntaxTree/SynType/Typed LetBang 09.fs.bsl b/tests/service/data/SyntaxTree/SynType/Typed LetBang 09.fs.bsl index f60b9363710..f763aa8321c 100644 --- a/tests/service/data/SyntaxTree/SynType/Typed LetBang 09.fs.bsl +++ b/tests/service/data/SyntaxTree/SynType/Typed LetBang 09.fs.bsl @@ -8,19 +8,29 @@ ImplFile (NonAtomic, false, Ident async, ComputationExpr (false, - LetOrUseBang - (Yes (3,4--3,38), false, true, - Paren - (LongIdent - (SynLongIdent ([Union], [], [None]), None, None, - Pats - [Named - (SynIdent (value, None), false, None, - (3,16--3,21))], None, (3,10--3,21)), - (3,9--3,22)), - App - (Atomic, false, Ident asyncOption, - Const (Unit, (3,36--3,38)), (3,25--3,38)), [], + LetOrUse + (false, false, true, true, + [SynBinding + (None, Normal, false, false, [], PreXmlDocEmpty, + SynValData + (None, + SynValInfo ([], SynArgInfo ([], false, None)), + None), + Paren + (LongIdent + (SynLongIdent ([Union], [], [None]), None, None, + Pats + [Named + (SynIdent (value, None), false, None, + (3,16--3,21))], None, (3,10--3,21)), + (3,9--3,22)), None, + App + (Atomic, false, Ident asyncOption, + Const (Unit, (3,36--3,38)), (3,25--3,38)), + (3,4--4,16), Yes (3,4--3,38), + { LeadingKeyword = Let (3,4--3,8) + InlineKeyword = None + EqualsRange = Some (3,23--3,24) })], YieldOrReturn ((false, true), Ident value, (4,4--4,16), { YieldOrReturnKeyword = (4,4--4,10) }), (3,4--4,16), diff --git a/tests/service/data/SyntaxTree/SynType/Typed LetBang 10.fs.bsl b/tests/service/data/SyntaxTree/SynType/Typed LetBang 10.fs.bsl index 43d9f3e2fe9..2547a09caba 100644 --- a/tests/service/data/SyntaxTree/SynType/Typed LetBang 10.fs.bsl +++ b/tests/service/data/SyntaxTree/SynType/Typed LetBang 10.fs.bsl @@ -8,17 +8,27 @@ ImplFile (NonAtomic, false, Ident async, ComputationExpr (false, - LetOrUseBang - (Yes (3,4--3,36), false, true, - LongIdent - (SynLongIdent ([Union], [], [None]), None, None, - Pats - [Named - (SynIdent (value, None), false, None, - (3,15--3,20))], None, (3,9--3,20)), - App - (Atomic, false, Ident asyncOption, - Const (Unit, (3,34--3,36)), (3,23--3,36)), [], + LetOrUse + (false, false, true, true, + [SynBinding + (None, Normal, false, false, [], PreXmlDocEmpty, + SynValData + (None, + SynValInfo ([], SynArgInfo ([], false, None)), + None), + LongIdent + (SynLongIdent ([Union], [], [None]), None, None, + Pats + [Named + (SynIdent (value, None), false, None, + (3,15--3,20))], None, (3,9--3,20)), None, + App + (Atomic, false, Ident asyncOption, + Const (Unit, (3,34--3,36)), (3,23--3,36)), + (3,4--4,16), Yes (3,4--3,36), + { LeadingKeyword = Let (3,4--3,8) + InlineKeyword = None + EqualsRange = Some (3,21--3,22) })], YieldOrReturn ((false, true), Ident value, (4,4--4,16), { YieldOrReturnKeyword = (4,4--4,10) }), (3,4--4,16), diff --git a/tests/service/data/SyntaxTree/SynType/Typed LetBang 11.fs.bsl b/tests/service/data/SyntaxTree/SynType/Typed LetBang 11.fs.bsl index 10b908ae70f..d6dd478ef51 100644 --- a/tests/service/data/SyntaxTree/SynType/Typed LetBang 11.fs.bsl +++ b/tests/service/data/SyntaxTree/SynType/Typed LetBang 11.fs.bsl @@ -8,25 +8,37 @@ ImplFile (NonAtomic, false, Ident async, ComputationExpr (false, - LetOrUseBang - (Yes (3,4--3,50), false, true, - Typed - (Paren - (LongIdent - (SynLongIdent ([Union], [], [None]), None, None, - Pats - [Named - (SynIdent (value, None), false, None, - (3,16--3,21))], None, (3,10--3,21)), - (3,9--3,22)), - App - (LongIdent (SynLongIdent ([option], [], [None])), - None, - [LongIdent (SynLongIdent ([int], [], [None]))], [], - None, true, (3,24--3,34)), (3,9--3,34)), - App - (Atomic, false, Ident asyncOption, - Const (Unit, (3,48--3,50)), (3,37--3,50)), [], + LetOrUse + (false, false, true, true, + [SynBinding + (None, Normal, false, false, [], PreXmlDocEmpty, + SynValData + (None, + SynValInfo ([], SynArgInfo ([], false, None)), + None), + Typed + (Paren + (LongIdent + (SynLongIdent ([Union], [], [None]), None, + None, + Pats + [Named + (SynIdent (value, None), false, None, + (3,16--3,21))], None, (3,10--3,21)), + (3,9--3,22)), + App + (LongIdent (SynLongIdent ([option], [], [None])), + None, + [LongIdent (SynLongIdent ([int], [], [None]))], + [], None, true, (3,24--3,34)), (3,9--3,34)), + None, + App + (Atomic, false, Ident asyncOption, + Const (Unit, (3,48--3,50)), (3,37--3,50)), + (3,4--4,16), Yes (3,4--3,50), + { LeadingKeyword = Let (3,4--3,8) + InlineKeyword = None + EqualsRange = Some (3,35--3,36) })], YieldOrReturn ((false, true), Ident value, (4,4--4,16), { YieldOrReturnKeyword = (4,4--4,10) }), (3,4--4,16), diff --git a/tests/service/data/SyntaxTree/SynType/Typed LetBang 12.fs.bsl b/tests/service/data/SyntaxTree/SynType/Typed LetBang 12.fs.bsl index 129c53c43f2..d5577c184d6 100644 --- a/tests/service/data/SyntaxTree/SynType/Typed LetBang 12.fs.bsl +++ b/tests/service/data/SyntaxTree/SynType/Typed LetBang 12.fs.bsl @@ -8,23 +8,34 @@ ImplFile (NonAtomic, false, Ident async, ComputationExpr (false, - LetOrUseBang - (Yes (3,4--3,48), false, true, - Typed - (LongIdent - (SynLongIdent ([Union], [], [None]), None, None, - Pats - [Named - (SynIdent (value, None), false, None, - (3,15--3,20))], None, (3,9--3,20)), - App - (LongIdent (SynLongIdent ([option], [], [None])), - None, - [LongIdent (SynLongIdent ([int], [], [None]))], [], - None, true, (3,22--3,32)), (3,9--3,32)), - App - (Atomic, false, Ident asyncOption, - Const (Unit, (3,46--3,48)), (3,35--3,48)), [], + LetOrUse + (false, false, true, true, + [SynBinding + (None, Normal, false, false, [], PreXmlDocEmpty, + SynValData + (None, + SynValInfo ([], SynArgInfo ([], false, None)), + None), + Typed + (LongIdent + (SynLongIdent ([Union], [], [None]), None, None, + Pats + [Named + (SynIdent (value, None), false, None, + (3,15--3,20))], None, (3,9--3,20)), + App + (LongIdent (SynLongIdent ([option], [], [None])), + None, + [LongIdent (SynLongIdent ([int], [], [None]))], + [], None, true, (3,22--3,32)), (3,9--3,32)), + None, + App + (Atomic, false, Ident asyncOption, + Const (Unit, (3,46--3,48)), (3,35--3,48)), + (3,4--4,16), Yes (3,4--3,48), + { LeadingKeyword = Let (3,4--3,8) + InlineKeyword = None + EqualsRange = Some (3,33--3,34) })], YieldOrReturn ((false, true), Ident value, (4,4--4,16), { YieldOrReturnKeyword = (4,4--4,10) }), (3,4--4,16), diff --git a/tests/service/data/SyntaxTree/SynType/Typed LetBang 14.fs.bsl b/tests/service/data/SyntaxTree/SynType/Typed LetBang 14.fs.bsl index cbb7adec174..e51ad87b8e7 100644 --- a/tests/service/data/SyntaxTree/SynType/Typed LetBang 14.fs.bsl +++ b/tests/service/data/SyntaxTree/SynType/Typed LetBang 14.fs.bsl @@ -8,21 +8,32 @@ ImplFile (NonAtomic, false, Ident async, ComputationExpr (false, - LetOrUseBang - (Yes (4,4--4,31), false, true, - Typed - (Paren - (As - (Named - (SynIdent (x, None), false, None, (4,10--4,11)), - Named - (SynIdent (y, None), false, None, (4,15--4,16)), - (4,10--4,16)), (4,9--4,17)), - FromParseError (4,18--4,18), (4,9--4,18)), - App - (Atomic, false, Ident asyncInt, - Const (Unit, (4,29--4,31)), (4,21--4,31)), + LetOrUse + (false, false, true, true, [SynBinding + (None, Normal, false, false, [], PreXmlDocEmpty, + SynValData + (None, + SynValInfo ([], SynArgInfo ([], false, None)), + None), + Typed + (Paren + (As + (Named + (SynIdent (x, None), false, None, + (4,10--4,11)), + Named + (SynIdent (y, None), false, None, + (4,15--4,16)), (4,10--4,16)), (4,9--4,17)), + FromParseError (4,18--4,18), (4,9--4,18)), None, + App + (Atomic, false, Ident asyncInt, + Const (Unit, (4,29--4,31)), (4,21--4,31)), + (4,4--6,16), Yes (4,4--4,31), + { LeadingKeyword = Let (4,4--4,8) + InlineKeyword = None + EqualsRange = Some (4,19--4,20) }); + SynBinding (None, Normal, false, false, [], PreXmlDocEmpty, SynValData (None, diff --git a/tests/service/data/SyntaxTree/SynType/Typed LetBang 15.fs.bsl b/tests/service/data/SyntaxTree/SynType/Typed LetBang 15.fs.bsl index a199310f6a3..722bf1ceb6a 100644 --- a/tests/service/data/SyntaxTree/SynType/Typed LetBang 15.fs.bsl +++ b/tests/service/data/SyntaxTree/SynType/Typed LetBang 15.fs.bsl @@ -8,20 +8,31 @@ ImplFile (NonAtomic, false, Ident async, ComputationExpr (false, - LetOrUseBang - (Yes (4,4--5,41), false, true, - Typed - (Paren - (As - (Named - (SynIdent (x, None), false, None, (4,10--4,11)), - Named - (SynIdent (y, None), false, None, (4,15--4,16)), - (4,10--4,16)), (4,9--4,17)), - FromParseError (4,18--4,18), (4,9--4,18)), - App - (Atomic, false, Ident asyncString, - Const (Unit, (5,39--5,41)), (5,28--5,41)), [], + LetOrUse + (false, false, true, true, + [SynBinding + (None, Normal, false, false, [], PreXmlDocEmpty, + SynValData + (None, + SynValInfo ([], SynArgInfo ([], false, None)), + None), + Typed + (Paren + (As + (Named + (SynIdent (x, None), false, None, + (4,10--4,11)), + Named + (SynIdent (y, None), false, None, + (4,15--4,16)), (4,10--4,16)), (4,9--4,17)), + FromParseError (4,18--4,18), (4,9--4,18)), None, + App + (Atomic, false, Ident asyncString, + Const (Unit, (5,39--5,41)), (5,28--5,41)), + (4,4--6,16), Yes (4,4--5,41), + { LeadingKeyword = Let (4,4--4,8) + InlineKeyword = None + EqualsRange = Some (5,26--5,27) })], YieldOrReturn ((false, true), App diff --git a/tests/service/data/SyntaxTree/SynType/Typed LetBang 17.fs.bsl b/tests/service/data/SyntaxTree/SynType/Typed LetBang 17.fs.bsl index 25505e0b9e6..b6adc9e3f2f 100644 --- a/tests/service/data/SyntaxTree/SynType/Typed LetBang 17.fs.bsl +++ b/tests/service/data/SyntaxTree/SynType/Typed LetBang 17.fs.bsl @@ -25,26 +25,36 @@ ImplFile InlineKeyword = None EqualsRange = Some (3,21--3,22) })], (3,0--3,24)); Expr - (LetOrUseBang - (Yes (5,0--5,42), false, true, - Paren - (Typed - (As - (LongIdent - (SynLongIdent ([Even], [], [None]), None, None, - Pats [], None, (5,6--5,10)), - Named (SynIdent (x, None), false, None, (5,14--5,15)), - (5,6--5,15)), - LongIdent (SynLongIdent ([int], [], [None])), (5,6--5,20)), - (5,5--5,21)), - App - (NonAtomic, false, Ident async, - ComputationExpr - (false, - YieldOrReturn - ((false, true), Const (Int32 2, (5,39--5,40)), - (5,32--5,40), { YieldOrReturnKeyword = (5,32--5,38) }), - (5,30--5,42)), (5,24--5,42)), [], + (LetOrUse + (false, false, true, true, + [SynBinding + (None, Normal, false, false, [], PreXmlDocEmpty, + SynValData + (None, SynValInfo ([], SynArgInfo ([], false, None)), + None), + Paren + (Typed + (As + (LongIdent + (SynLongIdent ([Even], [], [None]), None, None, + Pats [], None, (5,6--5,10)), + Named + (SynIdent (x, None), false, None, (5,14--5,15)), + (5,6--5,15)), + LongIdent (SynLongIdent ([int], [], [None])), + (5,6--5,20)), (5,5--5,21)), None, + App + (NonAtomic, false, Ident async, + ComputationExpr + (false, + YieldOrReturn + ((false, true), Const (Int32 2, (5,39--5,40)), + (5,32--5,40), + { YieldOrReturnKeyword = (5,32--5,38) }), + (5,30--5,42)), (5,24--5,42)), (5,0--5,42), + Yes (5,0--5,42), { LeadingKeyword = Let (5,0--5,4) + InlineKeyword = None + EqualsRange = Some (5,22--5,23) })], ImplicitZero (5,42--5,42), (5,0--5,42), { LetOrUseKeyword = (5,0--5,4) InKeyword = None diff --git a/tests/service/data/SyntaxTree/SynType/Typed LetBang 18.fs.bsl b/tests/service/data/SyntaxTree/SynType/Typed LetBang 18.fs.bsl index 180faf48052..1acf38da849 100644 --- a/tests/service/data/SyntaxTree/SynType/Typed LetBang 18.fs.bsl +++ b/tests/service/data/SyntaxTree/SynType/Typed LetBang 18.fs.bsl @@ -28,24 +28,34 @@ ImplFile InlineKeyword = None EqualsRange = Some (3,19--3,20) })], (3,0--3,22)); Expr - (LetOrUseBang - (Yes (5,0--5,40), false, true, - Typed - (As - (LongIdent - (SynLongIdent ([Even], [], [None]), None, None, Pats [], - None, (5,5--5,9)), - Named (SynIdent (x, None), false, None, (5,13--5,14)), - (5,5--5,14)), - LongIdent (SynLongIdent ([int], [], [None])), (5,5--5,19)), - App - (NonAtomic, false, Ident async, - ComputationExpr - (false, - YieldOrReturn - ((false, true), Const (Int32 2, (5,37--5,38)), - (5,30--5,38), { YieldOrReturnKeyword = (5,30--5,36) }), - (5,28--5,40)), (5,22--5,40)), [], + (LetOrUse + (false, false, true, true, + [SynBinding + (None, Normal, false, false, [], PreXmlDocEmpty, + SynValData + (None, SynValInfo ([], SynArgInfo ([], false, None)), + None), + Typed + (As + (LongIdent + (SynLongIdent ([Even], [], [None]), None, None, + Pats [], None, (5,5--5,9)), + Named (SynIdent (x, None), false, None, (5,13--5,14)), + (5,5--5,14)), + LongIdent (SynLongIdent ([int], [], [None])), + (5,5--5,19)), None, + App + (NonAtomic, false, Ident async, + ComputationExpr + (false, + YieldOrReturn + ((false, true), Const (Int32 2, (5,37--5,38)), + (5,30--5,38), + { YieldOrReturnKeyword = (5,30--5,36) }), + (5,28--5,40)), (5,22--5,40)), (5,0--5,40), + Yes (5,0--5,40), { LeadingKeyword = Let (5,0--5,4) + InlineKeyword = None + EqualsRange = Some (5,20--5,21) })], ImplicitZero (5,40--5,40), (5,0--5,40), { LetOrUseKeyword = (5,0--5,4) InKeyword = None diff --git a/tests/service/data/SyntaxTree/SynType/Typed LetBang 19.fs.bsl b/tests/service/data/SyntaxTree/SynType/Typed LetBang 19.fs.bsl index ecd65b24301..435268c269e 100644 --- a/tests/service/data/SyntaxTree/SynType/Typed LetBang 19.fs.bsl +++ b/tests/service/data/SyntaxTree/SynType/Typed LetBang 19.fs.bsl @@ -9,7 +9,7 @@ ImplFile ComputationExpr (false, LetOrUse - (false, false, + (false, false, true, false, [SynBinding (None, Normal, false, false, [], PreXmlDoc ((4,4), FSharp.Compiler.Xml.XmlDocCollector), @@ -32,28 +32,40 @@ ImplFile Yes (4,4--4,28), { LeadingKeyword = Let (4,4--4,7) InlineKeyword = None EqualsRange = Some (4,25--4,26) })], - LetOrUseBang - (Yes (5,4--5,46), false, true, - Paren - (Typed - (As - (LongIdent - (SynLongIdent ([Even], [], [None]), None, - None, Pats [], None, (5,10--5,14)), - Named - (SynIdent (x, None), false, None, - (5,18--5,19)), (5,10--5,19)), - LongIdent (SynLongIdent ([int], [], [None])), - (5,10--5,24)), (5,9--5,25)), - App - (NonAtomic, false, Ident async, - ComputationExpr - (false, - YieldOrReturn - ((false, true), Const (Int32 2, (5,43--5,44)), - (5,36--5,44), - { YieldOrReturnKeyword = (5,36--5,42) }), - (5,34--5,46)), (5,28--5,46)), [], + LetOrUse + (false, false, true, true, + [SynBinding + (None, Normal, false, false, [], PreXmlDocEmpty, + SynValData + (None, + SynValInfo ([], SynArgInfo ([], false, None)), + None), + Paren + (Typed + (As + (LongIdent + (SynLongIdent ([Even], [], [None]), + None, None, Pats [], None, + (5,10--5,14)), + Named + (SynIdent (x, None), false, None, + (5,18--5,19)), (5,10--5,19)), + LongIdent (SynLongIdent ([int], [], [None])), + (5,10--5,24)), (5,9--5,25)), None, + App + (NonAtomic, false, Ident async, + ComputationExpr + (false, + YieldOrReturn + ((false, true), + Const (Int32 2, (5,43--5,44)), + (5,36--5,44), + { YieldOrReturnKeyword = (5,36--5,42) }), + (5,34--5,46)), (5,28--5,46)), (5,4--6,12), + Yes (5,4--5,46), + { LeadingKeyword = Let (5,4--5,8) + InlineKeyword = None + EqualsRange = Some (5,26--5,27) })], YieldOrReturn ((false, true), Ident x, (6,4--6,12), { YieldOrReturnKeyword = (6,4--6,10) }), diff --git a/tests/service/data/SyntaxTree/SynType/Typed LetBang 20.fs.bsl b/tests/service/data/SyntaxTree/SynType/Typed LetBang 20.fs.bsl index c9d8cdb5267..c456d218c52 100644 --- a/tests/service/data/SyntaxTree/SynType/Typed LetBang 20.fs.bsl +++ b/tests/service/data/SyntaxTree/SynType/Typed LetBang 20.fs.bsl @@ -9,7 +9,7 @@ ImplFile ComputationExpr (false, LetOrUse - (false, false, + (false, false, true, false, [SynBinding (None, Normal, false, false, [], PreXmlDoc ((4,4), FSharp.Compiler.Xml.XmlDocCollector), @@ -36,27 +36,38 @@ ImplFile { LeadingKeyword = Let (4,4--4,7) InlineKeyword = None EqualsRange = Some (4,23--4,24) })], - LetOrUseBang - (Yes (5,4--5,44), false, true, - Typed - (As - (LongIdent - (SynLongIdent ([Even], [], [None]), None, None, - Pats [], None, (5,9--5,13)), - Named - (SynIdent (x, None), false, None, (5,17--5,18)), - (5,9--5,18)), - LongIdent (SynLongIdent ([int], [], [None])), - (5,9--5,23)), - App - (NonAtomic, false, Ident async, - ComputationExpr - (false, - YieldOrReturn - ((false, true), Const (Int32 2, (5,41--5,42)), - (5,34--5,42), - { YieldOrReturnKeyword = (5,34--5,40) }), - (5,32--5,44)), (5,26--5,44)), [], + LetOrUse + (false, false, true, true, + [SynBinding + (None, Normal, false, false, [], PreXmlDocEmpty, + SynValData + (None, + SynValInfo ([], SynArgInfo ([], false, None)), + None), + Typed + (As + (LongIdent + (SynLongIdent ([Even], [], [None]), None, + None, Pats [], None, (5,9--5,13)), + Named + (SynIdent (x, None), false, None, + (5,17--5,18)), (5,9--5,18)), + LongIdent (SynLongIdent ([int], [], [None])), + (5,9--5,23)), None, + App + (NonAtomic, false, Ident async, + ComputationExpr + (false, + YieldOrReturn + ((false, true), + Const (Int32 2, (5,41--5,42)), + (5,34--5,42), + { YieldOrReturnKeyword = (5,34--5,40) }), + (5,32--5,44)), (5,26--5,44)), (5,4--6,12), + Yes (5,4--5,44), + { LeadingKeyword = Let (5,4--5,8) + InlineKeyword = None + EqualsRange = Some (5,24--5,25) })], YieldOrReturn ((false, true), Ident x, (6,4--6,12), { YieldOrReturnKeyword = (6,4--6,10) }), diff --git a/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 01.fs.bsl b/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 01.fs.bsl index 91fadaaff2b..e024a5f059e 100644 --- a/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 01.fs.bsl +++ b/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 01.fs.bsl @@ -9,22 +9,32 @@ ImplFile (NonAtomic, false, Ident async, ComputationExpr (false, - LetOrUseBang - (Yes (4,4--4,38), false, true, - Typed - (Named (SynIdent (res, None), false, None, (4,9--4,12)), - LongIdent (SynLongIdent ([int], [], [None])), - (4,9--4,17)), - App - (NonAtomic, false, Ident async, - ComputationExpr - (false, - YieldOrReturn - ((false, true), Const (Int32 1, (4,35--4,36)), - (4,28--4,36), - { YieldOrReturnKeyword = (4,28--4,34) }), - (4,26--4,38)), (4,20--4,38)), + LetOrUse + (false, false, true, true, [SynBinding + (None, Normal, false, false, [], PreXmlDocEmpty, + SynValData + (None, + SynValInfo ([], SynArgInfo ([], false, None)), + None), + Typed + (Named + (SynIdent (res, None), false, None, (4,9--4,12)), + LongIdent (SynLongIdent ([int], [], [None])), + (4,9--4,17)), None, + App + (NonAtomic, false, Ident async, + ComputationExpr + (false, + YieldOrReturn + ((false, true), Const (Int32 1, (4,35--4,36)), + (4,28--4,36), + { YieldOrReturnKeyword = (4,28--4,34) }), + (4,26--4,38)), (4,20--4,38)), (4,4--6,14), + Yes (4,4--4,38), { LeadingKeyword = Let (4,4--4,8) + InlineKeyword = None + EqualsRange = Some (4,18--4,19) }); + SynBinding (None, Normal, false, false, [], PreXmlDocEmpty, SynValData (None, diff --git a/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 02.fs.bsl b/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 02.fs.bsl index f8f8e2aa771..0f48a7eec0a 100644 --- a/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 02.fs.bsl +++ b/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 02.fs.bsl @@ -9,24 +9,34 @@ ImplFile (NonAtomic, false, Ident async, ComputationExpr (false, - LetOrUseBang - (Yes (4,4--4,40), false, true, - Paren - (Typed - (Named - (SynIdent (res, None), false, None, (4,10--4,13)), - LongIdent (SynLongIdent ([int], [], [None])), - (4,10--4,18)), (4,9--4,19)), - App - (NonAtomic, false, Ident async, - ComputationExpr - (false, - YieldOrReturn - ((false, true), Const (Int32 1, (4,37--4,38)), - (4,30--4,38), - { YieldOrReturnKeyword = (4,30--4,36) }), - (4,28--4,40)), (4,22--4,40)), + LetOrUse + (false, false, true, true, [SynBinding + (None, Normal, false, false, [], PreXmlDocEmpty, + SynValData + (None, + SynValInfo ([], SynArgInfo ([], false, None)), + None), + Paren + (Typed + (Named + (SynIdent (res, None), false, None, + (4,10--4,13)), + LongIdent (SynLongIdent ([int], [], [None])), + (4,10--4,18)), (4,9--4,19)), None, + App + (NonAtomic, false, Ident async, + ComputationExpr + (false, + YieldOrReturn + ((false, true), Const (Int32 1, (4,37--4,38)), + (4,30--4,38), + { YieldOrReturnKeyword = (4,30--4,36) }), + (4,28--4,40)), (4,22--4,40)), (4,4--6,14), + Yes (4,4--4,40), { LeadingKeyword = Let (4,4--4,8) + InlineKeyword = None + EqualsRange = Some (4,20--4,21) }); + SynBinding (None, Normal, false, false, [], PreXmlDocEmpty, SynValData (None, diff --git a/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 03.fs.bsl b/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 03.fs.bsl index d9f62d1ca24..9ce3159e223 100644 --- a/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 03.fs.bsl +++ b/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 03.fs.bsl @@ -9,25 +9,35 @@ ImplFile (NonAtomic, false, Ident async, ComputationExpr (false, - LetOrUseBang - (Yes (4,4--4,61), false, true, - Paren - (Typed - (Record - ([(([], Name), Some (4,17--4,18), - Named - (SynIdent (name, None), false, None, - (4,19--4,23))); - (([], Age), Some (4,29--4,30), - Named - (SynIdent (age, None), false, None, - (4,31--4,34)))], (4,10--4,36)), - LongIdent (SynLongIdent ([Person], [], [None])), - (4,10--4,44)), (4,9--4,45)), - App - (Atomic, false, Ident asyncPerson, - Const (Unit, (4,59--4,61)), (4,48--4,61)), + LetOrUse + (false, false, true, true, [SynBinding + (None, Normal, false, false, [], PreXmlDocEmpty, + SynValData + (None, + SynValInfo ([], SynArgInfo ([], false, None)), + None), + Paren + (Typed + (Record + ([(([], Name), Some (4,17--4,18), + Named + (SynIdent (name, None), false, None, + (4,19--4,23))); + (([], Age), Some (4,29--4,30), + Named + (SynIdent (age, None), false, None, + (4,31--4,34)))], (4,10--4,36)), + LongIdent (SynLongIdent ([Person], [], [None])), + (4,10--4,44)), (4,9--4,45)), None, + App + (Atomic, false, Ident asyncPerson, + Const (Unit, (4,59--4,61)), (4,48--4,61)), + (4,4--6,15), Yes (4,4--4,61), + { LeadingKeyword = Let (4,4--4,8) + InlineKeyword = None + EqualsRange = Some (4,46--4,47) }); + SynBinding (None, Normal, false, false, [], PreXmlDocEmpty, SynValData (None, diff --git a/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 04.fs.bsl b/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 04.fs.bsl index 17269172956..8f192d0e7f0 100644 --- a/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 04.fs.bsl +++ b/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 04.fs.bsl @@ -9,24 +9,34 @@ ImplFile (NonAtomic, false, Ident async, ComputationExpr (false, - LetOrUseBang - (Yes (4,4--4,59), false, true, - Typed - (Record - ([(([], Name), Some (4,16--4,17), - Named - (SynIdent (name, None), false, None, - (4,18--4,22))); - (([], Age), Some (4,28--4,29), - Named - (SynIdent (age, None), false, None, - (4,30--4,33)))], (4,9--4,35)), - LongIdent (SynLongIdent ([Person], [], [None])), - (4,9--4,43)), - App - (Atomic, false, Ident asyncPerson, - Const (Unit, (4,57--4,59)), (4,46--4,59)), + LetOrUse + (false, false, true, true, [SynBinding + (None, Normal, false, false, [], PreXmlDocEmpty, + SynValData + (None, + SynValInfo ([], SynArgInfo ([], false, None)), + None), + Typed + (Record + ([(([], Name), Some (4,16--4,17), + Named + (SynIdent (name, None), false, None, + (4,18--4,22))); + (([], Age), Some (4,28--4,29), + Named + (SynIdent (age, None), false, None, + (4,30--4,33)))], (4,9--4,35)), + LongIdent (SynLongIdent ([Person], [], [None])), + (4,9--4,43)), None, + App + (Atomic, false, Ident asyncPerson, + Const (Unit, (4,57--4,59)), (4,46--4,59)), + (4,4--6,15), Yes (4,4--4,59), + { LeadingKeyword = Let (4,4--4,8) + InlineKeyword = None + EqualsRange = Some (4,44--4,45) }); + SynBinding (None, Normal, false, false, [], PreXmlDocEmpty, SynValData (None, diff --git a/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 05.fs.bsl b/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 05.fs.bsl index e6d00ed2168..f1c41fa9742 100644 --- a/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 05.fs.bsl +++ b/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 05.fs.bsl @@ -9,25 +9,35 @@ ImplFile (NonAtomic, false, Ident async, ComputationExpr (false, - LetOrUseBang - (Yes (4,4--4,61), false, true, - Paren - (Typed - (Record - ([(([], Name), Some (4,17--4,18), - Named - (SynIdent (name, None), false, None, - (4,19--4,23))); - (([], Age), Some (4,29--4,30), - Named - (SynIdent (age, None), false, None, - (4,31--4,34)))], (4,10--4,36)), - LongIdent (SynLongIdent ([Person], [], [None])), - (4,10--4,44)), (4,9--4,45)), - App - (Atomic, false, Ident asyncPerson, - Const (Unit, (4,59--4,61)), (4,48--4,61)), + LetOrUse + (false, false, true, true, [SynBinding + (None, Normal, false, false, [], PreXmlDocEmpty, + SynValData + (None, + SynValInfo ([], SynArgInfo ([], false, None)), + None), + Paren + (Typed + (Record + ([(([], Name), Some (4,17--4,18), + Named + (SynIdent (name, None), false, None, + (4,19--4,23))); + (([], Age), Some (4,29--4,30), + Named + (SynIdent (age, None), false, None, + (4,31--4,34)))], (4,10--4,36)), + LongIdent (SynLongIdent ([Person], [], [None])), + (4,10--4,44)), (4,9--4,45)), None, + App + (Atomic, false, Ident asyncPerson, + Const (Unit, (4,59--4,61)), (4,48--4,61)), + (4,4--6,15), Yes (4,4--4,61), + { LeadingKeyword = Let (4,4--4,8) + InlineKeyword = None + EqualsRange = Some (4,46--4,47) }); + SynBinding (None, Normal, false, false, [], PreXmlDocEmpty, SynValData (None, diff --git a/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 06.fs.bsl b/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 06.fs.bsl index 739587c36e9..0f5bbd75f2e 100644 --- a/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 06.fs.bsl +++ b/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 06.fs.bsl @@ -9,20 +9,30 @@ ImplFile (NonAtomic, false, Ident async, ComputationExpr (false, - LetOrUseBang - (Yes (4,4--4,38), false, true, - Paren - (LongIdent - (SynLongIdent ([Union], [], [None]), None, None, - Pats - [Named - (SynIdent (value, None), false, None, - (4,16--4,21))], None, (4,10--4,21)), - (4,9--4,22)), - App - (Atomic, false, Ident asyncOption, - Const (Unit, (4,36--4,38)), (4,25--4,38)), + LetOrUse + (false, false, true, true, [SynBinding + (None, Normal, false, false, [], PreXmlDocEmpty, + SynValData + (None, + SynValInfo ([], SynArgInfo ([], false, None)), + None), + Paren + (LongIdent + (SynLongIdent ([Union], [], [None]), None, None, + Pats + [Named + (SynIdent (value, None), false, None, + (4,16--4,21))], None, (4,10--4,21)), + (4,9--4,22)), None, + App + (Atomic, false, Ident asyncOption, + Const (Unit, (4,36--4,38)), (4,25--4,38)), + (4,4--6,25), Yes (4,4--4,38), + { LeadingKeyword = Let (4,4--4,8) + InlineKeyword = None + EqualsRange = Some (4,23--4,24) }); + SynBinding (None, Normal, false, false, [], PreXmlDocEmpty, SynValData (None, diff --git a/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 07.fs.bsl b/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 07.fs.bsl index 6af2b1f92b1..2b1144262b2 100644 --- a/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 07.fs.bsl +++ b/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 07.fs.bsl @@ -9,18 +9,28 @@ ImplFile (NonAtomic, false, Ident async, ComputationExpr (false, - LetOrUseBang - (Yes (4,4--4,36), false, true, - LongIdent - (SynLongIdent ([Union], [], [None]), None, None, - Pats - [Named - (SynIdent (value, None), false, None, - (4,15--4,20))], None, (4,9--4,20)), - App - (Atomic, false, Ident asyncOption, - Const (Unit, (4,34--4,36)), (4,23--4,36)), + LetOrUse + (false, false, true, true, [SynBinding + (None, Normal, false, false, [], PreXmlDocEmpty, + SynValData + (None, + SynValInfo ([], SynArgInfo ([], false, None)), + None), + LongIdent + (SynLongIdent ([Union], [], [None]), None, None, + Pats + [Named + (SynIdent (value, None), false, None, + (4,15--4,20))], None, (4,9--4,20)), None, + App + (Atomic, false, Ident asyncOption, + Const (Unit, (4,34--4,36)), (4,23--4,36)), + (4,4--6,25), Yes (4,4--4,36), + { LeadingKeyword = Let (4,4--4,8) + InlineKeyword = None + EqualsRange = Some (4,21--4,22) }); + SynBinding (None, Normal, false, false, [], PreXmlDocEmpty, SynValData (None, diff --git a/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 08.fs.bsl b/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 08.fs.bsl index e583ae5852b..a0c25935ceb 100644 --- a/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 08.fs.bsl +++ b/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 08.fs.bsl @@ -9,26 +9,38 @@ ImplFile (NonAtomic, false, Ident async, ComputationExpr (false, - LetOrUseBang - (Yes (4,4--4,50), false, true, - Typed - (Paren - (LongIdent - (SynLongIdent ([Union], [], [None]), None, None, - Pats - [Named - (SynIdent (value, None), false, None, - (4,16--4,21))], None, (4,10--4,21)), - (4,9--4,22)), - App - (LongIdent (SynLongIdent ([option], [], [None])), - None, - [LongIdent (SynLongIdent ([int], [], [None]))], [], - None, true, (4,24--4,34)), (4,9--4,34)), - App - (Atomic, false, Ident asyncOption, - Const (Unit, (4,48--4,50)), (4,37--4,50)), + LetOrUse + (false, false, true, true, [SynBinding + (None, Normal, false, false, [], PreXmlDocEmpty, + SynValData + (None, + SynValInfo ([], SynArgInfo ([], false, None)), + None), + Typed + (Paren + (LongIdent + (SynLongIdent ([Union], [], [None]), None, + None, + Pats + [Named + (SynIdent (value, None), false, None, + (4,16--4,21))], None, (4,10--4,21)), + (4,9--4,22)), + App + (LongIdent (SynLongIdent ([option], [], [None])), + None, + [LongIdent (SynLongIdent ([int], [], [None]))], + [], None, true, (4,24--4,34)), (4,9--4,34)), + None, + App + (Atomic, false, Ident asyncOption, + Const (Unit, (4,48--4,50)), (4,37--4,50)), + (4,4--6,25), Yes (4,4--4,50), + { LeadingKeyword = Let (4,4--4,8) + InlineKeyword = None + EqualsRange = Some (4,35--4,36) }); + SynBinding (None, Normal, false, false, [], PreXmlDocEmpty, SynValData (None, diff --git a/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 09.fs.bsl b/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 09.fs.bsl index 2ab23d5029c..63d84252605 100644 --- a/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 09.fs.bsl +++ b/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 09.fs.bsl @@ -9,24 +9,35 @@ ImplFile (NonAtomic, false, Ident async, ComputationExpr (false, - LetOrUseBang - (Yes (4,4--4,48), false, true, - Typed - (LongIdent - (SynLongIdent ([Union], [], [None]), None, None, - Pats - [Named - (SynIdent (value, None), false, None, - (4,15--4,20))], None, (4,9--4,20)), - App - (LongIdent (SynLongIdent ([option], [], [None])), - None, - [LongIdent (SynLongIdent ([int], [], [None]))], [], - None, true, (4,22--4,32)), (4,9--4,32)), - App - (Atomic, false, Ident asyncOption, - Const (Unit, (4,46--4,48)), (4,35--4,48)), + LetOrUse + (false, false, true, true, [SynBinding + (None, Normal, false, false, [], PreXmlDocEmpty, + SynValData + (None, + SynValInfo ([], SynArgInfo ([], false, None)), + None), + Typed + (LongIdent + (SynLongIdent ([Union], [], [None]), None, None, + Pats + [Named + (SynIdent (value, None), false, None, + (4,15--4,20))], None, (4,9--4,20)), + App + (LongIdent (SynLongIdent ([option], [], [None])), + None, + [LongIdent (SynLongIdent ([int], [], [None]))], + [], None, true, (4,22--4,32)), (4,9--4,32)), + None, + App + (Atomic, false, Ident asyncOption, + Const (Unit, (4,46--4,48)), (4,35--4,48)), + (4,4--6,25), Yes (4,4--4,48), + { LeadingKeyword = Let (4,4--4,8) + InlineKeyword = None + EqualsRange = Some (4,33--4,34) }); + SynBinding (None, Normal, false, false, [], PreXmlDocEmpty, SynValData (None, diff --git a/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 10.fs.bsl b/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 10.fs.bsl index 299837318cf..84a3c2c524d 100644 --- a/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 10.fs.bsl +++ b/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 10.fs.bsl @@ -9,22 +9,33 @@ ImplFile (NonAtomic, false, Ident async, ComputationExpr (false, - LetOrUseBang - (Yes (4,4--4,35), false, true, - Typed - (Paren - (As - (Named - (SynIdent (x, None), false, None, (4,10--4,11)), - Named - (SynIdent (y, None), false, None, (4,15--4,16)), - (4,10--4,16)), (4,9--4,17)), - LongIdent (SynLongIdent ([int], [], [None])), - (4,9--4,22)), - App - (Atomic, false, Ident asyncInt, - Const (Unit, (4,33--4,35)), (4,25--4,35)), + LetOrUse + (false, false, true, true, [SynBinding + (None, Normal, false, false, [], PreXmlDocEmpty, + SynValData + (None, + SynValInfo ([], SynArgInfo ([], false, None)), + None), + Typed + (Paren + (As + (Named + (SynIdent (x, None), false, None, + (4,10--4,11)), + Named + (SynIdent (y, None), false, None, + (4,15--4,16)), (4,10--4,16)), (4,9--4,17)), + LongIdent (SynLongIdent ([int], [], [None])), + (4,9--4,22)), None, + App + (Atomic, false, Ident asyncInt, + Const (Unit, (4,33--4,35)), (4,25--4,35)), + (4,4--6,16), Yes (4,4--4,35), + { LeadingKeyword = Let (4,4--4,8) + InlineKeyword = None + EqualsRange = Some (4,23--4,24) }); + SynBinding (None, Normal, false, false, [], PreXmlDocEmpty, SynValData (None, diff --git a/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 11.fs.bsl b/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 11.fs.bsl index 9ee8fe531ed..f39642c402e 100644 --- a/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 11.fs.bsl +++ b/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 11.fs.bsl @@ -9,21 +9,31 @@ ImplFile (NonAtomic, false, Ident async, ComputationExpr (false, - LetOrUseBang - (Yes (4,4--4,33), false, true, - Typed - (As - (Named - (SynIdent (x, None), false, None, (4,9--4,10)), - Named - (SynIdent (y, None), false, None, (4,14--4,15)), - (4,9--4,15)), - LongIdent (SynLongIdent ([int], [], [None])), - (4,9--4,20)), - App - (Atomic, false, Ident asyncInt, - Const (Unit, (4,31--4,33)), (4,23--4,33)), + LetOrUse + (false, false, true, true, [SynBinding + (None, Normal, false, false, [], PreXmlDocEmpty, + SynValData + (None, + SynValInfo ([], SynArgInfo ([], false, None)), + None), + Typed + (As + (Named + (SynIdent (x, None), false, None, (4,9--4,10)), + Named + (SynIdent (y, None), false, None, + (4,14--4,15)), (4,9--4,15)), + LongIdent (SynLongIdent ([int], [], [None])), + (4,9--4,20)), None, + App + (Atomic, false, Ident asyncInt, + Const (Unit, (4,31--4,33)), (4,23--4,33)), + (4,4--6,16), Yes (4,4--4,33), + { LeadingKeyword = Let (4,4--4,8) + InlineKeyword = None + EqualsRange = Some (4,21--4,22) }); + SynBinding (None, Normal, false, false, [], PreXmlDocEmpty, SynValData (None, diff --git a/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 12.fs.bsl b/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 12.fs.bsl index 33159e69b1e..70f1a734d25 100644 --- a/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 12.fs.bsl +++ b/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 12.fs.bsl @@ -9,16 +9,28 @@ ImplFile (NonAtomic, false, Ident async, ComputationExpr (false, - LetOrUseBang - (Yes (4,4--4,28), false, true, - As - (Named (SynIdent (x, None), false, None, (4,9--4,10)), - Named (SynIdent (y, None), false, None, (4,14--4,15)), - (4,9--4,15)), - App - (Atomic, false, Ident asyncInt, - Const (Unit, (4,26--4,28)), (4,18--4,28)), + LetOrUse + (false, false, true, true, [SynBinding + (None, Normal, false, false, [], PreXmlDocEmpty, + SynValData + (None, + SynValInfo ([], SynArgInfo ([], false, None)), + None), + As + (Named + (SynIdent (x, None), false, None, (4,9--4,10)), + Named + (SynIdent (y, None), false, None, (4,14--4,15)), + (4,9--4,15)), None, + App + (Atomic, false, Ident asyncInt, + Const (Unit, (4,26--4,28)), (4,18--4,28)), + (4,4--6,16), Yes (4,4--4,28), + { LeadingKeyword = Let (4,4--4,8) + InlineKeyword = None + EqualsRange = Some (4,16--4,17) }); + SynBinding (None, Normal, false, false, [], PreXmlDocEmpty, SynValData (None, diff --git a/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 13.fs.bsl b/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 13.fs.bsl index 2f10c2e1db3..240084681df 100644 --- a/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 13.fs.bsl +++ b/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 13.fs.bsl @@ -9,28 +9,39 @@ ImplFile (NonAtomic, false, Ident async, ComputationExpr (false, - LetOrUseBang - (Yes (4,4--4,56), false, true, - Paren - (Typed - (ArrayOrList - (true, - [Named - (SynIdent (first, None), false, None, - (4,13--4,18)); - Named - (SynIdent (second, None), false, None, - (4,20--4,26))], (4,10--4,29)), - App - (LongIdent (SynLongIdent ([array], [], [None])), - None, - [LongIdent (SynLongIdent ([int], [], [None]))], - [], None, true, (4,31--4,40)), (4,10--4,40)), - (4,9--4,41)), - App - (Atomic, false, Ident asyncArray, - Const (Unit, (4,54--4,56)), (4,44--4,56)), + LetOrUse + (false, false, true, true, [SynBinding + (None, Normal, false, false, [], PreXmlDocEmpty, + SynValData + (None, + SynValInfo ([], SynArgInfo ([], false, None)), + None), + Paren + (Typed + (ArrayOrList + (true, + [Named + (SynIdent (first, None), false, None, + (4,13--4,18)); + Named + (SynIdent (second, None), false, None, + (4,20--4,26))], (4,10--4,29)), + App + (LongIdent + (SynLongIdent ([array], [], [None])), None, + [LongIdent + (SynLongIdent ([int], [], [None]))], [], + None, true, (4,31--4,40)), (4,10--4,40)), + (4,9--4,41)), None, + App + (Atomic, false, Ident asyncArray, + Const (Unit, (4,54--4,56)), (4,44--4,56)), + (4,4--6,16), Yes (4,4--4,56), + { LeadingKeyword = Let (4,4--4,8) + InlineKeyword = None + EqualsRange = Some (4,42--4,43) }); + SynBinding (None, Normal, false, false, [], PreXmlDocEmpty, SynValData (None, diff --git a/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 14.fs.bsl b/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 14.fs.bsl index 5260a9c576c..f73d7e3dbfa 100644 --- a/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 14.fs.bsl +++ b/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 14.fs.bsl @@ -9,26 +9,37 @@ ImplFile (NonAtomic, false, Ident async, ComputationExpr (false, - LetOrUseBang - (Yes (4,4--4,54), false, true, - Typed - (ArrayOrList - (true, - [Named - (SynIdent (first, None), false, None, - (4,12--4,17)); - Named - (SynIdent (second, None), false, None, - (4,19--4,25))], (4,9--4,28)), - App - (LongIdent (SynLongIdent ([array], [], [None])), - None, - [LongIdent (SynLongIdent ([int], [], [None]))], [], - None, true, (4,30--4,39)), (4,9--4,39)), - App - (Atomic, false, Ident asyncArray, - Const (Unit, (4,52--4,54)), (4,42--4,54)), + LetOrUse + (false, false, true, true, [SynBinding + (None, Normal, false, false, [], PreXmlDocEmpty, + SynValData + (None, + SynValInfo ([], SynArgInfo ([], false, None)), + None), + Typed + (ArrayOrList + (true, + [Named + (SynIdent (first, None), false, None, + (4,12--4,17)); + Named + (SynIdent (second, None), false, None, + (4,19--4,25))], (4,9--4,28)), + App + (LongIdent (SynLongIdent ([array], [], [None])), + None, + [LongIdent (SynLongIdent ([int], [], [None]))], + [], None, true, (4,30--4,39)), (4,9--4,39)), + None, + App + (Atomic, false, Ident asyncArray, + Const (Unit, (4,52--4,54)), (4,42--4,54)), + (4,4--6,16), Yes (4,4--4,54), + { LeadingKeyword = Let (4,4--4,8) + InlineKeyword = None + EqualsRange = Some (4,40--4,41) }); + SynBinding (None, Normal, false, false, [], PreXmlDocEmpty, SynValData (None, diff --git a/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 15.fs.bsl b/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 15.fs.bsl index 9fdf1440fc8..9aff0538368 100644 --- a/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 15.fs.bsl +++ b/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 15.fs.bsl @@ -11,32 +11,42 @@ ImplFile (false, Tuple (false, - [LetOrUseBang - (Yes (4,4--4,39), false, true, - Typed - (Paren - (Tuple - (false, - [Named - (SynIdent (x, None), false, None, - (4,10--4,11)); - Named - (SynIdent (y, None), false, None, - (4,13--4,14))], [(4,11--4,12)], - (4,10--4,14)), (4,9--4,15)), - Tuple - (false, - [Type - (LongIdent - (SynLongIdent ([int], [], [None]))); - Star (4,21--4,22); - Type - (LongIdent - (SynLongIdent ([int], [], [None])))], - (4,17--4,26)), (4,9--4,26)), - App - (Atomic, false, Ident asyncInt, - Const (Unit, (4,37--4,39)), (4,29--4,39)), [], + [LetOrUse + (false, false, true, true, + [SynBinding + (None, Normal, false, false, [], PreXmlDocEmpty, + SynValData + (None, + SynValInfo ([], SynArgInfo ([], false, None)), + None), + Typed + (Paren + (Tuple + (false, + [Named + (SynIdent (x, None), false, None, + (4,10--4,11)); + Named + (SynIdent (y, None), false, None, + (4,13--4,14))], [(4,11--4,12)], + (4,10--4,14)), (4,9--4,15)), + Tuple + (false, + [Type + (LongIdent + (SynLongIdent ([int], [], [None]))); + Star (4,21--4,22); + Type + (LongIdent + (SynLongIdent ([int], [], [None])))], + (4,17--4,26)), (4,9--4,26)), None, + App + (Atomic, false, Ident asyncInt, + Const (Unit, (4,37--4,39)), (4,29--4,39)), + (4,4--5,16), Yes (4,4--4,39), + { LeadingKeyword = Let (4,4--4,8) + InlineKeyword = None + EqualsRange = Some (4,27--4,28) })], ImplicitZero (4,39--4,39), (4,4--5,16), { LetOrUseKeyword = (4,4--4,8) InKeyword = None diff --git a/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 16.fs.bsl b/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 16.fs.bsl index 91acf209739..bb6c4d81f3f 100644 --- a/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 16.fs.bsl +++ b/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 16.fs.bsl @@ -9,31 +9,43 @@ ImplFile (NonAtomic, false, Ident async, ComputationExpr (false, - LetOrUseBang - (Yes (4,4--4,39), false, true, - Typed - (Paren - (Tuple - (false, - [Named - (SynIdent (x, None), false, None, - (4,10--4,11)); - Named - (SynIdent (y, None), false, None, - (4,13--4,14))], [(4,11--4,12)], (4,10--4,14)), - (4,9--4,15)), - Tuple - (false, - [Type - (LongIdent (SynLongIdent ([int], [], [None]))); - Star (4,21--4,22); - Type - (LongIdent (SynLongIdent ([int], [], [None])))], - (4,17--4,26)), (4,9--4,26)), - App - (Atomic, false, Ident asyncInt, - Const (Unit, (4,37--4,39)), (4,29--4,39)), + LetOrUse + (false, false, true, true, [SynBinding + (None, Normal, false, false, [], PreXmlDocEmpty, + SynValData + (None, + SynValInfo ([], SynArgInfo ([], false, None)), + None), + Typed + (Paren + (Tuple + (false, + [Named + (SynIdent (x, None), false, None, + (4,10--4,11)); + Named + (SynIdent (y, None), false, None, + (4,13--4,14))], [(4,11--4,12)], + (4,10--4,14)), (4,9--4,15)), + Tuple + (false, + [Type + (LongIdent + (SynLongIdent ([int], [], [None]))); + Star (4,21--4,22); + Type + (LongIdent + (SynLongIdent ([int], [], [None])))], + (4,17--4,26)), (4,9--4,26)), None, + App + (Atomic, false, Ident asyncInt, + Const (Unit, (4,37--4,39)), (4,29--4,39)), + (4,4--6,13), Yes (4,4--4,39), + { LeadingKeyword = Let (4,4--4,8) + InlineKeyword = None + EqualsRange = Some (4,27--4,28) }); + SynBinding (None, Normal, false, false, [], PreXmlDocEmpty, SynValData (None, diff --git a/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 17.fs.bsl b/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 17.fs.bsl index f542dca6c09..7fbe916076c 100644 --- a/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 17.fs.bsl +++ b/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 17.fs.bsl @@ -9,31 +9,43 @@ ImplFile (NonAtomic, false, Ident async, ComputationExpr (false, - LetOrUseBang - (Yes (4,4--4,39), false, true, - Typed - (Paren - (Tuple - (false, - [Named - (SynIdent (x, None), false, None, - (4,10--4,11)); - Named - (SynIdent (y, None), false, None, - (4,13--4,14))], [(4,11--4,12)], (4,10--4,14)), - (4,9--4,15)), - Tuple - (false, - [Type - (LongIdent (SynLongIdent ([int], [], [None]))); - Star (4,21--4,22); - Type - (LongIdent (SynLongIdent ([int], [], [None])))], - (4,17--4,26)), (4,9--4,26)), - App - (Atomic, false, Ident asyncInt, - Const (Unit, (4,37--4,39)), (4,29--4,39)), + LetOrUse + (false, false, true, true, [SynBinding + (None, Normal, false, false, [], PreXmlDocEmpty, + SynValData + (None, + SynValInfo ([], SynArgInfo ([], false, None)), + None), + Typed + (Paren + (Tuple + (false, + [Named + (SynIdent (x, None), false, None, + (4,10--4,11)); + Named + (SynIdent (y, None), false, None, + (4,13--4,14))], [(4,11--4,12)], + (4,10--4,14)), (4,9--4,15)), + Tuple + (false, + [Type + (LongIdent + (SynLongIdent ([int], [], [None]))); + Star (4,21--4,22); + Type + (LongIdent + (SynLongIdent ([int], [], [None])))], + (4,17--4,26)), (4,9--4,26)), None, + App + (Atomic, false, Ident asyncInt, + Const (Unit, (4,37--4,39)), (4,29--4,39)), + (4,4--6,13), Yes (4,4--4,39), + { LeadingKeyword = Let (4,4--4,8) + InlineKeyword = None + EqualsRange = Some (4,27--4,28) }); + SynBinding (None, Normal, false, false, [], PreXmlDocEmpty, SynValData (None, diff --git a/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 18.fs.bsl b/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 18.fs.bsl index e9e4c26a259..98ddd4bb58f 100644 --- a/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 18.fs.bsl +++ b/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 18.fs.bsl @@ -9,22 +9,33 @@ ImplFile (NonAtomic, false, Ident async, ComputationExpr (false, - LetOrUseBang - (Yes (4,4--4,35), false, true, - Typed - (Paren - (As - (Named - (SynIdent (x, None), false, None, (4,10--4,11)), - Named - (SynIdent (y, None), false, None, (4,15--4,16)), - (4,10--4,16)), (4,9--4,17)), - LongIdent (SynLongIdent ([int], [], [None])), - (4,9--4,22)), - App - (Atomic, false, Ident asyncInt, - Const (Unit, (4,33--4,35)), (4,25--4,35)), + LetOrUse + (false, false, true, true, [SynBinding + (None, Normal, false, false, [], PreXmlDocEmpty, + SynValData + (None, + SynValInfo ([], SynArgInfo ([], false, None)), + None), + Typed + (Paren + (As + (Named + (SynIdent (x, None), false, None, + (4,10--4,11)), + Named + (SynIdent (y, None), false, None, + (4,15--4,16)), (4,10--4,16)), (4,9--4,17)), + LongIdent (SynLongIdent ([int], [], [None])), + (4,9--4,22)), None, + App + (Atomic, false, Ident asyncInt, + Const (Unit, (4,33--4,35)), (4,25--4,35)), + (4,4--6,16), Yes (4,4--4,35), + { LeadingKeyword = Let (4,4--4,8) + InlineKeyword = None + EqualsRange = Some (4,23--4,24) }); + SynBinding (None, Normal, false, false, [], PreXmlDocEmpty, SynValData (None, diff --git a/tests/service/data/SyntaxTree/SynType/Typed UseBang 01.fs.bsl b/tests/service/data/SyntaxTree/SynType/Typed UseBang 01.fs.bsl index 68ffa0052e2..962ed71f1f2 100644 --- a/tests/service/data/SyntaxTree/SynType/Typed UseBang 01.fs.bsl +++ b/tests/service/data/SyntaxTree/SynType/Typed UseBang 01.fs.bsl @@ -8,21 +8,31 @@ ImplFile (NonAtomic, false, Ident async, ComputationExpr (false, - LetOrUseBang - (Yes (4,4--4,38), true, true, - Typed - (Named (SynIdent (res, None), false, None, (4,9--4,12)), - LongIdent (SynLongIdent ([int], [], [None])), - (4,9--4,17)), - App - (NonAtomic, false, Ident async, - ComputationExpr - (false, - YieldOrReturn - ((false, true), Const (Int32 1, (4,35--4,36)), - (4,28--4,36), - { YieldOrReturnKeyword = (4,28--4,34) }), - (4,26--4,38)), (4,20--4,38)), [], + LetOrUse + (false, true, true, true, + [SynBinding + (None, Normal, false, false, [], PreXmlDocEmpty, + SynValData + (None, + SynValInfo ([], SynArgInfo ([], false, None)), + None), + Typed + (Named + (SynIdent (res, None), false, None, (4,9--4,12)), + LongIdent (SynLongIdent ([int], [], [None])), + (4,9--4,17)), None, + App + (NonAtomic, false, Ident async, + ComputationExpr + (false, + YieldOrReturn + ((false, true), Const (Int32 1, (4,35--4,36)), + (4,28--4,36), + { YieldOrReturnKeyword = (4,28--4,34) }), + (4,26--4,38)), (4,20--4,38)), (4,4--5,14), + Yes (4,4--4,38), { LeadingKeyword = Use (4,4--4,8) + InlineKeyword = None + EqualsRange = Some (4,18--4,19) })], YieldOrReturn ((false, true), Ident res, (5,4--5,14), { YieldOrReturnKeyword = (5,4--5,10) }), (4,4--5,14), diff --git a/tests/service/data/SyntaxTree/SynType/Typed UseBang 02.fs.bsl b/tests/service/data/SyntaxTree/SynType/Typed UseBang 02.fs.bsl index d108dbbdb26..3aa1d22feec 100644 --- a/tests/service/data/SyntaxTree/SynType/Typed UseBang 02.fs.bsl +++ b/tests/service/data/SyntaxTree/SynType/Typed UseBang 02.fs.bsl @@ -8,23 +8,33 @@ ImplFile (NonAtomic, false, Ident async, ComputationExpr (false, - LetOrUseBang - (Yes (4,4--4,40), true, true, - Paren - (Typed - (Named - (SynIdent (res, None), false, None, (4,10--4,13)), - LongIdent (SynLongIdent ([int], [], [None])), - (4,10--4,18)), (4,9--4,19)), - App - (NonAtomic, false, Ident async, - ComputationExpr - (false, - YieldOrReturn - ((false, true), Const (Int32 1, (4,37--4,38)), - (4,30--4,38), - { YieldOrReturnKeyword = (4,30--4,36) }), - (4,28--4,40)), (4,22--4,40)), [], + LetOrUse + (false, true, true, true, + [SynBinding + (None, Normal, false, false, [], PreXmlDocEmpty, + SynValData + (None, + SynValInfo ([], SynArgInfo ([], false, None)), + None), + Paren + (Typed + (Named + (SynIdent (res, None), false, None, + (4,10--4,13)), + LongIdent (SynLongIdent ([int], [], [None])), + (4,10--4,18)), (4,9--4,19)), None, + App + (NonAtomic, false, Ident async, + ComputationExpr + (false, + YieldOrReturn + ((false, true), Const (Int32 1, (4,37--4,38)), + (4,30--4,38), + { YieldOrReturnKeyword = (4,30--4,36) }), + (4,28--4,40)), (4,22--4,40)), (4,4--5,14), + Yes (4,4--4,40), { LeadingKeyword = Use (4,4--4,8) + InlineKeyword = None + EqualsRange = Some (4,20--4,21) })], YieldOrReturn ((false, true), Ident res, (5,4--5,14), { YieldOrReturnKeyword = (5,4--5,10) }), (4,4--5,14), diff --git a/tests/service/data/SyntaxTree/SynType/Typed UseBang 03.fs.bsl b/tests/service/data/SyntaxTree/SynType/Typed UseBang 03.fs.bsl index 7166b37a4b0..73764088bbd 100644 --- a/tests/service/data/SyntaxTree/SynType/Typed UseBang 03.fs.bsl +++ b/tests/service/data/SyntaxTree/SynType/Typed UseBang 03.fs.bsl @@ -4,35 +4,54 @@ ImplFile [SynModuleOrNamespace ([Module], false, NamedModule, [Expr - (LetOrUseBang - (Yes (3,0--3,31), true, true, - Typed - (Named (SynIdent (x, None), false, None, (3,5--3,6)), - LongIdent (SynLongIdent ([int], [], [None])), (3,5--3,10)), - App - (NonAtomic, false, Ident async, - ComputationExpr - (false, - YieldOrReturn - ((false, true), Const (Int32 1, (3,28--3,29)), - (3,21--3,29), { YieldOrReturnKeyword = (3,21--3,27) }), - (3,19--3,31)), (3,13--3,31)), [], - LetOrUseBang - (Yes (4,0--4,33), true, true, - Paren - (Typed - (Named (SynIdent (y, None), false, None, (4,6--4,7)), - LongIdent (SynLongIdent ([int], [], [None])), - (4,6--4,11)), (4,5--4,12)), - App - (NonAtomic, false, Ident async, - ComputationExpr - (false, - YieldOrReturn - ((false, true), Const (Int32 2, (4,30--4,31)), - (4,23--4,31), - { YieldOrReturnKeyword = (4,23--4,29) }), - (4,21--4,33)), (4,15--4,33)), [], + (LetOrUse + (false, true, true, true, + [SynBinding + (None, Normal, false, false, [], PreXmlDocEmpty, + SynValData + (None, SynValInfo ([], SynArgInfo ([], false, None)), + None), + Typed + (Named (SynIdent (x, None), false, None, (3,5--3,6)), + LongIdent (SynLongIdent ([int], [], [None])), + (3,5--3,10)), None, + App + (NonAtomic, false, Ident async, + ComputationExpr + (false, + YieldOrReturn + ((false, true), Const (Int32 1, (3,28--3,29)), + (3,21--3,29), + { YieldOrReturnKeyword = (3,21--3,27) }), + (3,19--3,31)), (3,13--3,31)), (3,0--4,33), + Yes (3,0--3,31), { LeadingKeyword = Use (3,0--3,4) + InlineKeyword = None + EqualsRange = Some (3,11--3,12) })], + LetOrUse + (false, true, true, true, + [SynBinding + (None, Normal, false, false, [], PreXmlDocEmpty, + SynValData + (None, SynValInfo ([], SynArgInfo ([], false, None)), + None), + Paren + (Typed + (Named + (SynIdent (y, None), false, None, (4,6--4,7)), + LongIdent (SynLongIdent ([int], [], [None])), + (4,6--4,11)), (4,5--4,12)), None, + App + (NonAtomic, false, Ident async, + ComputationExpr + (false, + YieldOrReturn + ((false, true), Const (Int32 2, (4,30--4,31)), + (4,23--4,31), + { YieldOrReturnKeyword = (4,23--4,29) }), + (4,21--4,33)), (4,15--4,33)), (4,0--4,33), + Yes (4,0--4,33), { LeadingKeyword = Use (4,0--4,4) + InlineKeyword = None + EqualsRange = Some (4,13--4,14) })], ImplicitZero (4,33--4,33), (4,0--4,33), { LetOrUseKeyword = (4,0--4,4) InKeyword = None diff --git a/tests/service/data/SyntaxTree/SynType/Typed UseBang 04.fs.bsl b/tests/service/data/SyntaxTree/SynType/Typed UseBang 04.fs.bsl index 6253c5c42c5..641c1a2f992 100644 --- a/tests/service/data/SyntaxTree/SynType/Typed UseBang 04.fs.bsl +++ b/tests/service/data/SyntaxTree/SynType/Typed UseBang 04.fs.bsl @@ -4,35 +4,53 @@ ImplFile [SynModuleOrNamespace ([Module], false, NamedModule, [Expr - (LetOrUseBang - (Yes (3,0--3,31), true, true, - Typed - (Wild (3,5--3,6), - LongIdent (SynLongIdent ([int], [], [None])), (3,5--3,10)), - App - (NonAtomic, false, Ident async, - ComputationExpr - (false, - YieldOrReturn - ((false, true), Const (Int32 1, (3,28--3,29)), - (3,21--3,29), { YieldOrReturnKeyword = (3,21--3,27) }), - (3,19--3,31)), (3,13--3,31)), [], - LetOrUseBang - (Yes (4,0--4,33), true, true, - Paren - (Typed - (Wild (4,6--4,7), - LongIdent (SynLongIdent ([int], [], [None])), - (4,6--4,11)), (4,5--4,12)), - App - (NonAtomic, false, Ident async, - ComputationExpr - (false, - YieldOrReturn - ((false, true), Const (Int32 2, (4,30--4,31)), - (4,23--4,31), - { YieldOrReturnKeyword = (4,23--4,29) }), - (4,21--4,33)), (4,15--4,33)), [], + (LetOrUse + (false, true, true, true, + [SynBinding + (None, Normal, false, false, [], PreXmlDocEmpty, + SynValData + (None, SynValInfo ([], SynArgInfo ([], false, None)), + None), + Typed + (Wild (3,5--3,6), + LongIdent (SynLongIdent ([int], [], [None])), + (3,5--3,10)), None, + App + (NonAtomic, false, Ident async, + ComputationExpr + (false, + YieldOrReturn + ((false, true), Const (Int32 1, (3,28--3,29)), + (3,21--3,29), + { YieldOrReturnKeyword = (3,21--3,27) }), + (3,19--3,31)), (3,13--3,31)), (3,0--4,33), + Yes (3,0--3,31), { LeadingKeyword = Use (3,0--3,4) + InlineKeyword = None + EqualsRange = Some (3,11--3,12) })], + LetOrUse + (false, true, true, true, + [SynBinding + (None, Normal, false, false, [], PreXmlDocEmpty, + SynValData + (None, SynValInfo ([], SynArgInfo ([], false, None)), + None), + Paren + (Typed + (Wild (4,6--4,7), + LongIdent (SynLongIdent ([int], [], [None])), + (4,6--4,11)), (4,5--4,12)), None, + App + (NonAtomic, false, Ident async, + ComputationExpr + (false, + YieldOrReturn + ((false, true), Const (Int32 2, (4,30--4,31)), + (4,23--4,31), + { YieldOrReturnKeyword = (4,23--4,29) }), + (4,21--4,33)), (4,15--4,33)), (4,0--4,33), + Yes (4,0--4,33), { LeadingKeyword = Use (4,0--4,4) + InlineKeyword = None + EqualsRange = Some (4,13--4,14) })], ImplicitZero (4,33--4,33), (4,0--4,33), { LetOrUseKeyword = (4,0--4,4) InKeyword = None diff --git a/tests/service/data/SyntaxTree/SynType/Typed UseBang 05.fs.bsl b/tests/service/data/SyntaxTree/SynType/Typed UseBang 05.fs.bsl index 02b8514ab6a..4986d9b453c 100644 --- a/tests/service/data/SyntaxTree/SynType/Typed UseBang 05.fs.bsl +++ b/tests/service/data/SyntaxTree/SynType/Typed UseBang 05.fs.bsl @@ -8,20 +8,30 @@ ImplFile (NonAtomic, false, Ident async, ComputationExpr (false, - LetOrUseBang - (Yes (4,4--4,34), true, true, - Typed - (Named (SynIdent (res, None), false, None, (4,9--4,12)), - FromParseError (4,13--4,13), (4,9--4,13)), - App - (NonAtomic, false, Ident async, - ComputationExpr - (false, - YieldOrReturn - ((false, true), Const (Int32 1, (4,31--4,32)), - (4,24--4,32), - { YieldOrReturnKeyword = (4,24--4,30) }), - (4,22--4,34)), (4,16--4,34)), [], + LetOrUse + (false, true, true, true, + [SynBinding + (None, Normal, false, false, [], PreXmlDocEmpty, + SynValData + (None, + SynValInfo ([], SynArgInfo ([], false, None)), + None), + Typed + (Named + (SynIdent (res, None), false, None, (4,9--4,12)), + FromParseError (4,13--4,13), (4,9--4,13)), None, + App + (NonAtomic, false, Ident async, + ComputationExpr + (false, + YieldOrReturn + ((false, true), Const (Int32 1, (4,31--4,32)), + (4,24--4,32), + { YieldOrReturnKeyword = (4,24--4,30) }), + (4,22--4,34)), (4,16--4,34)), (4,4--5,14), + Yes (4,4--4,34), { LeadingKeyword = Use (4,4--4,8) + InlineKeyword = None + EqualsRange = Some (4,14--4,15) })], YieldOrReturn ((false, true), Ident res, (5,4--5,14), { YieldOrReturnKeyword = (5,4--5,10) }), (4,4--5,14), From 6dcde2e94256dc5b939c1fa04534e041595fe0f5 Mon Sep 17 00:00:00 2001 From: edgargonzalez Date: Wed, 6 Aug 2025 22:36:25 +0200 Subject: [PATCH 08/24] Fix computation expression pattern matching order Ensure that regular let/use bindings (isComputed=false) are matched before let!/use! bindings (isComputed=true) to prevent computation expressions from being treated as regular bindings. --- .../Expressions/CheckComputationExpressions.fs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/Compiler/Checking/Expressions/CheckComputationExpressions.fs b/src/Compiler/Checking/Expressions/CheckComputationExpressions.fs index 1fd83b2fd6e..8bbbb65a71f 100644 --- a/src/Compiler/Checking/Expressions/CheckComputationExpressions.fs +++ b/src/Compiler/Checking/Expressions/CheckComputationExpressions.fs @@ -1442,7 +1442,7 @@ let rec TryTranslateComputationExpression trivia = SynBindingTrivia.Zero ) - SynExpr.LetOrUse(false, false, true, true, [ binding ], body, mGuard, SynExprLetOrUseTrivia.Zero) + SynExpr.LetOrUse(false, false, true, false, [ binding ], body, mGuard, SynExprLetOrUseTrivia.Zero) TryTranslateComputationExpression ceenv CompExprTranslationPass.Initial q varSpace rewrittenWhileExpr translatedCtxt @@ -1664,7 +1664,7 @@ let rec TryTranslateComputationExpression CompExprTranslationPass.Initial q varSpace - (SynExpr.LetOrUse(false, false, true, false, [ binding ], innerComp2, m, SynExprLetOrUseTrivia.Zero)) + (SynExpr.LetOrUse(false, false, true, true, [ binding ], innerComp2, m, SynExprLetOrUseTrivia.Zero)) translatedCtxt ) @@ -1732,7 +1732,7 @@ let rec TryTranslateComputationExpression ) // 'let binds in expr' - | SynExpr.LetOrUse(isRec, false, isFromSource, isComputed, binds, innerComp, m, trivia) -> + | SynExpr.LetOrUse(isRec, false, isFromSource, false, binds, innerComp, m, trivia) -> // For 'query' check immediately if ceenv.isQuery then @@ -1765,12 +1765,13 @@ let rec TryTranslateComputationExpression Some( TranslateComputationExpression ceenv CompExprTranslationPass.Initial q varSpace innerComp (fun holeFill -> - translatedCtxt (SynExpr.LetOrUse(isRec, false, isFromSource, isComputed, binds, holeFill, m, trivia))) + translatedCtxt (SynExpr.LetOrUse(isRec, false, isFromSource, false, binds, holeFill, m, trivia))) ) // 'use x = expr in expr' | SynExpr.LetOrUse( isUse = true + isComputed = false bindings = [ SynBinding(kind = SynBindingKind.Normal; headPat = pat; expr = rhsExpr; debugPoint = spBind) ] body = innerComp trivia = { LetOrUseKeyword = mBind }) -> @@ -2426,7 +2427,7 @@ and ConsumeCustomOpClauses trivia = SynBindingTrivia.Zero ) - SynExpr.LetOrUse(false, false, false, false, [ binding ], contExpr, intoPat.Range, SynExprLetOrUseTrivia.Zero) + SynExpr.LetOrUse(false, false, false, true, [ binding ], contExpr, intoPat.Range, SynExprLetOrUseTrivia.Zero) else SynExpr.ForEach( DebugPointAtFor.No, @@ -2478,7 +2479,7 @@ and ConsumeCustomOpClauses false, false, false, - false, + true, [ binding ], compClausesExpr, compClausesExpr.Range, @@ -2629,11 +2630,11 @@ and convertSimpleReturnToExpr (ceenv: ComputationExpressionContext<'a>) comp var | Some elseExprOpt -> Some(SynExpr.IfThenElse(guardExpr, thenExpr, elseExprOpt, spIfToThen, isRecovery, mIfToEndOfElseBranch, trivia), None) - | SynExpr.LetOrUse(isRec, false, isFromSource, isComputed, binds, innerComp, m, trivia) -> + | SynExpr.LetOrUse(isRec, false, isFromSource, false, binds, innerComp, m, trivia) -> match convertSimpleReturnToExpr ceenv comp varSpace innerComp with | None -> None | Some(_, Some _) -> None - | Some(innerExpr, None) -> Some(SynExpr.LetOrUse(isRec, false, isFromSource, isComputed, binds, innerExpr, m, trivia), None) + | Some(innerExpr, None) -> Some(SynExpr.LetOrUse(isRec, false, isFromSource, false, binds, innerExpr, m, trivia), None) | OptionalSequential(CustomOperationClause ceenv (nm, _, _, mClause, _), _) when customOperationMaintainsVarSpaceUsingBind ceenv nm -> From 670aab889e488e93aaad5f328cd5db41133eda3e Mon Sep 17 00:00:00 2001 From: Edgar Gonzalez Date: Thu, 7 Aug 2025 07:50:37 +0200 Subject: [PATCH 09/24] format --- .../Expressions/CheckComputationExpressions.fs | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/src/Compiler/Checking/Expressions/CheckComputationExpressions.fs b/src/Compiler/Checking/Expressions/CheckComputationExpressions.fs index b8b07db20ae..22cc484c9a3 100644 --- a/src/Compiler/Checking/Expressions/CheckComputationExpressions.fs +++ b/src/Compiler/Checking/Expressions/CheckComputationExpressions.fs @@ -2457,16 +2457,7 @@ and ConsumeCustomOpClauses trivia = SynBindingTrivia.Zero ) - SynExpr.LetOrUse( - false, - false, - false, - true, - [ binding ], - compClausesExpr, - compClausesExpr.Range, - SynExprLetOrUseTrivia.Zero - ) + SynExpr.LetOrUse(false, false, false, true, [ binding ], compClausesExpr, compClausesExpr.Range, SynExprLetOrUseTrivia.Zero) else SynExpr.ForEach( DebugPointAtFor.No, From a862ad11554a14ecc73f06f20cbff08079043bbc Mon Sep 17 00:00:00 2001 From: Edgar Gonzalez Date: Thu, 7 Aug 2025 07:50:46 +0200 Subject: [PATCH 10/24] release notes --- docs/release-notes/.FSharp.Compiler.Service/10.0.100.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/release-notes/.FSharp.Compiler.Service/10.0.100.md b/docs/release-notes/.FSharp.Compiler.Service/10.0.100.md index 7256a47504c..d56754b65fe 100644 --- a/docs/release-notes/.FSharp.Compiler.Service/10.0.100.md +++ b/docs/release-notes/.FSharp.Compiler.Service/10.0.100.md @@ -21,6 +21,7 @@ ### Changed * Use `errorR` instead of `error` in `CheckDeclarations.fs` when possible. ([PR #18645](https://github.com/dotnet/fsharp/pull/18645)) +* Unify `let`, `let!`, `use` and `use!` AST representation. ([PR #18825](https://github.com/dotnet/fsharp/pull/18825)) ### Breaking Changes From cfb3d09f338d5ac03a969d239a6f967492f8390d Mon Sep 17 00:00:00 2001 From: Edgar Gonzalez Date: Thu, 7 Aug 2025 07:56:50 +0200 Subject: [PATCH 11/24] ILVerify --- .../ilverify_FSharp.Compiler.Service_Debug_netstandard2.0.bsl | 2 +- .../ilverify_FSharp.Compiler.Service_Release_netstandard2.0.bsl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/ILVerify/ilverify_FSharp.Compiler.Service_Debug_netstandard2.0.bsl b/tests/ILVerify/ilverify_FSharp.Compiler.Service_Debug_netstandard2.0.bsl index 616742054b4..bfe53707d70 100644 --- a/tests/ILVerify/ilverify_FSharp.Compiler.Service_Debug_netstandard2.0.bsl +++ b/tests/ILVerify/ilverify_FSharp.Compiler.Service_Debug_netstandard2.0.bsl @@ -34,7 +34,7 @@ [IL]: Error [StackUnexpected]: : .$FSharpCheckerResults+dataTipOfReferences@2225::Invoke([FSharp.Core]Microsoft.FSharp.Core.Unit)][offset 0x00000084][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.EditorServices.AssemblyContent+traverseMemberFunctionAndValues@176::Invoke([FSharp.Compiler.Service]FSharp.Compiler.Symbols.FSharpMemberOrFunctionOrValue)][offset 0x00000059][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.EditorServices.AssemblyContent+traverseEntity@218::GenerateNext([S.P.CoreLib]System.Collections.Generic.IEnumerable`1&)][offset 0x000000DA][found Char] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.EditorServices.ParsedInput+visitor@1431-6::VisitExpr([FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, [FSharp.Compiler.Service]FSharp.Compiler.Syntax.SynExpr)][offset 0x00000605][found Char] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.EditorServices.ParsedInput+visitor@1422-6::VisitExpr([FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, [FSharp.Compiler.Service]FSharp.Compiler.Syntax.SynExpr)][offset 0x000005FD][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : .$ServiceLexing+clo@924-515::Invoke([FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,Microsoft.FSharp.Core.Unit>)][offset 0x00000032][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : .$ServiceLexing+clo@924-515::Invoke([FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,Microsoft.FSharp.Core.Unit>)][offset 0x0000003B][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : .$ServiceLexing+clo@924-515::Invoke([FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,Microsoft.FSharp.Core.Unit>)][offset 0x00000082][found Char] Unexpected type on the stack. diff --git a/tests/ILVerify/ilverify_FSharp.Compiler.Service_Release_netstandard2.0.bsl b/tests/ILVerify/ilverify_FSharp.Compiler.Service_Release_netstandard2.0.bsl index c7871e0fe77..90dfed5e749 100644 --- a/tests/ILVerify/ilverify_FSharp.Compiler.Service_Release_netstandard2.0.bsl +++ b/tests/ILVerify/ilverify_FSharp.Compiler.Service_Release_netstandard2.0.bsl @@ -33,7 +33,7 @@ [IL]: Error [StackUnexpected]: : .$FSharpCheckerResults+GetReferenceResolutionStructuredToolTipText@2225::Invoke([FSharp.Core]Microsoft.FSharp.Core.Unit)][offset 0x00000076][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.EditorServices.AssemblyContent+traverseMemberFunctionAndValues@176::Invoke([FSharp.Compiler.Service]FSharp.Compiler.Symbols.FSharpMemberOrFunctionOrValue)][offset 0x0000002B][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.EditorServices.AssemblyContent+traverseEntity@218::GenerateNext([S.P.CoreLib]System.Collections.Generic.IEnumerable`1&)][offset 0x000000BB][found Char] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.EditorServices.ParsedInput+visitor@1431-11::VisitExpr([FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, [FSharp.Compiler.Service]FSharp.Compiler.Syntax.SynExpr)][offset 0x00000620][found Char] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.EditorServices.ParsedInput+visitor@1422-11::VisitExpr([FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, [FSharp.Compiler.Service]FSharp.Compiler.Syntax.SynExpr)][offset 0x00000618][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : .$ServiceLexing+clo@924-530::Invoke([FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,Microsoft.FSharp.Core.Unit>)][offset 0x00000032][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : .$ServiceLexing+clo@924-530::Invoke([FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,Microsoft.FSharp.Core.Unit>)][offset 0x0000003B][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : .$ServiceLexing+clo@924-530::Invoke([FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,Microsoft.FSharp.Core.Unit>)][offset 0x00000064][found Char] Unexpected type on the stack. From 918f3e6377c9960a707d851fe37cf9ff43375062 Mon Sep 17 00:00:00 2001 From: edgargonzalez Date: Thu, 7 Aug 2025 08:33:14 +0200 Subject: [PATCH 12/24] Fix computation expression pattern matching order --- .../Checking/Expressions/CheckComputationExpressions.fs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Compiler/Checking/Expressions/CheckComputationExpressions.fs b/src/Compiler/Checking/Expressions/CheckComputationExpressions.fs index 22cc484c9a3..b8ce8bd9a46 100644 --- a/src/Compiler/Checking/Expressions/CheckComputationExpressions.fs +++ b/src/Compiler/Checking/Expressions/CheckComputationExpressions.fs @@ -1415,7 +1415,7 @@ let rec TryTranslateComputationExpression ) let bindCondExpr = - SynExpr.LetOrUse(false, false, true, false, [ binding ], setCondExpr, mGuard, SynExprLetOrUseTrivia.Zero) + SynExpr.LetOrUse(false, false, true, true, [ binding ], setCondExpr, mGuard, SynExprLetOrUseTrivia.Zero) let whileExpr = SynExpr.While( @@ -1432,7 +1432,7 @@ let rec TryTranslateComputationExpression mOrig ) - SynExpr.LetOrUse(false, false, false, true, [ condBinding ], whileExpr, mGuard, SynExprLetOrUseTrivia.Zero) + SynExpr.LetOrUse(false, false, false, false, [ condBinding ], whileExpr, mGuard, SynExprLetOrUseTrivia.Zero) let binding = SynBinding( @@ -1451,7 +1451,7 @@ let rec TryTranslateComputationExpression trivia = SynBindingTrivia.Zero ) - SynExpr.LetOrUse(false, false, true, false, [ binding ], body, mGuard, SynExprLetOrUseTrivia.Zero) + SynExpr.LetOrUse(false, false, true, true, [ binding ], body, mGuard, SynExprLetOrUseTrivia.Zero) TryTranslateComputationExpression ceenv CompExprTranslationPass.Initial q varSpace rewrittenWhileExpr translatedCtxt From fcef8119d88bb0afc9f41e154f24ab42127f0f96 Mon Sep 17 00:00:00 2001 From: Edgar Gonzalez Date: Thu, 7 Aug 2025 09:28:43 +0200 Subject: [PATCH 13/24] update baselines --- ...vice.SurfaceArea.netstandard20.release.bsl | 23 ------------------- 1 file changed, 23 deletions(-) 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 d3fadeb82ed..3bd01ee8207 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 @@ -7223,24 +7223,6 @@ FSharp.Compiler.Syntax.SynExpr+LetOrUse: FSharp.Compiler.Text.Range get_range() FSharp.Compiler.Syntax.SynExpr+LetOrUse: FSharp.Compiler.Text.Range range FSharp.Compiler.Syntax.SynExpr+LetOrUse: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynBinding] bindings FSharp.Compiler.Syntax.SynExpr+LetOrUse: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynBinding] get_bindings() -FSharp.Compiler.Syntax.SynExpr+LetOrUseBang: Boolean get_isFromSource() -FSharp.Compiler.Syntax.SynExpr+LetOrUseBang: Boolean get_isUse() -FSharp.Compiler.Syntax.SynExpr+LetOrUseBang: Boolean isFromSource -FSharp.Compiler.Syntax.SynExpr+LetOrUseBang: Boolean isUse -FSharp.Compiler.Syntax.SynExpr+LetOrUseBang: FSharp.Compiler.Syntax.DebugPointAtBinding bindDebugPoint -FSharp.Compiler.Syntax.SynExpr+LetOrUseBang: FSharp.Compiler.Syntax.DebugPointAtBinding get_bindDebugPoint() -FSharp.Compiler.Syntax.SynExpr+LetOrUseBang: FSharp.Compiler.Syntax.SynExpr body -FSharp.Compiler.Syntax.SynExpr+LetOrUseBang: FSharp.Compiler.Syntax.SynExpr get_body() -FSharp.Compiler.Syntax.SynExpr+LetOrUseBang: FSharp.Compiler.Syntax.SynExpr get_rhs() -FSharp.Compiler.Syntax.SynExpr+LetOrUseBang: FSharp.Compiler.Syntax.SynExpr rhs -FSharp.Compiler.Syntax.SynExpr+LetOrUseBang: FSharp.Compiler.Syntax.SynPat get_pat() -FSharp.Compiler.Syntax.SynExpr+LetOrUseBang: FSharp.Compiler.Syntax.SynPat pat -FSharp.Compiler.Syntax.SynExpr+LetOrUseBang: FSharp.Compiler.SyntaxTrivia.SynExprLetOrUseTrivia get_trivia() -FSharp.Compiler.Syntax.SynExpr+LetOrUseBang: FSharp.Compiler.SyntaxTrivia.SynExprLetOrUseTrivia trivia -FSharp.Compiler.Syntax.SynExpr+LetOrUseBang: FSharp.Compiler.Text.Range get_range() -FSharp.Compiler.Syntax.SynExpr+LetOrUseBang: FSharp.Compiler.Text.Range range -FSharp.Compiler.Syntax.SynExpr+LetOrUseBang: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynBinding] andBangs -FSharp.Compiler.Syntax.SynExpr+LetOrUseBang: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynBinding] get_andBangs() FSharp.Compiler.Syntax.SynExpr+LibraryOnlyILAssembly: FSharp.Compiler.Text.Range get_range() FSharp.Compiler.Syntax.SynExpr+LibraryOnlyILAssembly: FSharp.Compiler.Text.Range range FSharp.Compiler.Syntax.SynExpr+LibraryOnlyILAssembly: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynExpr] args @@ -7446,7 +7428,6 @@ FSharp.Compiler.Syntax.SynExpr+Tags: Int32 JoinIn FSharp.Compiler.Syntax.SynExpr+Tags: Int32 Lambda FSharp.Compiler.Syntax.SynExpr+Tags: Int32 Lazy FSharp.Compiler.Syntax.SynExpr+Tags: Int32 LetOrUse -FSharp.Compiler.Syntax.SynExpr+Tags: Int32 LetOrUseBang FSharp.Compiler.Syntax.SynExpr+Tags: Int32 LibraryOnlyILAssembly FSharp.Compiler.Syntax.SynExpr+Tags: Int32 LibraryOnlyStaticOptimization FSharp.Compiler.Syntax.SynExpr+Tags: Int32 LibraryOnlyUnionCaseFieldGet @@ -7625,7 +7606,6 @@ FSharp.Compiler.Syntax.SynExpr: Boolean IsJoinIn FSharp.Compiler.Syntax.SynExpr: Boolean IsLambda FSharp.Compiler.Syntax.SynExpr: Boolean IsLazy FSharp.Compiler.Syntax.SynExpr: Boolean IsLetOrUse -FSharp.Compiler.Syntax.SynExpr: Boolean IsLetOrUseBang FSharp.Compiler.Syntax.SynExpr: Boolean IsLibraryOnlyILAssembly FSharp.Compiler.Syntax.SynExpr: Boolean IsLibraryOnlyStaticOptimization FSharp.Compiler.Syntax.SynExpr: Boolean IsLibraryOnlyUnionCaseFieldGet @@ -7696,7 +7676,6 @@ FSharp.Compiler.Syntax.SynExpr: Boolean get_IsJoinIn() FSharp.Compiler.Syntax.SynExpr: Boolean get_IsLambda() FSharp.Compiler.Syntax.SynExpr: Boolean get_IsLazy() FSharp.Compiler.Syntax.SynExpr: Boolean get_IsLetOrUse() -FSharp.Compiler.Syntax.SynExpr: Boolean get_IsLetOrUseBang() FSharp.Compiler.Syntax.SynExpr: Boolean get_IsLibraryOnlyILAssembly() FSharp.Compiler.Syntax.SynExpr: Boolean get_IsLibraryOnlyStaticOptimization() FSharp.Compiler.Syntax.SynExpr: Boolean get_IsLibraryOnlyUnionCaseFieldGet() @@ -7766,7 +7745,6 @@ FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewJoinIn(FSharp. FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewLambda(Boolean, Boolean, FSharp.Compiler.Syntax.SynSimplePats, FSharp.Compiler.Syntax.SynExpr, Microsoft.FSharp.Core.FSharpOption`1[System.Tuple`2[Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynPat],FSharp.Compiler.Syntax.SynExpr]], FSharp.Compiler.Text.Range, FSharp.Compiler.SyntaxTrivia.SynExprLambdaTrivia) FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewLazy(FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewLetOrUse(Boolean, Boolean, Boolean, Boolean, Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynBinding], FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range, FSharp.Compiler.SyntaxTrivia.SynExprLetOrUseTrivia) -FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewLetOrUseBang(FSharp.Compiler.Syntax.DebugPointAtBinding, Boolean, Boolean, FSharp.Compiler.Syntax.SynPat, FSharp.Compiler.Syntax.SynExpr, Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynBinding], FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range, FSharp.Compiler.SyntaxTrivia.SynExprLetOrUseTrivia) FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewLibraryOnlyILAssembly(System.Object, Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynType], Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynExpr], Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynType], FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewLibraryOnlyStaticOptimization(Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynStaticOptimizationConstraint], FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewLibraryOnlyUnionCaseFieldGet(FSharp.Compiler.Syntax.SynExpr, Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.Ident], Int32, FSharp.Compiler.Text.Range) @@ -7836,7 +7814,6 @@ FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr+JoinIn FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr+Lambda FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr+Lazy FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr+LetOrUse -FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr+LetOrUseBang FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr+LibraryOnlyILAssembly FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr+LibraryOnlyStaticOptimization FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr+LibraryOnlyUnionCaseFieldGet From 4d57d096d41ac24ea046a38cd644362ec2c69362 Mon Sep 17 00:00:00 2001 From: edgargonzalez Date: Thu, 7 Aug 2025 09:56:22 +0200 Subject: [PATCH 14/24] Fix SynPat shouldBeParenthesizedInContext --- src/Compiler/Service/SynPat.fs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Compiler/Service/SynPat.fs b/src/Compiler/Service/SynPat.fs index aea86f1d942..bac6dd56b6c 100644 --- a/src/Compiler/Service/SynPat.fs +++ b/src/Compiler/Service/SynPat.fs @@ -92,8 +92,8 @@ module SynPat = // set (x: …, y: …) = … | SynPat.Typed _, SyntaxNode.SynPat(Rightmost(SynPat.Paren(Is pat, _))) :: SyntaxNode.SynMatchClause _ :: _ | Rightmost(SynPat.Typed _), SyntaxNode.SynMatchClause _ :: _ - | SynPat.Typed _, SyntaxNode.SynExpr(SynExpr.LetOrUse _) :: _ - | SynPat.Typed _, SyntaxNode.SynPat(SynPat.Tuple(isStruct = false)) :: SyntaxNode.SynExpr(SynExpr.LetOrUse _) :: _ + | SynPat.Typed _, SyntaxNode.SynExpr(SynExpr.LetOrUse(isComputed = true)) :: _ + | SynPat.Typed _, SyntaxNode.SynPat(SynPat.Tuple(isStruct = false)) :: SyntaxNode.SynExpr(SynExpr.LetOrUse(isComputed = true)) :: _ | SynPat.Tuple(isStruct = false; elementPats = AnyTyped), SyntaxNode.SynExpr(SynExpr.LetOrUse _) :: _ | SynPat.Typed _, SyntaxNode.SynPat(SynPat.Tuple(isStruct = false)) :: SyntaxNode.SynBinding _ :: _ | SynPat.Tuple(isStruct = false; elementPats = AnyTyped), SyntaxNode.SynBinding _ :: _ @@ -242,7 +242,7 @@ module SynPat = // fun (x) -> … | _, SyntaxNode.SynBinding _ :: _ | _, SyntaxNode.SynExpr(SynExpr.ForEach _) :: _ - | _, SyntaxNode.SynExpr(SynExpr.LetOrUse _) :: _ + | _, SyntaxNode.SynExpr(SynExpr.LetOrUse(isComputed = true)) :: _ | _, SyntaxNode.SynMatchClause _ :: _ | Atomic, SyntaxNode.SynExpr(SynExpr.Lambda(parsedData = Some _)) :: _ -> false From d3bac4aa094765ff309b61d11572808e4f43b1f0 Mon Sep 17 00:00:00 2001 From: Edgar Gonzalez Date: Thu, 7 Aug 2025 13:16:14 +0200 Subject: [PATCH 15/24] Update SynPat.fs --- src/Compiler/Service/SynPat.fs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Compiler/Service/SynPat.fs b/src/Compiler/Service/SynPat.fs index bac6dd56b6c..bf29f878592 100644 --- a/src/Compiler/Service/SynPat.fs +++ b/src/Compiler/Service/SynPat.fs @@ -94,7 +94,7 @@ module SynPat = | Rightmost(SynPat.Typed _), SyntaxNode.SynMatchClause _ :: _ | SynPat.Typed _, SyntaxNode.SynExpr(SynExpr.LetOrUse(isComputed = true)) :: _ | SynPat.Typed _, SyntaxNode.SynPat(SynPat.Tuple(isStruct = false)) :: SyntaxNode.SynExpr(SynExpr.LetOrUse(isComputed = true)) :: _ - | SynPat.Tuple(isStruct = false; elementPats = AnyTyped), SyntaxNode.SynExpr(SynExpr.LetOrUse _) :: _ + | SynPat.Tuple(isStruct = false; elementPats = AnyTyped), SyntaxNode.SynExpr(SynExpr.LetOrUse(isComputed = true)) :: _ | SynPat.Typed _, SyntaxNode.SynPat(SynPat.Tuple(isStruct = false)) :: SyntaxNode.SynBinding _ :: _ | SynPat.Tuple(isStruct = false; elementPats = AnyTyped), SyntaxNode.SynBinding _ :: _ | SynPat.LongIdent(argPats = SynArgPats.Pats(_ :: _)), SyntaxNode.SynBinding _ :: _ From 0ceae7bdddbd23a6827baa8a4f207439787b2fb7 Mon Sep 17 00:00:00 2001 From: edgargonzalez Date: Fri, 8 Aug 2025 07:50:43 +0200 Subject: [PATCH 16/24] Attempt to fix editor test --- src/Compiler/Service/SynPat.fs | 6 ++++++ tests/FSharp.Compiler.Service.Tests/SynPatTests.fs | 3 +++ 2 files changed, 9 insertions(+) diff --git a/src/Compiler/Service/SynPat.fs b/src/Compiler/Service/SynPat.fs index bac6dd56b6c..3636c3a5dbf 100644 --- a/src/Compiler/Service/SynPat.fs +++ b/src/Compiler/Service/SynPat.fs @@ -97,6 +97,12 @@ module SynPat = | SynPat.Tuple(isStruct = false; elementPats = AnyTyped), SyntaxNode.SynExpr(SynExpr.LetOrUse _) :: _ | SynPat.Typed _, SyntaxNode.SynPat(SynPat.Tuple(isStruct = false)) :: SyntaxNode.SynBinding _ :: _ | SynPat.Tuple(isStruct = false; elementPats = AnyTyped), SyntaxNode.SynBinding _ :: _ + + // let! (_ : obj) = … + | SynPat.Typed _, SyntaxNode.SynBinding _ :: SyntaxNode.SynExpr(SynExpr.LetOrUse(isComputed = true)) :: _ -> true + + // let! (A _) = … + | SynPat.LongIdent _, SyntaxNode.SynBinding _ :: SyntaxNode.SynExpr(SynExpr.LetOrUse(isComputed = true)) :: _ -> false | SynPat.LongIdent(argPats = SynArgPats.Pats(_ :: _)), SyntaxNode.SynBinding _ :: _ | SynPat.LongIdent(argPats = SynArgPats.Pats(_ :: _)), SyntaxNode.SynExpr(SynExpr.Lambda _) :: _ | SynPat.Tuple(isStruct = false), SyntaxNode.SynExpr(SynExpr.Lambda(parsedData = Some _)) :: _ diff --git a/tests/FSharp.Compiler.Service.Tests/SynPatTests.fs b/tests/FSharp.Compiler.Service.Tests/SynPatTests.fs index 74d87d8919f..35edcc03a98 100644 --- a/tests/FSharp.Compiler.Service.Tests/SynPatTests.fs +++ b/tests/FSharp.Compiler.Service.Tests/SynPatTests.fs @@ -18,6 +18,9 @@ let pats: obj array list = [|[Unneeded; Unneeded]; "let ((Lazy x)) = lazy 1"|] [|[Needed; Unneeded]; "let (()) = ()"|] [|[Needed; Unneeded; Unneeded]; "let ((())) = ()"|] + [|[Needed]; "async { let! (_ : obj) = Unchecked.defaultof<_>; return () }"|] + [|[Unneeded]; "async { let! (A _) = Unchecked.defaultof<_>; return () }"|] + [|[Needed]; "async { let! (x : int) = async { return 3 }"|] ] // `expected` represents whether each parenthesized pattern, from the inside outward, requires its parentheses. From ca1c51646bef30d876cf23d0e650d4f67d5d6255 Mon Sep 17 00:00:00 2001 From: edgargonzalez Date: Fri, 8 Aug 2025 09:29:33 +0200 Subject: [PATCH 17/24] Simplify mkLetExpression --- src/Compiler/SyntaxTree/ParseHelpers.fs | 11 +++++----- src/Compiler/SyntaxTree/ParseHelpers.fsi | 5 ++--- src/Compiler/pars.fsy | 27 +++++++++--------------- 3 files changed, 17 insertions(+), 26 deletions(-) diff --git a/src/Compiler/SyntaxTree/ParseHelpers.fs b/src/Compiler/SyntaxTree/ParseHelpers.fs index b306bd30637..917e81c5dc1 100644 --- a/src/Compiler/SyntaxTree/ParseHelpers.fs +++ b/src/Compiler/SyntaxTree/ParseHelpers.fs @@ -1071,16 +1071,15 @@ let leadingKeywordIsAbstract = let mkLetExpression ( isBang: bool, - mKeyword: range, - mIn: Option, + mIn: range option, mWhole: range, body: SynExpr, - bindingInfo: (bool * BindingSet) option, - bangInfo: (SynPat * SynExpr * SynBinding list * range option * bool) option + bindingInfo: BindingSet option, + bangInfo: (SynPat * SynExpr * SynBinding list * range * range option * bool) option ) = if isBang then match bangInfo with - | Some(pat, rhs, andBangs, mEquals, isUse) -> + | Some(pat, rhs, andBangs, mKeyword, mEquals, isUse) -> let spBind = DebugPointAtBinding.Yes(unionRanges mKeyword rhs.Range) let trivia: SynBindingTrivia = @@ -1122,7 +1121,7 @@ let mkLetExpression | None -> SynExpr.FromParseError(body, mWhole) else match bindingInfo with - | Some(isRec, BindingSetPreAttrs(_, _, isUse, declsPreAttrs, _)) -> + | Some(BindingSetPreAttrs(_, isRec, isUse, declsPreAttrs, _)) -> let ignoredFreeAttrs, decls = declsPreAttrs [] None let mWhole = diff --git a/src/Compiler/SyntaxTree/ParseHelpers.fsi b/src/Compiler/SyntaxTree/ParseHelpers.fsi index b233a502853..f1b91b1f64f 100644 --- a/src/Compiler/SyntaxTree/ParseHelpers.fsi +++ b/src/Compiler/SyntaxTree/ParseHelpers.fsi @@ -200,12 +200,11 @@ val mkClassMemberLocalBindings: /// Handles all four cases: 'let', 'let!', 'use', and 'use!' val mkLetExpression: isBang: bool * - mKeyword: range * mIn: range option * mWhole: range * body: SynExpr * - bindingInfo: (bool * BindingSet) option * - bangInfo: (SynPat * SynExpr * SynBinding list * range option * bool) option -> + bindingInfo: BindingSet option * + bangInfo: (SynPat * SynExpr * SynBinding list * range * range option * bool) option -> SynExpr val mkAndBang: diff --git a/src/Compiler/pars.fsy b/src/Compiler/pars.fsy index 8b0dfa4ae8c..a8225213eb6 100644 --- a/src/Compiler/pars.fsy +++ b/src/Compiler/pars.fsy @@ -4112,8 +4112,7 @@ sequentialExpr: let usedKeyword = if isUse then "use" else "let" reportParseErrorAt mLetKwd (FSComp.SR.parsExpectedExpressionAfterLet(usedKeyword, usedKeyword)) let fauxRange = m.EndRange // zero width range at end of m - let isRec = match bindingSet with BindingSetPreAttrs(_, isRec, _, _, _) -> isRec - mkLetExpression(false, mLetKwd, mIn, m, arbExpr ("seqExpr", fauxRange), Some(isRec, bindingSet), None) } + mkLetExpression(false, mIn, m, arbExpr ("seqExpr", fauxRange), Some bindingSet, None) } /* Use this as the last terminal when performing error recovery */ /* The contract for using this is that (a) if EOF occurs then the */ @@ -4165,15 +4164,13 @@ declExpr: { let mIn = rhs parseState 2 |> Some let mWhole = unionRanges (rhs2 parseState 1 2) $3.Range let bindingSet = $1 - let mKeyword, isRec = match bindingSet with BindingSetPreAttrs(m, isRec, _, _, _) -> m, isRec - mkLetExpression(false, mKeyword, mIn, mWhole, $3, Some(isRec, bindingSet), None) } + mkLetExpression(false, mIn, mWhole, $3, Some bindingSet, None) } | defnBindings IN error %prec expr_let { let mIn = rhs parseState 2 |> Some let mWhole = rhs2 parseState 1 2 let bindingSet = $1 - let mKeyword, isRec = match bindingSet with BindingSetPreAttrs(m, isRec, _, _, _) -> m, isRec - mkLetExpression(false, mKeyword, mIn, mWhole, arbExpr ("declExpr1", (rhs parseState 3)), Some(isRec, bindingSet), None) } + mkLetExpression(false, mIn, mWhole, arbExpr ("declExpr1", (rhs parseState 3)), Some bindingSet, None) } /* FSComp.SR.parsNoMatchingInForLet() -- leave this in for now - it's an unused error string */ @@ -4181,27 +4178,23 @@ declExpr: | hardwhiteLetBindings typedSequentialExprBlock %prec expr_let { let bindingSet, m, mIn = $1 let mWhole = unionRanges m $2.Range - let mKeyword, isRec = match bindingSet with BindingSetPreAttrs(m, isRec, _, _, _) -> m, isRec - mkLetExpression(false, mKeyword, mIn, mWhole, $2, Some(isRec, bindingSet), None) } + mkLetExpression(false, mIn, mWhole, $2, Some bindingSet, None) } | hardwhiteLetBindings error %prec expr_let { let bindingSet, m, mIn = $1 reportParseErrorAt (match bindingSet with (BindingSetPreAttrs(m, _, _, _, _)) -> m) (FSComp.SR.parsErrorInReturnForLetIncorrectIndentation()) - let mKeyword, isRec = match bindingSet with BindingSetPreAttrs(m, isRec, _, _, _) -> m, isRec - mkLetExpression(false, mKeyword, mIn, m, arbExpr ("declExpr2", (rhs parseState 2)), Some(isRec, bindingSet), None) } + mkLetExpression(false, mIn, m, arbExpr ("declExpr2", (rhs parseState 2)), Some bindingSet, None) } | hardwhiteLetBindings OBLOCKSEP typedSequentialExprBlock %prec expr_let { let bindingSet, m, mIn = $1 let mWhole = unionRanges m $3.Range - let mKeyword, isRec = match bindingSet with BindingSetPreAttrs(m, isRec, _, _, _) -> m, isRec - mkLetExpression(false, mKeyword, mIn, mWhole, $3, Some(isRec, bindingSet), None) } + mkLetExpression(false, mIn, mWhole, $3, Some bindingSet, None) } | hardwhiteLetBindings OBLOCKSEP error %prec expr_let { let bindingSet, m, mIn = $1 //reportParseErrorAt (match bindingSet with (BindingSetPreAttrs(m, _, _, _, _)) -> m) (FSComp.SR.parsErrorInReturnForLetIncorrectIndentation()) let mWhole = unionRanges m (rhs parseState 3) - let mKeyword, isRec = match bindingSet with BindingSetPreAttrs(m, isRec, _, _, _) -> m, isRec - mkLetExpression(false, mKeyword, mIn, mWhole, arbExpr ("declExpr3", (rhs parseState 3)), Some(isRec, bindingSet), None) } + mkLetExpression(false, mIn, mWhole, arbExpr ("declExpr3", (rhs parseState 3)), Some bindingSet, None) } | hardwhiteDoBinding %prec expr_let { let (BindingSetPreAttrs(_, _, _, _, m)), e = $1 @@ -4539,7 +4532,7 @@ declExpr: // $1 contains the actual keyword ("let" or "use") let isUse = ($1 = "use") - mkLetExpression(true, mKeyword, None, m, $8, None, Some(pat, $4, $7, mEquals, isUse)) } + mkLetExpression(true, None, m, $8, None, Some(pat, $4, $7, mKeyword, mEquals, isUse)) } | OBINDER ceBindingCore EQUALS typedSequentialExprBlock hardwhiteDefnBindingsTerminator opt_OBLOCKSEP moreBinders typedSequentialExprBlock %prec expr_let { // Offside-sensitive version of let!/use! binding @@ -4557,7 +4550,7 @@ declExpr: let isUse = ($1 = "use") - mkLetExpression(true, mKeyword, None, m, $8, None, Some(pat, $4, $7, mEquals, isUse)) } + mkLetExpression(true, None, m, $8, None, Some(pat, $4, $7, mKeyword, mEquals, isUse)) } | OBINDER ceBindingCore EQUALS typedSequentialExprBlock hardwhiteDefnBindingsTerminator opt_OBLOCKSEP error %prec expr_let { // Error recovery for incomplete let!/use! bindings @@ -4576,7 +4569,7 @@ declExpr: let isUse = ($1 = "use") // Use ImplicitZero as the continuation expression for error recovery - mkLetExpression(true, mKeyword, None, mAll, SynExpr.ImplicitZero m, None, Some(pat, $4, [], mEquals, isUse)) } + mkLetExpression(true, None, mAll, SynExpr.ImplicitZero m, None, Some(pat, $4, [], mKeyword, mEquals, isUse)) } | DO_BANG typedSequentialExpr IN opt_OBLOCKSEP typedSequentialExprBlock %prec expr_let { let spBind = DebugPointAtBinding.NoneAtDo From 47429e659959433f932bfcdbae0f47001b013d86 Mon Sep 17 00:00:00 2001 From: edgargonzalez Date: Fri, 8 Aug 2025 09:50:27 +0200 Subject: [PATCH 18/24] one more test --- .../SynType/Typed LetBang AndBang 19.fs | 9 +++ .../SynType/Typed LetBang AndBang 19.fs.bsl | 81 +++++++++++++++++++ 2 files changed, 90 insertions(+) create mode 100644 tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 19.fs create mode 100644 tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 19.fs.bsl diff --git a/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 19.fs b/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 19.fs new file mode 100644 index 00000000000..c36c9866340 --- /dev/null +++ b/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 19.fs @@ -0,0 +1,9 @@ +module Module + +async { + let rec a = 3 + and b = 5 + let! a = 3 + and! b = 5 + return () +} \ No newline at end of file diff --git a/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 19.fs.bsl b/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 19.fs.bsl new file mode 100644 index 00000000000..492a611be77 --- /dev/null +++ b/tests/service/data/SyntaxTree/SynType/Typed LetBang AndBang 19.fs.bsl @@ -0,0 +1,81 @@ +ImplFile + (ParsedImplFileInput + ("/root/SynType/Typed LetBang AndBang 19.fs", false, + QualifiedNameOfFile Module, [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Expr + (App + (NonAtomic, false, Ident async, + ComputationExpr + (false, + LetOrUse + (true, false, true, false, + [SynBinding + (None, Normal, false, false, [], + PreXmlDoc ((4,4), FSharp.Compiler.Xml.XmlDocCollector), + SynValData + (None, + SynValInfo ([], SynArgInfo ([], false, None)), + None), + Named (SynIdent (a, None), false, None, (4,12--4,13)), + None, Const (Int32 3, (4,16--4,17)), (4,12--4,13), + Yes (4,4--4,17), + { LeadingKeyword = LetRec ((4,4--4,7), (4,8--4,11)) + InlineKeyword = None + EqualsRange = Some (4,14--4,15) }); + SynBinding + (None, Normal, false, false, [], + PreXmlDoc ((5,8), FSharp.Compiler.Xml.XmlDocCollector), + SynValData + (None, + SynValInfo ([], SynArgInfo ([], false, None)), + None), + Named (SynIdent (b, None), false, None, (5,8--5,9)), + None, Const (Int32 5, (5,12--5,13)), (5,8--5,9), + Yes (5,4--5,13), { LeadingKeyword = And (5,4--5,7) + InlineKeyword = None + EqualsRange = Some (5,10--5,11) })], + LetOrUse + (false, false, true, true, + [SynBinding + (None, Normal, false, false, [], PreXmlDocEmpty, + SynValData + (None, + SynValInfo ([], SynArgInfo ([], false, None)), + None), + Named + (SynIdent (a, None), false, None, (6,9--6,10)), + None, Const (Int32 3, (6,13--6,14)), (6,4--8,13), + Yes (6,4--6,14), + { LeadingKeyword = Let (6,4--6,8) + InlineKeyword = None + EqualsRange = Some (6,11--6,12) }); + SynBinding + (None, Normal, false, false, [], PreXmlDocEmpty, + SynValData + (None, + SynValInfo ([], SynArgInfo ([], false, None)), + None), + Named + (SynIdent (b, None), false, None, (7,9--7,10)), + None, Const (Int32 5, (7,13--7,14)), (7,4--7,14), + Yes (7,4--7,14), + { LeadingKeyword = And (7,4--7,8) + InlineKeyword = None + EqualsRange = Some (7,11--7,12) })], + YieldOrReturn + ((false, true), Const (Unit, (8,11--8,13)), + (8,4--8,13), { YieldOrReturnKeyword = (8,4--8,10) }), + (6,4--8,13), { LetOrUseKeyword = (6,4--6,8) + InKeyword = None + EqualsRange = Some (6,11--6,12) }), + (4,4--8,13), { LetOrUseKeyword = (4,4--4,11) + InKeyword = None + EqualsRange = Some (4,14--4,15) }), + (3,6--9,1)), (3,0--9,1)), (3,0--9,1))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--9,1), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + WarnDirectives = [] + CodeComments = [] }, set [])) From a9f08ae9abc499c339bf1cbb5f8d653803dcce10 Mon Sep 17 00:00:00 2001 From: edgargonzalez Date: Fri, 8 Aug 2025 13:37:35 +0200 Subject: [PATCH 19/24] Add comments to explain the meaning of the new flags --- src/Compiler/SyntaxTree/ParseHelpers.fs | 47 +++++++++++++++---------- src/Compiler/SyntaxTree/SyntaxTree.fsi | 4 +++ 2 files changed, 32 insertions(+), 19 deletions(-) diff --git a/src/Compiler/SyntaxTree/ParseHelpers.fs b/src/Compiler/SyntaxTree/ParseHelpers.fs index 917e81c5dc1..8e8deea6950 100644 --- a/src/Compiler/SyntaxTree/ParseHelpers.fs +++ b/src/Compiler/SyntaxTree/ParseHelpers.fs @@ -1110,14 +1110,22 @@ let mkLetExpression trivia = trivia ) - let trivia: SynExprLetOrUseTrivia = - { - LetOrUseKeyword = mKeyword - InKeyword = mIn - EqualsRange = mEquals - } + SynExpr.LetOrUse( + isRecursive = false, + isUse = isUse, + isFromSource = true, + isComputed = true, + bindings = binding :: andBangs, + body = body, + range = mWhole, + trivia = + { + LetOrUseKeyword = mKeyword + InKeyword = mIn + EqualsRange = mEquals + } + ) - SynExpr.LetOrUse(false, isUse, true, true, binding :: andBangs, body, mWhole, trivia) | None -> SynExpr.FromParseError(body, mWhole) else match bindingInfo with @@ -1151,17 +1159,18 @@ let mkLetExpression | _ -> None SynExpr.LetOrUse( - isRec, - isUse, - true, - false, - decls, - body, - mWhole, - { - LetOrUseKeyword = mLetOrUse - InKeyword = mIn' - EqualsRange = mEquals - } + isRecursive = isRec, + isUse = isUse, + isFromSource = true, + isComputed = false, + bindings = decls, + body = body, + range = mWhole, + trivia = + { + LetOrUseKeyword = mLetOrUse + InKeyword = mIn' + EqualsRange = mEquals + } ) | None -> SynExpr.FromParseError(body, mWhole) diff --git a/src/Compiler/SyntaxTree/SyntaxTree.fsi b/src/Compiler/SyntaxTree/SyntaxTree.fsi index 3a0d6bf206e..a6fa899512b 100644 --- a/src/Compiler/SyntaxTree/SyntaxTree.fsi +++ b/src/Compiler/SyntaxTree/SyntaxTree.fsi @@ -882,9 +882,13 @@ type SynExpr = /// F# syntax: use! pat = expr in expr /// F# syntax: let! pat = expr and! ... and! ... and! pat = expr in expr | LetOrUse of + // isRecursive: true for 'let rec' and 'use rec' bindings, false for 'let' and 'use' bindings isRecursive: bool * + /// isUse: true for 'use' and 'use!' bindings, false for 'let' and 'let!' isUse: bool * + // isFromSource: flag indicates whether a binding was explicitly written by the user in the source code versus generated by the compiler during transformations. isFromSource: bool * + // isComputed: true for 'let!' and 'use!' bindings, false for 'let' and 'use' bindings isComputed: bool * bindings: SynBinding list * body: SynExpr * From 121a373b26ee245a4e89119072f3783348843dc1 Mon Sep 17 00:00:00 2001 From: edgargonzalez Date: Fri, 8 Aug 2025 13:58:40 +0200 Subject: [PATCH 20/24] Update to always use named fields --- .../Checking/CheckRecordSyntaxHelpers.fs | 11 +- .../CheckComputationExpressions.fs | 125 ++++++++++++++++-- .../Checking/Expressions/CheckExpressions.fs | 2 +- 3 files changed, 125 insertions(+), 13 deletions(-) diff --git a/src/Compiler/Checking/CheckRecordSyntaxHelpers.fs b/src/Compiler/Checking/CheckRecordSyntaxHelpers.fs index 36aec272f56..584ae4203ed 100644 --- a/src/Compiler/Checking/CheckRecordSyntaxHelpers.fs +++ b/src/Compiler/Checking/CheckRecordSyntaxHelpers.fs @@ -180,4 +180,13 @@ let BindOriginalRecdExpr (withExpr: SynExpr * BlockSeparator) mkRecdExpr = None, SynBindingTrivia.Zero) - SynExpr.LetOrUse(false, false, false, false, [ binding ], mkRecdExpr (Some withExpr), mOrigExprSynth, SynExprLetOrUseTrivia.Zero) + SynExpr.LetOrUse( + isRecursive = false, + isUse = false, + isFromSource = false, + isComputed = false, + bindings = [ binding ], + body = mkRecdExpr (Some withExpr), + range = mOrigExprSynth, + trivia = SynExprLetOrUseTrivia.Zero + ) diff --git a/src/Compiler/Checking/Expressions/CheckComputationExpressions.fs b/src/Compiler/Checking/Expressions/CheckComputationExpressions.fs index b8ce8bd9a46..b152868e489 100644 --- a/src/Compiler/Checking/Expressions/CheckComputationExpressions.fs +++ b/src/Compiler/Checking/Expressions/CheckComputationExpressions.fs @@ -1415,7 +1415,16 @@ let rec TryTranslateComputationExpression ) let bindCondExpr = - SynExpr.LetOrUse(false, false, true, true, [ binding ], setCondExpr, mGuard, SynExprLetOrUseTrivia.Zero) + SynExpr.LetOrUse( + isRecursive = false, + isUse = false, + isFromSource = true, + isComputed = true, + bindings = [ binding ], + body = setCondExpr, + range = mGuard, + trivia = SynExprLetOrUseTrivia.Zero + ) let whileExpr = SynExpr.While( @@ -1432,7 +1441,16 @@ let rec TryTranslateComputationExpression mOrig ) - SynExpr.LetOrUse(false, false, false, false, [ condBinding ], whileExpr, mGuard, SynExprLetOrUseTrivia.Zero) + SynExpr.LetOrUse( + isRecursive = false, + isUse = false, + isFromSource = false, + isComputed = false, + bindings = [ condBinding ], + body = whileExpr, + range = mGuard, + trivia = SynExprLetOrUseTrivia.Zero + ) let binding = SynBinding( @@ -1451,7 +1469,16 @@ let rec TryTranslateComputationExpression trivia = SynBindingTrivia.Zero ) - SynExpr.LetOrUse(false, false, true, true, [ binding ], body, mGuard, SynExprLetOrUseTrivia.Zero) + SynExpr.LetOrUse( + isRecursive = false, + isUse = false, + isFromSource = true, + isComputed = true, + bindings = [ binding ], + body = body, + range = mGuard, + trivia = SynExprLetOrUseTrivia.Zero + ) TryTranslateComputationExpression ceenv CompExprTranslationPass.Initial q varSpace rewrittenWhileExpr translatedCtxt @@ -1662,7 +1689,16 @@ let rec TryTranslateComputationExpression CompExprTranslationPass.Initial q varSpace - (SynExpr.LetOrUse(false, false, true, true, [ binding ], innerComp2, m, SynExprLetOrUseTrivia.Zero)) + (SynExpr.LetOrUse( + isRecursive = false, + isUse = false, + isFromSource = true, + isComputed = true, + bindings = [ binding ], + body = innerComp2, + range = m, + trivia = SynExprLetOrUseTrivia.Zero + )) translatedCtxt ) @@ -1730,7 +1766,15 @@ let rec TryTranslateComputationExpression ) // 'let binds in expr' - | SynExpr.LetOrUse(isRec, false, isFromSource, false, binds, innerComp, m, trivia) -> + | SynExpr.LetOrUse( + isRecursive = isRec + isUse = false + isFromSource = isFromSource + isComputed = false + bindings = binds + body = innerComp + range = m + trivia = trivia) -> // For 'query' check immediately if ceenv.isQuery then @@ -1763,7 +1807,18 @@ let rec TryTranslateComputationExpression Some( TranslateComputationExpression ceenv CompExprTranslationPass.Initial q varSpace innerComp (fun holeFill -> - translatedCtxt (SynExpr.LetOrUse(isRec, false, isFromSource, false, binds, holeFill, m, trivia))) + translatedCtxt ( + SynExpr.LetOrUse( + isRecursive = isRec, + isUse = false, + isFromSource = isFromSource, + isComputed = false, + bindings = binds, + body = holeFill, + range = m, + trivia = trivia + ) + )) ) // 'use x = expr in expr' @@ -2409,7 +2464,16 @@ and ConsumeCustomOpClauses trivia = SynBindingTrivia.Zero ) - SynExpr.LetOrUse(false, false, false, true, [ binding ], contExpr, intoPat.Range, SynExprLetOrUseTrivia.Zero) + SynExpr.LetOrUse( + isRecursive = false, + isUse = false, + isFromSource = false, + isComputed = true, + bindings = [ binding ], + body = contExpr, + range = intoPat.Range, + trivia = SynExprLetOrUseTrivia.Zero + ) else SynExpr.ForEach( DebugPointAtFor.No, @@ -2457,7 +2521,16 @@ and ConsumeCustomOpClauses trivia = SynBindingTrivia.Zero ) - SynExpr.LetOrUse(false, false, false, true, [ binding ], compClausesExpr, compClausesExpr.Range, SynExprLetOrUseTrivia.Zero) + SynExpr.LetOrUse( + isRecursive = false, + isUse = false, + isFromSource = false, + isComputed = true, + bindings = [ binding ], + body = compClausesExpr, + range = compClausesExpr.Range, + trivia = SynExprLetOrUseTrivia.Zero + ) else SynExpr.ForEach( DebugPointAtFor.No, @@ -2587,11 +2660,32 @@ and convertSimpleReturnToExpr (ceenv: ComputationExpressionContext<'a>) comp var | Some elseExprOpt -> Some(SynExpr.IfThenElse(guardExpr, thenExpr, elseExprOpt, spIfToThen, isRecovery, mIfToEndOfElseBranch, trivia), None) - | SynExpr.LetOrUse(isRec, false, isFromSource, false, binds, innerComp, m, trivia) -> + | SynExpr.LetOrUse( + isRecursive = isRec + isUse = false + isFromSource = isFromSource + isComputed = false + bindings = binds + body = innerComp + range = m + trivia = trivia) -> match convertSimpleReturnToExpr ceenv comp varSpace innerComp with | None -> None | Some(_, Some _) -> None - | Some(innerExpr, None) -> Some(SynExpr.LetOrUse(isRec, false, isFromSource, false, binds, innerExpr, m, trivia), None) + | Some(innerExpr, None) -> + Some( + SynExpr.LetOrUse( + isRecursive = isRec, + isUse = false, + isFromSource = isFromSource, + isComputed = false, + bindings = binds, + body = innerExpr, + range = m, + trivia = trivia + ), + None + ) | OptionalSequential(CustomOperationClause ceenv (nm, _, _, mClause, _), _) when customOperationMaintainsVarSpaceUsingBind ceenv nm -> @@ -2707,7 +2801,16 @@ and TranslateComputationExpression (ceenv: ComputationExpressionContext<'a>) fir trivia = SynBindingTrivia.Zero ) - SynExpr.LetOrUse(false, false, false, true, [ binding ], bodyExpr, m, SynExprLetOrUseTrivia.Zero) + SynExpr.LetOrUse( + isRecursive = false, + isUse = false, + isFromSource = false, + isComputed = true, + bindings = [ binding ], + body = bodyExpr, + range = m, + trivia = SynExprLetOrUseTrivia.Zero + ) TranslateComputationExpression ceenv CompExprTranslationPass.Initial q varSpace letBangBind translatedCtxt diff --git a/src/Compiler/Checking/Expressions/CheckExpressions.fs b/src/Compiler/Checking/Expressions/CheckExpressions.fs index 23ce68b1241..0b0c0b22169 100644 --- a/src/Compiler/Checking/Expressions/CheckExpressions.fs +++ b/src/Compiler/Checking/Expressions/CheckExpressions.fs @@ -10614,7 +10614,7 @@ and TcLinearExprs bodyChecker cenv env overallTy tpenv isCompExpr synExpr cont = TcLinearExprs bodyChecker cenv env2 overallTy tpenv isCompExpr expr2 (fun (expr2R, tpenv) -> cont (Expr.Sequential (expr1R, expr2R, NormalSeq, m), tpenv)) - | SynExpr.LetOrUse (isRec, isUse, _, _, binds, body, m, _) when not (isUse && isCompExpr) -> + | SynExpr.LetOrUse (isRecursive = isRec; isUse= isUse; bindings = binds; body = body; range = m) when not (isUse && isCompExpr) -> if isRec then // TcLinearExprs processes at most one recursive binding, this is not tailcalling CheckRecursiveBindingIds binds From b1ed90b828dd3d5511262f9261c77f859cf4c2fa Mon Sep 17 00:00:00 2001 From: edgargonzalez Date: Fri, 8 Aug 2025 14:08:56 +0200 Subject: [PATCH 21/24] document isFromSource --- src/Compiler/Checking/CheckRecordSyntaxHelpers.fs | 2 +- .../Expressions/CheckComputationExpressions.fs | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Compiler/Checking/CheckRecordSyntaxHelpers.fs b/src/Compiler/Checking/CheckRecordSyntaxHelpers.fs index 584ae4203ed..f34df2a0e62 100644 --- a/src/Compiler/Checking/CheckRecordSyntaxHelpers.fs +++ b/src/Compiler/Checking/CheckRecordSyntaxHelpers.fs @@ -183,7 +183,7 @@ let BindOriginalRecdExpr (withExpr: SynExpr * BlockSeparator) mkRecdExpr = SynExpr.LetOrUse( isRecursive = false, isUse = false, - isFromSource = false, + isFromSource = false, // compiler generated during desugaring isComputed = false, bindings = [ binding ], body = mkRecdExpr (Some withExpr), diff --git a/src/Compiler/Checking/Expressions/CheckComputationExpressions.fs b/src/Compiler/Checking/Expressions/CheckComputationExpressions.fs index b152868e489..c6baeb3796e 100644 --- a/src/Compiler/Checking/Expressions/CheckComputationExpressions.fs +++ b/src/Compiler/Checking/Expressions/CheckComputationExpressions.fs @@ -1418,7 +1418,7 @@ let rec TryTranslateComputationExpression SynExpr.LetOrUse( isRecursive = false, isUse = false, - isFromSource = true, + isFromSource = true, // compiler generated during desugaring isComputed = true, bindings = [ binding ], body = setCondExpr, @@ -1444,7 +1444,7 @@ let rec TryTranslateComputationExpression SynExpr.LetOrUse( isRecursive = false, isUse = false, - isFromSource = false, + isFromSource = false, // compiler generated during desugaring isComputed = false, bindings = [ condBinding ], body = whileExpr, @@ -1472,7 +1472,7 @@ let rec TryTranslateComputationExpression SynExpr.LetOrUse( isRecursive = false, isUse = false, - isFromSource = true, + isFromSource = true, // compiler generated during desugaring isComputed = true, bindings = [ binding ], body = body, @@ -1692,7 +1692,7 @@ let rec TryTranslateComputationExpression (SynExpr.LetOrUse( isRecursive = false, isUse = false, - isFromSource = true, + isFromSource = true, // compiler generated during desugaring isComputed = true, bindings = [ binding ], body = innerComp2, @@ -2467,7 +2467,7 @@ and ConsumeCustomOpClauses SynExpr.LetOrUse( isRecursive = false, isUse = false, - isFromSource = false, + isFromSource = false, // compiler generated during desugaring isComputed = true, bindings = [ binding ], body = contExpr, @@ -2524,7 +2524,7 @@ and ConsumeCustomOpClauses SynExpr.LetOrUse( isRecursive = false, isUse = false, - isFromSource = false, + isFromSource = false, // compiler generated during desugaring isComputed = true, bindings = [ binding ], body = compClausesExpr, @@ -2804,7 +2804,7 @@ and TranslateComputationExpression (ceenv: ComputationExpressionContext<'a>) fir SynExpr.LetOrUse( isRecursive = false, isUse = false, - isFromSource = false, + isFromSource = false, // compiler generated during desugaring isComputed = true, bindings = [ binding ], body = bodyExpr, From 2f268f92f20bbbed46c3aaa0aa29a77361750357 Mon Sep 17 00:00:00 2001 From: edgargonzalez Date: Fri, 8 Aug 2025 14:49:30 +0200 Subject: [PATCH 22/24] Rename isComputed to isBang --- .../Checking/CheckRecordSyntaxHelpers.fs | 2 +- .../CheckComputationExpressions.fs | 32 +++++++++---------- .../Checking/Expressions/CheckExpressions.fs | 4 +-- .../Expressions/CheckExpressionsOps.fs | 2 +- .../Expressions/CheckSequenceExpressions.fs | 2 +- src/Compiler/Service/SynPat.fs | 12 +++---- src/Compiler/SyntaxTree/ParseHelpers.fs | 4 +-- src/Compiler/SyntaxTree/SyntaxTree.fs | 2 +- src/Compiler/SyntaxTree/SyntaxTree.fsi | 4 +-- ...ervice.SurfaceArea.netstandard20.debug.bsl | 29 +++-------------- ...vice.SurfaceArea.netstandard20.release.bsl | 4 +-- 11 files changed, 38 insertions(+), 59 deletions(-) diff --git a/src/Compiler/Checking/CheckRecordSyntaxHelpers.fs b/src/Compiler/Checking/CheckRecordSyntaxHelpers.fs index f34df2a0e62..861ad5587c6 100644 --- a/src/Compiler/Checking/CheckRecordSyntaxHelpers.fs +++ b/src/Compiler/Checking/CheckRecordSyntaxHelpers.fs @@ -184,7 +184,7 @@ let BindOriginalRecdExpr (withExpr: SynExpr * BlockSeparator) mkRecdExpr = isRecursive = false, isUse = false, isFromSource = false, // compiler generated during desugaring - isComputed = false, + isBang = false, bindings = [ binding ], body = mkRecdExpr (Some withExpr), range = mOrigExprSynth, diff --git a/src/Compiler/Checking/Expressions/CheckComputationExpressions.fs b/src/Compiler/Checking/Expressions/CheckComputationExpressions.fs index c6baeb3796e..1f31414599d 100644 --- a/src/Compiler/Checking/Expressions/CheckComputationExpressions.fs +++ b/src/Compiler/Checking/Expressions/CheckComputationExpressions.fs @@ -860,7 +860,7 @@ let (|ExprAsUseBang|_|) expr = | SynExpr.LetOrUse( isUse = true isFromSource = isFromSource - isComputed = true + isBang = true bindings = bindings body = innerComp trivia = { LetOrUseKeyword = mBind }) -> @@ -876,7 +876,7 @@ let (|ExprAsLetBang|_|) expr = | SynExpr.LetOrUse( isUse = false isFromSource = isFromSource - isComputed = true + isBang = true bindings = bindings body = innerComp trivia = { LetOrUseKeyword = mBind }) -> @@ -1419,7 +1419,7 @@ let rec TryTranslateComputationExpression isRecursive = false, isUse = false, isFromSource = true, // compiler generated during desugaring - isComputed = true, + isBang = true, bindings = [ binding ], body = setCondExpr, range = mGuard, @@ -1445,7 +1445,7 @@ let rec TryTranslateComputationExpression isRecursive = false, isUse = false, isFromSource = false, // compiler generated during desugaring - isComputed = false, + isBang = false, bindings = [ condBinding ], body = whileExpr, range = mGuard, @@ -1473,7 +1473,7 @@ let rec TryTranslateComputationExpression isRecursive = false, isUse = false, isFromSource = true, // compiler generated during desugaring - isComputed = true, + isBang = true, bindings = [ binding ], body = body, range = mGuard, @@ -1693,7 +1693,7 @@ let rec TryTranslateComputationExpression isRecursive = false, isUse = false, isFromSource = true, // compiler generated during desugaring - isComputed = true, + isBang = true, bindings = [ binding ], body = innerComp2, range = m, @@ -1770,7 +1770,7 @@ let rec TryTranslateComputationExpression isRecursive = isRec isUse = false isFromSource = isFromSource - isComputed = false + isBang = false bindings = binds body = innerComp range = m @@ -1812,7 +1812,7 @@ let rec TryTranslateComputationExpression isRecursive = isRec, isUse = false, isFromSource = isFromSource, - isComputed = false, + isBang = false, bindings = binds, body = holeFill, range = m, @@ -1824,7 +1824,7 @@ let rec TryTranslateComputationExpression // 'use x = expr in expr' | SynExpr.LetOrUse( isUse = true - isComputed = false + isBang = false bindings = [ SynBinding(kind = SynBindingKind.Normal; headPat = pat; expr = rhsExpr; debugPoint = spBind) ] body = innerComp trivia = { LetOrUseKeyword = mBind }) -> @@ -2468,7 +2468,7 @@ and ConsumeCustomOpClauses isRecursive = false, isUse = false, isFromSource = false, // compiler generated during desugaring - isComputed = true, + isBang = true, bindings = [ binding ], body = contExpr, range = intoPat.Range, @@ -2525,7 +2525,7 @@ and ConsumeCustomOpClauses isRecursive = false, isUse = false, isFromSource = false, // compiler generated during desugaring - isComputed = true, + isBang = true, bindings = [ binding ], body = compClausesExpr, range = compClausesExpr.Range, @@ -2664,7 +2664,7 @@ and convertSimpleReturnToExpr (ceenv: ComputationExpressionContext<'a>) comp var isRecursive = isRec isUse = false isFromSource = isFromSource - isComputed = false + isBang = false bindings = binds body = innerComp range = m @@ -2678,7 +2678,7 @@ and convertSimpleReturnToExpr (ceenv: ComputationExpressionContext<'a>) comp var isRecursive = isRec, isUse = false, isFromSource = isFromSource, - isComputed = false, + isBang = false, bindings = binds, body = innerExpr, range = m, @@ -2726,8 +2726,8 @@ and isSimpleExpr ceenv comp = && (match elseCompOpt with | None -> true | Some c -> isSimpleExpr ceenv c) - | SynExpr.LetOrUse(isComputed = false; body = innerComp) -> isSimpleExpr ceenv innerComp - | SynExpr.LetOrUse(isComputed = true) -> false + | SynExpr.LetOrUse(isBang = false; body = innerComp) -> isSimpleExpr ceenv innerComp + | SynExpr.LetOrUse(isBang = true) -> false | SynExpr.Match(clauses = clauses) -> clauses |> List.forall (fun (SynMatchClause(resultExpr = innerComp)) -> isSimpleExpr ceenv innerComp) @@ -2805,7 +2805,7 @@ and TranslateComputationExpression (ceenv: ComputationExpressionContext<'a>) fir isRecursive = false, isUse = false, isFromSource = false, // compiler generated during desugaring - isComputed = true, + isBang = true, bindings = [ binding ], body = bodyExpr, range = m, diff --git a/src/Compiler/Checking/Expressions/CheckExpressions.fs b/src/Compiler/Checking/Expressions/CheckExpressions.fs index 0b0c0b22169..a2c1a2d4e92 100644 --- a/src/Compiler/Checking/Expressions/CheckExpressions.fs +++ b/src/Compiler/Checking/Expressions/CheckExpressions.fs @@ -6072,7 +6072,7 @@ and TcExprUndelayed (cenv: cenv) (overallTy: OverallTy) env tpenv (synExpr: SynE | SynExpr.DoBang (trivia = { DoBangKeyword = m }) | SynExpr.MatchBang (trivia = { MatchBangKeyword = m }) | SynExpr.WhileBang (range = m) - | SynExpr.LetOrUse (isComputed = true; trivia = { LetOrUseKeyword = m }) -> + | SynExpr.LetOrUse (isBang = true; trivia = { LetOrUseKeyword = m }) -> error(Error(FSComp.SR.tcConstructRequiresComputationExpression(), m)) | SynExpr.IndexFromEnd (rightExpr, m) -> @@ -9199,7 +9199,7 @@ and TcImplicitOpItemThen (cenv: cenv) overallTy env id sln tpenv mItem delayed = | SynExpr.YieldOrReturn _ | SynExpr.YieldOrReturnFrom _ | SynExpr.MatchBang _ - | SynExpr.LetOrUse (isComputed = true) + | SynExpr.LetOrUse (isBang = true) | SynExpr.DoBang _ | SynExpr.WhileBang _ | SynExpr.TraitCall _ diff --git a/src/Compiler/Checking/Expressions/CheckExpressionsOps.fs b/src/Compiler/Checking/Expressions/CheckExpressionsOps.fs index 636352fb142..6c12485c4ed 100644 --- a/src/Compiler/Checking/Expressions/CheckExpressionsOps.fs +++ b/src/Compiler/Checking/Expressions/CheckExpressionsOps.fs @@ -229,7 +229,7 @@ let YieldFree (cenv: TcFileState) expr = | SynExpr.WhileBang(doExpr = body) | SynExpr.ForEach(bodyExpr = body) -> YieldFree body - | SynExpr.LetOrUse(isComputed = true) + | SynExpr.LetOrUse(isBang = true) | SynExpr.YieldOrReturnFrom _ | SynExpr.YieldOrReturn _ | SynExpr.ImplicitZero _ diff --git a/src/Compiler/Checking/Expressions/CheckSequenceExpressions.fs b/src/Compiler/Checking/Expressions/CheckSequenceExpressions.fs index 3990ce96571..c7eed9034b6 100644 --- a/src/Compiler/Checking/Expressions/CheckSequenceExpressions.fs +++ b/src/Compiler/Checking/Expressions/CheckSequenceExpressions.fs @@ -263,7 +263,7 @@ let TcSequenceExpression (cenv: TcFileState) env tpenv comp (overallTy: OverallT // The 'mBind' is attached to the lambda Some(mkSeqUsing cenv env wholeExprMark bindPatTy genOuterTy inputExpr consumeExpr, tpenv) - | SynExpr.LetOrUse(isComputed = true; range = m) -> error (Error(FSComp.SR.tcUseForInSequenceExpression (), m)) + | SynExpr.LetOrUse(isBang = true; range = m) -> error (Error(FSComp.SR.tcUseForInSequenceExpression (), m)) | SynExpr.Match(spMatch, expr, clauses, _m, _trivia) -> let inputExpr, inputTy, tpenv = TcExprOfUnknownType cenv env tpenv expr diff --git a/src/Compiler/Service/SynPat.fs b/src/Compiler/Service/SynPat.fs index add9efa803f..459f1586da4 100644 --- a/src/Compiler/Service/SynPat.fs +++ b/src/Compiler/Service/SynPat.fs @@ -92,17 +92,17 @@ module SynPat = // set (x: …, y: …) = … | SynPat.Typed _, SyntaxNode.SynPat(Rightmost(SynPat.Paren(Is pat, _))) :: SyntaxNode.SynMatchClause _ :: _ | Rightmost(SynPat.Typed _), SyntaxNode.SynMatchClause _ :: _ - | SynPat.Typed _, SyntaxNode.SynExpr(SynExpr.LetOrUse(isComputed = true)) :: _ - | SynPat.Typed _, SyntaxNode.SynPat(SynPat.Tuple(isStruct = false)) :: SyntaxNode.SynExpr(SynExpr.LetOrUse(isComputed = true)) :: _ - | SynPat.Tuple(isStruct = false; elementPats = AnyTyped), SyntaxNode.SynExpr(SynExpr.LetOrUse(isComputed = true)) :: _ + | SynPat.Typed _, SyntaxNode.SynExpr(SynExpr.LetOrUse(isBang = true)) :: _ + | SynPat.Typed _, SyntaxNode.SynPat(SynPat.Tuple(isStruct = false)) :: SyntaxNode.SynExpr(SynExpr.LetOrUse(isBang = true)) :: _ + | SynPat.Tuple(isStruct = false; elementPats = AnyTyped), SyntaxNode.SynExpr(SynExpr.LetOrUse(isBang = true)) :: _ | SynPat.Typed _, SyntaxNode.SynPat(SynPat.Tuple(isStruct = false)) :: SyntaxNode.SynBinding _ :: _ | SynPat.Tuple(isStruct = false; elementPats = AnyTyped), SyntaxNode.SynBinding _ :: _ // let! (_ : obj) = … - | SynPat.Typed _, SyntaxNode.SynBinding _ :: SyntaxNode.SynExpr(SynExpr.LetOrUse(isComputed = true)) :: _ -> true + | SynPat.Typed _, SyntaxNode.SynBinding _ :: SyntaxNode.SynExpr(SynExpr.LetOrUse(isBang = true)) :: _ -> true // let! (A _) = … - | SynPat.LongIdent _, SyntaxNode.SynBinding _ :: SyntaxNode.SynExpr(SynExpr.LetOrUse(isComputed = true)) :: _ -> false + | SynPat.LongIdent _, SyntaxNode.SynBinding _ :: SyntaxNode.SynExpr(SynExpr.LetOrUse(isBang = true)) :: _ -> false | SynPat.LongIdent(argPats = SynArgPats.Pats(_ :: _)), SyntaxNode.SynBinding _ :: _ | SynPat.LongIdent(argPats = SynArgPats.Pats(_ :: _)), SyntaxNode.SynExpr(SynExpr.Lambda _) :: _ | SynPat.Tuple(isStruct = false), SyntaxNode.SynExpr(SynExpr.Lambda(parsedData = Some _)) :: _ @@ -248,7 +248,7 @@ module SynPat = // fun (x) -> … | _, SyntaxNode.SynBinding _ :: _ | _, SyntaxNode.SynExpr(SynExpr.ForEach _) :: _ - | _, SyntaxNode.SynExpr(SynExpr.LetOrUse(isComputed = true)) :: _ + | _, SyntaxNode.SynExpr(SynExpr.LetOrUse(isBang = true)) :: _ | _, SyntaxNode.SynMatchClause _ :: _ | Atomic, SyntaxNode.SynExpr(SynExpr.Lambda(parsedData = Some _)) :: _ -> false diff --git a/src/Compiler/SyntaxTree/ParseHelpers.fs b/src/Compiler/SyntaxTree/ParseHelpers.fs index 8e8deea6950..4db7221c787 100644 --- a/src/Compiler/SyntaxTree/ParseHelpers.fs +++ b/src/Compiler/SyntaxTree/ParseHelpers.fs @@ -1114,7 +1114,7 @@ let mkLetExpression isRecursive = false, isUse = isUse, isFromSource = true, - isComputed = true, + isBang = true, bindings = binding :: andBangs, body = body, range = mWhole, @@ -1162,7 +1162,7 @@ let mkLetExpression isRecursive = isRec, isUse = isUse, isFromSource = true, - isComputed = false, + isBang = false, bindings = decls, body = body, range = mWhole, diff --git a/src/Compiler/SyntaxTree/SyntaxTree.fs b/src/Compiler/SyntaxTree/SyntaxTree.fs index 0b00adab2da..ca71014c79c 100644 --- a/src/Compiler/SyntaxTree/SyntaxTree.fs +++ b/src/Compiler/SyntaxTree/SyntaxTree.fs @@ -722,7 +722,7 @@ type SynExpr = isRecursive: bool * isUse: bool * isFromSource: bool * - isComputed: bool * + isBang: bool * bindings: SynBinding list * body: SynExpr * range: range * diff --git a/src/Compiler/SyntaxTree/SyntaxTree.fsi b/src/Compiler/SyntaxTree/SyntaxTree.fsi index a6fa899512b..131c8f6f056 100644 --- a/src/Compiler/SyntaxTree/SyntaxTree.fsi +++ b/src/Compiler/SyntaxTree/SyntaxTree.fsi @@ -888,8 +888,8 @@ type SynExpr = isUse: bool * // isFromSource: flag indicates whether a binding was explicitly written by the user in the source code versus generated by the compiler during transformations. isFromSource: bool * - // isComputed: true for 'let!' and 'use!' bindings, false for 'let' and 'use' bindings - isComputed: bool * + // isBang: true for 'let!' and 'use!' bindings, false for 'let' and 'use' bindings + isBang: bool * bindings: SynBinding list * body: SynExpr * range: range * 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 aec5892259d..32cad895835 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 @@ -7207,11 +7207,11 @@ FSharp.Compiler.Syntax.SynExpr+Lazy: FSharp.Compiler.Syntax.SynExpr expr FSharp.Compiler.Syntax.SynExpr+Lazy: FSharp.Compiler.Syntax.SynExpr get_expr() FSharp.Compiler.Syntax.SynExpr+Lazy: FSharp.Compiler.Text.Range get_range() FSharp.Compiler.Syntax.SynExpr+Lazy: FSharp.Compiler.Text.Range range -FSharp.Compiler.Syntax.SynExpr+LetOrUse: Boolean get_isComputed() +FSharp.Compiler.Syntax.SynExpr+LetOrUse: Boolean get_isBang() FSharp.Compiler.Syntax.SynExpr+LetOrUse: Boolean get_isFromSource() FSharp.Compiler.Syntax.SynExpr+LetOrUse: Boolean get_isRecursive() FSharp.Compiler.Syntax.SynExpr+LetOrUse: Boolean get_isUse() -FSharp.Compiler.Syntax.SynExpr+LetOrUse: Boolean isComputed +FSharp.Compiler.Syntax.SynExpr+LetOrUse: Boolean isBang FSharp.Compiler.Syntax.SynExpr+LetOrUse: Boolean isFromSource FSharp.Compiler.Syntax.SynExpr+LetOrUse: Boolean isRecursive FSharp.Compiler.Syntax.SynExpr+LetOrUse: Boolean isUse @@ -7223,24 +7223,6 @@ FSharp.Compiler.Syntax.SynExpr+LetOrUse: FSharp.Compiler.Text.Range get_range() FSharp.Compiler.Syntax.SynExpr+LetOrUse: FSharp.Compiler.Text.Range range FSharp.Compiler.Syntax.SynExpr+LetOrUse: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynBinding] bindings FSharp.Compiler.Syntax.SynExpr+LetOrUse: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynBinding] get_bindings() -FSharp.Compiler.Syntax.SynExpr+LetOrUseBang: Boolean get_isFromSource() -FSharp.Compiler.Syntax.SynExpr+LetOrUseBang: Boolean get_isUse() -FSharp.Compiler.Syntax.SynExpr+LetOrUseBang: Boolean isFromSource -FSharp.Compiler.Syntax.SynExpr+LetOrUseBang: Boolean isUse -FSharp.Compiler.Syntax.SynExpr+LetOrUseBang: FSharp.Compiler.Syntax.DebugPointAtBinding bindDebugPoint -FSharp.Compiler.Syntax.SynExpr+LetOrUseBang: FSharp.Compiler.Syntax.DebugPointAtBinding get_bindDebugPoint() -FSharp.Compiler.Syntax.SynExpr+LetOrUseBang: FSharp.Compiler.Syntax.SynExpr body -FSharp.Compiler.Syntax.SynExpr+LetOrUseBang: FSharp.Compiler.Syntax.SynExpr get_body() -FSharp.Compiler.Syntax.SynExpr+LetOrUseBang: FSharp.Compiler.Syntax.SynExpr get_rhs() -FSharp.Compiler.Syntax.SynExpr+LetOrUseBang: FSharp.Compiler.Syntax.SynExpr rhs -FSharp.Compiler.Syntax.SynExpr+LetOrUseBang: FSharp.Compiler.Syntax.SynPat get_pat() -FSharp.Compiler.Syntax.SynExpr+LetOrUseBang: FSharp.Compiler.Syntax.SynPat pat -FSharp.Compiler.Syntax.SynExpr+LetOrUseBang: FSharp.Compiler.SyntaxTrivia.SynExprLetOrUseTrivia get_trivia() -FSharp.Compiler.Syntax.SynExpr+LetOrUseBang: FSharp.Compiler.SyntaxTrivia.SynExprLetOrUseTrivia trivia -FSharp.Compiler.Syntax.SynExpr+LetOrUseBang: FSharp.Compiler.Text.Range get_range() -FSharp.Compiler.Syntax.SynExpr+LetOrUseBang: FSharp.Compiler.Text.Range range -FSharp.Compiler.Syntax.SynExpr+LetOrUseBang: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynBinding] andBangs -FSharp.Compiler.Syntax.SynExpr+LetOrUseBang: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynBinding] get_andBangs() FSharp.Compiler.Syntax.SynExpr+LibraryOnlyILAssembly: FSharp.Compiler.Text.Range get_range() FSharp.Compiler.Syntax.SynExpr+LibraryOnlyILAssembly: FSharp.Compiler.Text.Range range FSharp.Compiler.Syntax.SynExpr+LibraryOnlyILAssembly: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynExpr] args @@ -7446,7 +7428,6 @@ FSharp.Compiler.Syntax.SynExpr+Tags: Int32 JoinIn FSharp.Compiler.Syntax.SynExpr+Tags: Int32 Lambda FSharp.Compiler.Syntax.SynExpr+Tags: Int32 Lazy FSharp.Compiler.Syntax.SynExpr+Tags: Int32 LetOrUse -FSharp.Compiler.Syntax.SynExpr+Tags: Int32 LetOrUseBang FSharp.Compiler.Syntax.SynExpr+Tags: Int32 LibraryOnlyILAssembly FSharp.Compiler.Syntax.SynExpr+Tags: Int32 LibraryOnlyStaticOptimization FSharp.Compiler.Syntax.SynExpr+Tags: Int32 LibraryOnlyUnionCaseFieldGet @@ -7625,7 +7606,6 @@ FSharp.Compiler.Syntax.SynExpr: Boolean IsJoinIn FSharp.Compiler.Syntax.SynExpr: Boolean IsLambda FSharp.Compiler.Syntax.SynExpr: Boolean IsLazy FSharp.Compiler.Syntax.SynExpr: Boolean IsLetOrUse -FSharp.Compiler.Syntax.SynExpr: Boolean IsLetOrUseBang FSharp.Compiler.Syntax.SynExpr: Boolean IsLibraryOnlyILAssembly FSharp.Compiler.Syntax.SynExpr: Boolean IsLibraryOnlyStaticOptimization FSharp.Compiler.Syntax.SynExpr: Boolean IsLibraryOnlyUnionCaseFieldGet @@ -7696,7 +7676,6 @@ FSharp.Compiler.Syntax.SynExpr: Boolean get_IsJoinIn() FSharp.Compiler.Syntax.SynExpr: Boolean get_IsLambda() FSharp.Compiler.Syntax.SynExpr: Boolean get_IsLazy() FSharp.Compiler.Syntax.SynExpr: Boolean get_IsLetOrUse() -FSharp.Compiler.Syntax.SynExpr: Boolean get_IsLetOrUseBang() FSharp.Compiler.Syntax.SynExpr: Boolean get_IsLibraryOnlyILAssembly() FSharp.Compiler.Syntax.SynExpr: Boolean get_IsLibraryOnlyStaticOptimization() FSharp.Compiler.Syntax.SynExpr: Boolean get_IsLibraryOnlyUnionCaseFieldGet() @@ -7766,7 +7745,6 @@ FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewJoinIn(FSharp. FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewLambda(Boolean, Boolean, FSharp.Compiler.Syntax.SynSimplePats, FSharp.Compiler.Syntax.SynExpr, Microsoft.FSharp.Core.FSharpOption`1[System.Tuple`2[Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynPat],FSharp.Compiler.Syntax.SynExpr]], FSharp.Compiler.Text.Range, FSharp.Compiler.SyntaxTrivia.SynExprLambdaTrivia) FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewLazy(FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewLetOrUse(Boolean, Boolean, Boolean, Boolean, Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynBinding], FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range, FSharp.Compiler.SyntaxTrivia.SynExprLetOrUseTrivia) -FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewLetOrUseBang(FSharp.Compiler.Syntax.DebugPointAtBinding, Boolean, Boolean, FSharp.Compiler.Syntax.SynPat, FSharp.Compiler.Syntax.SynExpr, Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynBinding], FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range, FSharp.Compiler.SyntaxTrivia.SynExprLetOrUseTrivia) FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewLibraryOnlyILAssembly(System.Object, Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynType], Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynExpr], Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynType], FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewLibraryOnlyStaticOptimization(Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynStaticOptimizationConstraint], FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewLibraryOnlyUnionCaseFieldGet(FSharp.Compiler.Syntax.SynExpr, Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.Ident], Int32, FSharp.Compiler.Text.Range) @@ -7836,7 +7814,6 @@ FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr+JoinIn FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr+Lambda FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr+Lazy FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr+LetOrUse -FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr+LetOrUseBang FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr+LibraryOnlyILAssembly FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr+LibraryOnlyStaticOptimization FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr+LibraryOnlyUnionCaseFieldGet @@ -10357,6 +10334,8 @@ FSharp.Compiler.SyntaxTrivia.SynExprTryWithTrivia: FSharp.Compiler.Text.Range ge FSharp.Compiler.SyntaxTrivia.SynExprTryWithTrivia: FSharp.Compiler.Text.Range get_WithToEndRange() FSharp.Compiler.SyntaxTrivia.SynExprTryWithTrivia: System.String ToString() FSharp.Compiler.SyntaxTrivia.SynExprTryWithTrivia: Void .ctor(FSharp.Compiler.Text.Range, FSharp.Compiler.Text.Range, FSharp.Compiler.Text.Range, FSharp.Compiler.Text.Range) +FSharp.Compiler.SyntaxTrivia.SynExprYieldOrReturnFromTrivia: FSharp.Compiler.SyntaxTrivia.SynExprYieldOrReturnFromTrivia Zero +FSharp.Compiler.SyntaxTrivia.SynExprYieldOrReturnFromTrivia: FSharp.Compiler.SyntaxTrivia.SynExprYieldOrReturnFromTrivia get_Zero() FSharp.Compiler.SyntaxTrivia.SynExprYieldOrReturnFromTrivia: FSharp.Compiler.Text.Range YieldOrReturnFromKeyword FSharp.Compiler.SyntaxTrivia.SynExprYieldOrReturnFromTrivia: FSharp.Compiler.Text.Range get_YieldOrReturnFromKeyword() FSharp.Compiler.SyntaxTrivia.SynExprYieldOrReturnFromTrivia: 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 3bd01ee8207..32cad895835 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 @@ -7207,11 +7207,11 @@ FSharp.Compiler.Syntax.SynExpr+Lazy: FSharp.Compiler.Syntax.SynExpr expr FSharp.Compiler.Syntax.SynExpr+Lazy: FSharp.Compiler.Syntax.SynExpr get_expr() FSharp.Compiler.Syntax.SynExpr+Lazy: FSharp.Compiler.Text.Range get_range() FSharp.Compiler.Syntax.SynExpr+Lazy: FSharp.Compiler.Text.Range range -FSharp.Compiler.Syntax.SynExpr+LetOrUse: Boolean get_isComputed() +FSharp.Compiler.Syntax.SynExpr+LetOrUse: Boolean get_isBang() FSharp.Compiler.Syntax.SynExpr+LetOrUse: Boolean get_isFromSource() FSharp.Compiler.Syntax.SynExpr+LetOrUse: Boolean get_isRecursive() FSharp.Compiler.Syntax.SynExpr+LetOrUse: Boolean get_isUse() -FSharp.Compiler.Syntax.SynExpr+LetOrUse: Boolean isComputed +FSharp.Compiler.Syntax.SynExpr+LetOrUse: Boolean isBang FSharp.Compiler.Syntax.SynExpr+LetOrUse: Boolean isFromSource FSharp.Compiler.Syntax.SynExpr+LetOrUse: Boolean isRecursive FSharp.Compiler.Syntax.SynExpr+LetOrUse: Boolean isUse From f6fa86ee79c68d62213f354c4247ba9391457a92 Mon Sep 17 00:00:00 2001 From: edgargonzalez Date: Mon, 11 Aug 2025 11:11:00 +0100 Subject: [PATCH 23/24] update baselines --- .../ilverify_FSharp.Compiler.Service_Debug_netstandard2.0.bsl | 2 +- .../ilverify_FSharp.Compiler.Service_Release_netstandard2.0.bsl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/ILVerify/ilverify_FSharp.Compiler.Service_Debug_netstandard2.0.bsl b/tests/ILVerify/ilverify_FSharp.Compiler.Service_Debug_netstandard2.0.bsl index 5019f375f4a..aad32880f1b 100644 --- a/tests/ILVerify/ilverify_FSharp.Compiler.Service_Debug_netstandard2.0.bsl +++ b/tests/ILVerify/ilverify_FSharp.Compiler.Service_Debug_netstandard2.0.bsl @@ -34,7 +34,7 @@ [IL]: Error [StackUnexpected]: : .$FSharpCheckerResults+dataTipOfReferences@2225::Invoke([FSharp.Core]Microsoft.FSharp.Core.Unit)][offset 0x00000084][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.EditorServices.AssemblyContent+traverseMemberFunctionAndValues@176::Invoke([FSharp.Compiler.Service]FSharp.Compiler.Symbols.FSharpMemberOrFunctionOrValue)][offset 0x00000059][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.EditorServices.AssemblyContent+traverseEntity@218::GenerateNext([S.P.CoreLib]System.Collections.Generic.IEnumerable`1&)][offset 0x000000DA][found Char] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.EditorServices.ParsedInput+visitor@1431-6::VisitExpr([FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, [FSharp.Compiler.Service]FSharp.Compiler.Syntax.SynExpr)][offset 0x00000605][found Char] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.EditorServices.ParsedInput+visitor@1422-6::VisitExpr([FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, [FSharp.Compiler.Service]FSharp.Compiler.Syntax.SynExpr)][offset 0x000005FD][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : .$ServiceLexing+clo@924-516::Invoke([FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,Microsoft.FSharp.Core.Unit>)][offset 0x00000032][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : .$ServiceLexing+clo@924-516::Invoke([FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,Microsoft.FSharp.Core.Unit>)][offset 0x0000003B][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : .$ServiceLexing+clo@924-516::Invoke([FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,Microsoft.FSharp.Core.Unit>)][offset 0x00000082][found Char] Unexpected type on the stack. diff --git a/tests/ILVerify/ilverify_FSharp.Compiler.Service_Release_netstandard2.0.bsl b/tests/ILVerify/ilverify_FSharp.Compiler.Service_Release_netstandard2.0.bsl index f4f182a4ca0..929d9360375 100644 --- a/tests/ILVerify/ilverify_FSharp.Compiler.Service_Release_netstandard2.0.bsl +++ b/tests/ILVerify/ilverify_FSharp.Compiler.Service_Release_netstandard2.0.bsl @@ -33,7 +33,7 @@ [IL]: Error [StackUnexpected]: : .$FSharpCheckerResults+GetReferenceResolutionStructuredToolTipText@2225::Invoke([FSharp.Core]Microsoft.FSharp.Core.Unit)][offset 0x00000076][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.EditorServices.AssemblyContent+traverseMemberFunctionAndValues@176::Invoke([FSharp.Compiler.Service]FSharp.Compiler.Symbols.FSharpMemberOrFunctionOrValue)][offset 0x0000002B][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.EditorServices.AssemblyContent+traverseEntity@218::GenerateNext([S.P.CoreLib]System.Collections.Generic.IEnumerable`1&)][offset 0x000000BB][found Char] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.EditorServices.ParsedInput+visitor@1431-11::VisitExpr([FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, [FSharp.Compiler.Service]FSharp.Compiler.Syntax.SynExpr)][offset 0x00000620][found Char] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.EditorServices.ParsedInput+visitor@1422-11::VisitExpr([FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, [FSharp.Compiler.Service]FSharp.Compiler.Syntax.SynExpr)][offset 0x00000618][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : .$ServiceLexing+clo@924-531::Invoke([FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,Microsoft.FSharp.Core.Unit>)][offset 0x00000032][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : .$ServiceLexing+clo@924-531::Invoke([FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,Microsoft.FSharp.Core.Unit>)][offset 0x0000003B][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : .$ServiceLexing+clo@924-531::Invoke([FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,Microsoft.FSharp.Core.Unit>)][offset 0x00000064][found Char] Unexpected type on the stack. From f1a272716d85197bc5de6509463e4e2911a8664e Mon Sep 17 00:00:00 2001 From: edgargonzalez Date: Mon, 11 Aug 2025 11:29:33 +0100 Subject: [PATCH 24/24] Release notes: add migration guidance --- .../.FSharp.Compiler.Service/10.0.100.md | 133 +++++++++++++++++- 1 file changed, 132 insertions(+), 1 deletion(-) diff --git a/docs/release-notes/.FSharp.Compiler.Service/10.0.100.md b/docs/release-notes/.FSharp.Compiler.Service/10.0.100.md index d56754b65fe..ab9f379f87b 100644 --- a/docs/release-notes/.FSharp.Compiler.Service/10.0.100.md +++ b/docs/release-notes/.FSharp.Compiler.Service/10.0.100.md @@ -21,7 +21,6 @@ ### Changed * Use `errorR` instead of `error` in `CheckDeclarations.fs` when possible. ([PR #18645](https://github.com/dotnet/fsharp/pull/18645)) -* Unify `let`, `let!`, `use` and `use!` AST representation. ([PR #18825](https://github.com/dotnet/fsharp/pull/18825)) ### Breaking Changes @@ -31,3 +30,135 @@ * Mark `Range.Zero` as obsolete in favor of `Range.range0` ([PR #18664](https://github.com/dotnet/fsharp/pull/18664)) * Use `Synbinding` to model `and!` ([PR #18805](https://github.com/dotnet/fsharp/pull/18805)) * Redesign #line processing. The original positions (unaffected by #line directives) are now kept in the AST, and `__LINE__` and `__SOURCE_LINE__` show the original line numbers / file names. However, all diagnostics and debug information stays the same (shows the position transformed by the #line directives). ([Issue #18553](https://github.com/dotnet/fsharp/issues/18553), [PR #18699](https://github.com/dotnet/fsharp/pull/18699)) +* Unify `let`, `let!`, `use` and `use!` AST representation. ([PR #18825](https://github.com/dotnet/fsharp/pull/18825))[^1] + +### Migration Guidance for AST Users + +**Note:** The unified AST introduces two new boolean fields: +- `isFromSource`: Indicates if the binding comes from user-written code (`true`) or is compiler-generated (`false`) +- `isBang`: Distinguishes computation expression bindings (`let!`/`use!` = `true`) from regular bindings (`let`/`use` = `false`) + +### 1. Pattern Matching Updates + +**Before:** +```fsharp +match expr with +| SynExpr.LetOrUse(isRec, isUse, bindings, body, range, trivia) -> + // Handle regular let/use +| SynExpr.LetOrUseBang(spBind, isUse, isFromSource, pat, rhs, andBangs, body, range, trivia) -> + // Handle let!/use! +``` + +**After:** +```fsharp +match expr with +| SynExpr.LetOrUse(isRec, isUse, isFromSource, isBang, bindings, body, range, trivia) -> + if isBang then + // This is a let!/use! expression + match bindings with + | firstBinding :: andBangs -> + match firstBinding with + | SynBinding(headPat = pat; expr = rhs) -> + // pat and rhs extracted from first binding + // andBangs contains the and! bindings + | [] -> // error case + else + // This is a regular let/use expression +``` + +### 2. Construction Updates + +**Before:** +```fsharp +// Creating a let! expression +SynExpr.LetOrUseBang( + bindDebugPoint, + false, // isUse + true, // isFromSource + pat, + rhsExpr, + andBangs, + bodyExpr, + range, + trivia +) +``` + +**After:** +```fsharp +// Creating a let! expression +let firstBinding = SynBinding( + accessibility = None, + kind = SynBindingKind.Normal, + isInline = false, + isMutable = false, + attributes = [], + xmlDoc = PreXmlDoc.Empty, + valData = SynInfo.emptySynValData, + headPat = pat, // Pattern moved here + returnInfo = None, + expr = rhsExpr, // RHS moved here + range = range, + debugPoint = bindDebugPoint, // Debug point moved here + trivia = bindingTrivia +) +SynExpr.LetOrUse( + false, // isRecursive + false, // isUse + true, // isFromSource + true, // isBang (indicates let!) + firstBinding :: andBangs, // All bindings in single list + bodyExpr, + range, + trivia +) +``` + +### 3. Common Migration Patterns + +**Checking for computation expressions:** +```fsharp +// Before +match expr with +| SynExpr.LetOrUseBang _ -> true +| _ -> false + +// After +match expr with +| SynExpr.LetOrUse(isBang = true) -> true +| _ -> false +``` + +**Extracting pattern and expression from let!:** +```fsharp +// Before +| SynExpr.LetOrUseBang(_, _, _, pat, rhs, _, _, _, _) -> + processBinding pat rhs + +// After +| SynExpr.LetOrUse(isBang = true; bindings = binding :: _) -> + match binding with + | SynBinding(headPat = pat; expr = rhs) -> + processBinding pat rhs + | _ -> // error +``` + +**Processing and! bindings:** +```fsharp +// Before +| SynExpr.LetOrUseBang(_, _, _, firstPat, firstRhs, andBangs, _, _, _) -> + processFirst firstPat firstRhs + for andBang in andBangs do + processAndBang andBang + +// After +| SynExpr.LetOrUse(isBang = true; bindings = bindings) -> + match bindings with + | first :: rest -> + processBinding first + for andBang in rest do + processAndBang andBang + | [] -> // error +``` + +[^1]: See [Migration Guidance for AST Users](#migration-guidance-for-ast-users) section for detailed information on how to update your code to work with the unified AST representation. \ No newline at end of file