From c4b40cb9bf806ea5cf5a956103721224c90d8362 Mon Sep 17 00:00:00 2001 From: Edgar Gonzalez Date: Fri, 25 Apr 2025 18:33:44 +0100 Subject: [PATCH 01/26] new parser production rule. --- src/Compiler/pars.fsy | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/Compiler/pars.fsy b/src/Compiler/pars.fsy index 7cac0ad0dc0..b1297754683 100644 --- a/src/Compiler/pars.fsy +++ b/src/Compiler/pars.fsy @@ -3574,6 +3574,17 @@ headBindingPattern: let pat2 = SynPat.Wild(mColonColon.EndRange) SynPat.ListCons($1, pat2, rhs2 parseState 1 2, { ColonColonRange = mColonColon }) } + | headBindingPattern COLON typeWithTypeConstraints %prec paren_pat_colon + { let mLhs = lhs parseState + SynPat.Typed($1, $3, mLhs) } + + | headBindingPattern COLON recover + { let mColon = rhs parseState 2 + if not $3 then + reportParseErrorAt mColon (FSComp.SR.parsExpectingPattern ()) + let ty = SynType.FromParseError(mColon.EndRange) + SynPat.Typed($1, ty, lhs parseState) } + | tuplePatternElements %prec pat_tuple { let pats, commas = $1 let pats, commas = normalizeTuplePat pats commas From 0b489a13340953b9c209049c58825c2052f2e473 Mon Sep 17 00:00:00 2001 From: Edgar Gonzalez Date: Sat, 26 Apr 2025 09:20:05 +0100 Subject: [PATCH 02/26] Add let! and use! syntax tree tests --- .../SyntaxTree/SynType/Typed LetBang 01.fs | 3 +++ .../SynType/Typed LetBang 01.fs.bsl | 25 +++++++++++++++++ .../SyntaxTree/SynType/Typed LetBang 02.fs | 3 +++ .../SynType/Typed LetBang 02.fs.bsl | 27 +++++++++++++++++++ .../SyntaxTree/SynType/Typed UseBang 01.fs | 3 +++ .../SynType/Typed UseBang 01.fs.bsl | 25 +++++++++++++++++ .../SyntaxTree/SynType/Typed UseBang 02.fs | 3 +++ .../SynType/Typed UseBang 02.fs.bsl | 27 +++++++++++++++++++ 8 files changed, 116 insertions(+) create mode 100644 tests/service/data/SyntaxTree/SynType/Typed LetBang 01.fs create mode 100644 tests/service/data/SyntaxTree/SynType/Typed LetBang 01.fs.bsl create mode 100644 tests/service/data/SyntaxTree/SynType/Typed LetBang 02.fs create mode 100644 tests/service/data/SyntaxTree/SynType/Typed LetBang 02.fs.bsl create mode 100644 tests/service/data/SyntaxTree/SynType/Typed UseBang 01.fs create mode 100644 tests/service/data/SyntaxTree/SynType/Typed UseBang 01.fs.bsl create mode 100644 tests/service/data/SyntaxTree/SynType/Typed UseBang 02.fs create mode 100644 tests/service/data/SyntaxTree/SynType/Typed UseBang 02.fs.bsl diff --git a/tests/service/data/SyntaxTree/SynType/Typed LetBang 01.fs b/tests/service/data/SyntaxTree/SynType/Typed LetBang 01.fs new file mode 100644 index 00000000000..4691c618a8f --- /dev/null +++ b/tests/service/data/SyntaxTree/SynType/Typed LetBang 01.fs @@ -0,0 +1,3 @@ +module Module + +let! res: Async = () diff --git a/tests/service/data/SyntaxTree/SynType/Typed LetBang 01.fs.bsl b/tests/service/data/SyntaxTree/SynType/Typed LetBang 01.fs.bsl new file mode 100644 index 00000000000..873f9c6ad10 --- /dev/null +++ b/tests/service/data/SyntaxTree/SynType/Typed LetBang 01.fs.bsl @@ -0,0 +1,25 @@ +ImplFile + (ParsedImplFileInput + ("/root/SynType/Typed LetBang 01.fs", false, QualifiedNameOfFile Module, [], + [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Expr + (LetOrUseBang + (Yes (3,0--3,25), false, true, + Typed + (Named (SynIdent (res, None), false, None, (3,5--3,8)), + App + (LongIdent (SynLongIdent ([Async], [], [None])), + Some (3,15--3,16), + [LongIdent (SynLongIdent ([int], [], [None]))], [], + Some (3,19--3,20), false, (3,10--3,20)), (3,5--3,20)), + Const (Unit, (3,23--3,25)), [], ImplicitZero (3,25--3,25), + (3,0--4,0), { LetOrUseBangKeyword = (3,0--3,4) + EqualsRange = Some (3,21--3,22) }), (3,0--4,0))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--4,0), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + CodeComments = [] }, set [])) + +(4,0)-(4,0) parse error Incomplete structured construct at or before this point in expression diff --git a/tests/service/data/SyntaxTree/SynType/Typed LetBang 02.fs b/tests/service/data/SyntaxTree/SynType/Typed LetBang 02.fs new file mode 100644 index 00000000000..d37c56f638c --- /dev/null +++ b/tests/service/data/SyntaxTree/SynType/Typed LetBang 02.fs @@ -0,0 +1,3 @@ +module Module + +let! (res: Async) = () diff --git a/tests/service/data/SyntaxTree/SynType/Typed LetBang 02.fs.bsl b/tests/service/data/SyntaxTree/SynType/Typed LetBang 02.fs.bsl new file mode 100644 index 00000000000..93b4a8822eb --- /dev/null +++ b/tests/service/data/SyntaxTree/SynType/Typed LetBang 02.fs.bsl @@ -0,0 +1,27 @@ +ImplFile + (ParsedImplFileInput + ("/root/SynType/Typed LetBang 02.fs", false, QualifiedNameOfFile Module, [], + [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Expr + (LetOrUseBang + (Yes (3,0--3,27), false, true, + Paren + (Typed + (Named (SynIdent (res, None), false, None, (3,6--3,9)), + App + (LongIdent (SynLongIdent ([Async], [], [None])), + Some (3,16--3,17), + [LongIdent (SynLongIdent ([int], [], [None]))], [], + Some (3,20--3,21), false, (3,11--3,21)), (3,6--3,21)), + (3,5--3,22)), Const (Unit, (3,25--3,27)), [], + ImplicitZero (3,27--3,27), (3,0--4,0), + { LetOrUseBangKeyword = (3,0--3,4) + EqualsRange = Some (3,23--3,24) }), (3,0--4,0))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--4,0), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + CodeComments = [] }, set [])) + +(4,0)-(4,0) parse error Incomplete structured construct at or before this point in expression diff --git a/tests/service/data/SyntaxTree/SynType/Typed UseBang 01.fs b/tests/service/data/SyntaxTree/SynType/Typed UseBang 01.fs new file mode 100644 index 00000000000..598b6f6c47c --- /dev/null +++ b/tests/service/data/SyntaxTree/SynType/Typed UseBang 01.fs @@ -0,0 +1,3 @@ +module Module + +use! res: Async = () diff --git a/tests/service/data/SyntaxTree/SynType/Typed UseBang 01.fs.bsl b/tests/service/data/SyntaxTree/SynType/Typed UseBang 01.fs.bsl new file mode 100644 index 00000000000..88e4214c49c --- /dev/null +++ b/tests/service/data/SyntaxTree/SynType/Typed UseBang 01.fs.bsl @@ -0,0 +1,25 @@ +ImplFile + (ParsedImplFileInput + ("/root/SynType/Typed UseBang 01.fs", false, QualifiedNameOfFile Module, [], + [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Expr + (LetOrUseBang + (Yes (3,0--3,25), true, true, + Typed + (Named (SynIdent (res, None), false, None, (3,5--3,8)), + App + (LongIdent (SynLongIdent ([Async], [], [None])), + Some (3,15--3,16), + [LongIdent (SynLongIdent ([int], [], [None]))], [], + Some (3,19--3,20), false, (3,10--3,20)), (3,5--3,20)), + Const (Unit, (3,23--3,25)), [], ImplicitZero (3,25--3,25), + (3,0--4,0), { LetOrUseBangKeyword = (3,0--3,4) + EqualsRange = Some (3,21--3,22) }), (3,0--4,0))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--4,0), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + CodeComments = [] }, set [])) + +(4,0)-(4,0) parse error Incomplete structured construct at or before this point in expression diff --git a/tests/service/data/SyntaxTree/SynType/Typed UseBang 02.fs b/tests/service/data/SyntaxTree/SynType/Typed UseBang 02.fs new file mode 100644 index 00000000000..563fc095c99 --- /dev/null +++ b/tests/service/data/SyntaxTree/SynType/Typed UseBang 02.fs @@ -0,0 +1,3 @@ +module Module + +use! (res: Async) = () diff --git a/tests/service/data/SyntaxTree/SynType/Typed UseBang 02.fs.bsl b/tests/service/data/SyntaxTree/SynType/Typed UseBang 02.fs.bsl new file mode 100644 index 00000000000..df441b04e73 --- /dev/null +++ b/tests/service/data/SyntaxTree/SynType/Typed UseBang 02.fs.bsl @@ -0,0 +1,27 @@ +ImplFile + (ParsedImplFileInput + ("/root/SynType/Typed UseBang 02.fs", false, QualifiedNameOfFile Module, [], + [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Expr + (LetOrUseBang + (Yes (3,0--3,27), true, true, + Paren + (Typed + (Named (SynIdent (res, None), false, None, (3,6--3,9)), + App + (LongIdent (SynLongIdent ([Async], [], [None])), + Some (3,16--3,17), + [LongIdent (SynLongIdent ([int], [], [None]))], [], + Some (3,20--3,21), false, (3,11--3,21)), (3,6--3,21)), + (3,5--3,22)), Const (Unit, (3,25--3,27)), [], + ImplicitZero (3,27--3,27), (3,0--4,0), + { LetOrUseBangKeyword = (3,0--3,4) + EqualsRange = Some (3,23--3,24) }), (3,0--4,0))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--4,0), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + CodeComments = [] }, set [])) + +(4,0)-(4,0) parse error Incomplete structured construct at or before this point in expression From be13fe03113ca727938f75f2d7eecf0038f044bd Mon Sep 17 00:00:00 2001 From: Edgar Gonzalez Date: Sat, 26 Apr 2025 09:20:45 +0100 Subject: [PATCH 03/26] Update existing syntax tree tests --- ...ColonBeforeReturnTypeIsPartOfTrivia.fs.bsl | 44 +++-- ...eturnTypeIsPartOfTriviaInProperties.fs.bsl | 68 ++++---- ...ouldBePresentInLocalLetBindingTyped.fs.bsl | 11 +- ...resentInMemberBindingWithReturnType.fs.bsl | 26 ++- ...esentInSynModuleDeclLetBindingTyped.fs.bsl | 24 ++- ...turnTypeOfBindingShouldContainStars.fs.bsl | 66 +++---- .../LeadingKeyword/OverrideKeyword.fs.bsl | 20 +-- .../LeadingKeyword/StaticMemberKeyword.fs.bsl | 16 +- .../data/SyntaxTree/Member/Member 08.fs.bsl | 24 +-- .../data/SyntaxTree/Member/Member 13.fs.bsl | 24 ++- .../SynTypeDefnWithMemberWithSetget.fs.bsl | 68 ++++---- .../Module - Attribute 01.fs.bsl | 11 +- ...ericFunctionReturnTypeNotStructNull.fs.bsl | 24 +-- .../SyntaxTree/Nullness/IntListOrNull.fs.bsl | 16 +- .../Nullness/IntListOrNullOrNullOrNull.fs.bsl | 47 +++-- .../Nullness/NullAnnotatedExpression.fs.bsl | 35 +--- .../SyntaxTree/Nullness/StringOrNull.fs.bsl | 13 +- .../Pattern/Typed - Missing type 01.fs.bsl | 16 +- .../Pattern/Typed - Missing type 02.fs.bsl | 10 +- .../Pattern/Typed - Missing type 05.fs.bsl | 24 ++- .../Pattern/Typed - Missing type 06.fs.bsl | 17 +- .../data/SyntaxTree/SynType/Fun 06.fs.bsl | 20 +-- .../data/SyntaxTree/SynType/Fun 07.fs.bsl | 17 +- .../data/SyntaxTree/SynType/Fun 08.fs.bsl | 24 +-- .../data/SyntaxTree/SynType/Fun 09.fs.bsl | 29 +--- .../data/SyntaxTree/SynType/Fun 10.fs.bsl | 27 ++- ...stedSynTypeOrInsideSynExprTraitCall.fs.bsl | 161 +++++++++--------- .../SynTypeOrInsideSynExprTraitCall.fs.bsl | 116 ++++++------- ...eConstraintWhereTyparSupportsMember.fs.bsl | 141 ++++++++------- .../data/SyntaxTree/SynType/Tuple 09.fs.bsl | 20 +-- .../data/SyntaxTree/SynType/Tuple 10.fs.bsl | 20 +-- .../data/SyntaxTree/SynType/Tuple 11.fs.bsl | 24 +-- .../data/SyntaxTree/SynType/Tuple 12.fs.bsl | 24 +-- .../data/SyntaxTree/SynType/Tuple 13.fs.bsl | 29 +--- .../data/SyntaxTree/SynType/Tuple 14.fs.bsl | 23 +-- .../Type/SynTypeTupleWithStruct.fs.bsl | 15 +- .../SynTypeTupleWithStructRecovery.fs.bsl | 15 +- 37 files changed, 486 insertions(+), 823 deletions(-) diff --git a/tests/service/data/SyntaxTree/Binding/ColonBeforeReturnTypeIsPartOfTrivia.fs.bsl b/tests/service/data/SyntaxTree/Binding/ColonBeforeReturnTypeIsPartOfTrivia.fs.bsl index 17fea8f0a33..5830bfbd85e 100644 --- a/tests/service/data/SyntaxTree/Binding/ColonBeforeReturnTypeIsPartOfTrivia.fs.bsl +++ b/tests/service/data/SyntaxTree/Binding/ColonBeforeReturnTypeIsPartOfTrivia.fs.bsl @@ -10,29 +10,23 @@ ImplFile (None, Normal, false, false, [], PreXmlDoc ((2,0), FSharp.Compiler.Xml.XmlDocCollector), SynValData - (None, - SynValInfo - ([[SynArgInfo ([], false, Some y)]], - SynArgInfo ([], false, None)), None), - LongIdent - (SynLongIdent ([x], [], [None]), None, None, - Pats [Named (SynIdent (y, None), false, None, (2,6--2,7))], - None, (2,4--2,7)), - Some - (SynBindingReturnInfo - (LongIdent (SynLongIdent ([int], [], [None])), - (2,10--2,13), [], { ColonRange = Some (2,8--2,9) })), + (None, SynValInfo ([], SynArgInfo ([], false, None)), None), Typed - (App - (NonAtomic, false, Ident failwith, - Const - (String ("todo", Regular, (2,25--2,31)), (2,25--2,31)), - (2,16--2,31)), - LongIdent (SynLongIdent ([int], [], [None])), (2,16--2,31)), - (2,4--2,7), NoneAtLet, { LeadingKeyword = Let (2,0--2,3) - InlineKeyword = None - EqualsRange = Some (2,14--2,15) })], - (2,0--2,31))], PreXmlDocEmpty, [], None, (2,0--3,0), - { LeadingKeyword = None })], (true, true), - { ConditionalDirectives = [] - CodeComments = [] }, set [])) + (LongIdent + (SynLongIdent ([x], [], [None]), None, None, + Pats + [Named (SynIdent (y, None), false, None, (2,6--2,7))], + None, (2,4--2,7)), + LongIdent (SynLongIdent ([int], [], [None])), (2,4--2,13)), + None, + App + (NonAtomic, false, Ident failwith, + Const + (String ("todo", Regular, (2,25--2,31)), (2,25--2,31)), + (2,16--2,31)), (2,4--2,13), Yes (2,0--2,31), + { LeadingKeyword = Let (2,0--2,3) + InlineKeyword = None + EqualsRange = Some (2,14--2,15) })], (2,0--2,31))], + PreXmlDocEmpty, [], None, (2,0--3,0), { LeadingKeyword = None })], + (true, true), { ConditionalDirectives = [] + CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/Binding/ColonBeforeReturnTypeIsPartOfTriviaInProperties.fs.bsl b/tests/service/data/SyntaxTree/Binding/ColonBeforeReturnTypeIsPartOfTriviaInProperties.fs.bsl index dd5022f2bc2..70e6949f11f 100644 --- a/tests/service/data/SyntaxTree/Binding/ColonBeforeReturnTypeIsPartOfTriviaInProperties.fs.bsl +++ b/tests/service/data/SyntaxTree/Binding/ColonBeforeReturnTypeIsPartOfTriviaInProperties.fs.bsl @@ -28,26 +28,21 @@ ImplFile GetterOrSetterIsCompilerGenerated = false MemberKind = PropertyGet }, SynValInfo - ([[SynArgInfo ([], false, None)]; []], + ([[SynArgInfo ([], false, None)]], SynArgInfo ([], false, None)), None), - LongIdent - (SynLongIdent - ([this; Y], [(3,15--3,16)], [None; None]), - Some get, None, - Pats - [Paren - (Const (Unit, (3,26--3,28)), (3,26--3,28))], - None, (3,23--3,28)), - Some - (SynBindingReturnInfo - (LongIdent - (SynLongIdent ([int], [], [None])), - (3,29--3,32), [], - { ColonRange = Some (3,28--3,29) })), Typed - (Const (Int32 1, (3,35--3,36)), + (LongIdent + (SynLongIdent + ([this; Y], [(3,15--3,16)], [None; None]), + Some get, None, + Pats + [Paren + (Const (Unit, (3,26--3,28)), + (3,26--3,28))], None, (3,23--3,28)), LongIdent (SynLongIdent ([int], [], [None])), - (3,35--3,36)), (3,23--3,28), NoneAtInvisible, + (3,23--3,32)), None, + Const (Int32 1, (3,35--3,36)), (3,23--3,32), + NoneAtInvisible, { LeadingKeyword = Member (3,4--3,10) InlineKeyword = None EqualsRange = Some (3,33--3,34) })), @@ -65,31 +60,26 @@ ImplFile GetterOrSetterIsCompilerGenerated = false MemberKind = PropertySet }, SynValInfo - ([[SynArgInfo ([], false, None)]; - [SynArgInfo ([], false, None)]], + ([[SynArgInfo ([], false, None)]], SynArgInfo ([], false, None)), None), - LongIdent - (SynLongIdent - ([this; Y], [(3,15--3,16)], [None; None]), - Some set, None, - Pats - [Paren - (Typed - (Wild (3,46--3,47), - LongIdent - (SynLongIdent ([int], [], [None])), - (3,46--3,51)), (3,45--3,52))], None, - (3,41--3,52)), - Some - (SynBindingReturnInfo - (LongIdent - (SynLongIdent ([unit], [], [None])), - (3,53--3,57), [], - { ColonRange = Some (3,52--3,53) })), Typed - (Const (Unit, (3,60--3,62)), + (LongIdent + (SynLongIdent + ([this; Y], [(3,15--3,16)], [None; None]), + Some set, None, + Pats + [Paren + (Typed + (Wild (3,46--3,47), + LongIdent + (SynLongIdent + ([int], [], [None])), + (3,46--3,51)), (3,45--3,52))], + None, (3,41--3,52)), LongIdent (SynLongIdent ([unit], [], [None])), - (3,60--3,62)), (3,41--3,52), NoneAtInvisible, + (3,41--3,57)), None, + Const (Unit, (3,60--3,62)), (3,41--3,57), + NoneAtInvisible, { LeadingKeyword = Member (3,4--3,10) InlineKeyword = None EqualsRange = Some (3,58--3,59) })), diff --git a/tests/service/data/SyntaxTree/Binding/RangeOfEqualSignShouldBePresentInLocalLetBindingTyped.fs.bsl b/tests/service/data/SyntaxTree/Binding/RangeOfEqualSignShouldBePresentInLocalLetBindingTyped.fs.bsl index 93dabea4c82..a4d233f1dbe 100644 --- a/tests/service/data/SyntaxTree/Binding/RangeOfEqualSignShouldBePresentInLocalLetBindingTyped.fs.bsl +++ b/tests/service/data/SyntaxTree/Binding/RangeOfEqualSignShouldBePresentInLocalLetBindingTyped.fs.bsl @@ -17,16 +17,11 @@ ImplFile SynValData (None, SynValInfo ([], SynArgInfo ([], false, None)), None), - Named (SynIdent (z, None), false, None, (3,8--3,9)), - Some - (SynBindingReturnInfo - (LongIdent (SynLongIdent ([int], [], [None])), - (3,11--3,14), [], - { ColonRange = Some (3,9--3,10) })), Typed - (Const (Int32 2, (3,17--3,18)), + (Named (SynIdent (z, None), false, None, (3,8--3,9)), LongIdent (SynLongIdent ([int], [], [None])), - (3,17--3,18)), (3,8--3,9), Yes (3,4--3,18), + (3,8--3,14)), None, Const (Int32 2, (3,17--3,18)), + (3,8--3,14), Yes (3,4--3,18), { LeadingKeyword = Let (3,4--3,7) InlineKeyword = None EqualsRange = Some (3,15--3,16) })], diff --git a/tests/service/data/SyntaxTree/Binding/RangeOfEqualSignShouldBePresentInMemberBindingWithReturnType.fs.bsl b/tests/service/data/SyntaxTree/Binding/RangeOfEqualSignShouldBePresentInMemberBindingWithReturnType.fs.bsl index 49eeec4d346..03156d26521 100644 --- a/tests/service/data/SyntaxTree/Binding/RangeOfEqualSignShouldBePresentInMemberBindingWithReturnType.fs.bsl +++ b/tests/service/data/SyntaxTree/Binding/RangeOfEqualSignShouldBePresentInMemberBindingWithReturnType.fs.bsl @@ -33,24 +33,18 @@ ImplFile SynValInfo ([[SynArgInfo ([], false, None)]; []], SynArgInfo ([], false, None)), None), - LongIdent - (SynLongIdent - ([this; Y], [(3,15--3,16)], [None; None]), None, - None, - Pats - [Paren - (Const (Unit, (3,18--3,20)), (3,18--3,20))], - None, (3,11--3,20)), - Some - (SynBindingReturnInfo - (LongIdent - (SynLongIdent ([string], [], [None])), - (3,23--3,29), [], - { ColonRange = Some (3,21--3,22) })), Typed - (Ident z, + (LongIdent + (SynLongIdent + ([this; Y], [(3,15--3,16)], [None; None]), + None, None, + Pats + [Paren + (Const (Unit, (3,18--3,20)), (3,18--3,20))], + None, (3,11--3,20)), LongIdent (SynLongIdent ([string], [], [None])), - (3,32--3,33)), (3,11--3,20), NoneAtInvisible, + (3,11--3,29)), None, Ident z, (3,11--3,29), + NoneAtInvisible, { LeadingKeyword = Member (3,4--3,10) InlineKeyword = None EqualsRange = Some (3,30--3,31) }), (3,4--3,33))], diff --git a/tests/service/data/SyntaxTree/Binding/RangeOfEqualSignShouldBePresentInSynModuleDeclLetBindingTyped.fs.bsl b/tests/service/data/SyntaxTree/Binding/RangeOfEqualSignShouldBePresentInSynModuleDeclLetBindingTyped.fs.bsl index 651cdb4f8ce..01b13d42f53 100644 --- a/tests/service/data/SyntaxTree/Binding/RangeOfEqualSignShouldBePresentInSynModuleDeclLetBindingTyped.fs.bsl +++ b/tests/service/data/SyntaxTree/Binding/RangeOfEqualSignShouldBePresentInSynModuleDeclLetBindingTyped.fs.bsl @@ -14,18 +14,14 @@ ImplFile PreXmlDoc ((2,0), FSharp.Compiler.Xml.XmlDocCollector), SynValData (None, SynValInfo ([], SynArgInfo ([], false, None)), None), - Named (SynIdent (v, None), false, None, (2,4--2,5)), - Some - (SynBindingReturnInfo - (LongIdent (SynLongIdent ([int], [], [None])), - (2,8--2,11), [], { ColonRange = Some (2,6--2,7) })), Typed - (Const (Int32 12, (2,14--2,16)), - LongIdent (SynLongIdent ([int], [], [None])), (2,14--2,16)), - (2,4--2,5), Yes (2,0--2,16), - { LeadingKeyword = Let (2,0--2,3) - InlineKeyword = None - EqualsRange = Some (2,12--2,13) })], (2,0--2,16))], - PreXmlDocEmpty, [], None, (2,0--3,0), { LeadingKeyword = None })], - (true, true), { ConditionalDirectives = [] - CodeComments = [] }, set [])) + (Named (SynIdent (v, None), false, None, (2,4--2,5)), + LongIdent (SynLongIdent ([int], [], [None])), (2,4--2,11)), + None, Const (Int32 12, (2,14--2,16)), (2,4--2,11), + Yes (2,0--2,16), { LeadingKeyword = Let (2,0--2,3) + InlineKeyword = None + EqualsRange = Some (2,12--2,13) })], + (2,0--2,16))], PreXmlDocEmpty, [], None, (2,0--3,0), + { LeadingKeyword = None })], (true, true), + { ConditionalDirectives = [] + CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/Binding/TupleReturnTypeOfBindingShouldContainStars.fs.bsl b/tests/service/data/SyntaxTree/Binding/TupleReturnTypeOfBindingShouldContainStars.fs.bsl index a8dae863d64..58d8afeac0b 100644 --- a/tests/service/data/SyntaxTree/Binding/TupleReturnTypeOfBindingShouldContainStars.fs.bsl +++ b/tests/service/data/SyntaxTree/Binding/TupleReturnTypeOfBindingShouldContainStars.fs.bsl @@ -11,29 +11,19 @@ ImplFile PreXmlDoc ((2,0), FSharp.Compiler.Xml.XmlDocCollector), SynValData (None, SynValInfo ([], SynArgInfo ([], false, None)), None), - Named (SynIdent (a, None), false, None, (2,4--2,5)), - Some - (SynBindingReturnInfo - (Tuple - (false, - [Type (LongIdent (SynLongIdent ([int], [], [None]))); - Star (2,12--2,13); - Type - (LongIdent (SynLongIdent ([string], [], [None])))], - (2,8--2,20)), (2,8--2,20), [], - { ColonRange = Some (2,6--2,7) })), Typed - (App - (NonAtomic, false, Ident failwith, - Const - (String ("todo", Regular, (2,32--2,38)), (2,32--2,38)), - (2,23--2,38)), + (Named (SynIdent (a, None), false, None, (2,4--2,5)), Tuple (false, [Type (LongIdent (SynLongIdent ([int], [], [None]))); Star (2,12--2,13); Type (LongIdent (SynLongIdent ([string], [], [None])))], - (2,8--2,20)), (2,23--2,38)), (2,4--2,5), Yes (2,0--2,38), + (2,8--2,20)), (2,4--2,20)), None, + App + (NonAtomic, false, Ident failwith, + Const + (String ("todo", Regular, (2,32--2,38)), (2,32--2,38)), + (2,23--2,38)), (2,4--2,20), Yes (2,0--2,38), { LeadingKeyword = Let (2,0--2,3) InlineKeyword = None EqualsRange = Some (2,21--2,22) })], (2,0--2,38)); @@ -44,27 +34,8 @@ ImplFile PreXmlDoc ((3,0), FSharp.Compiler.Xml.XmlDocCollector), SynValData (None, SynValInfo ([], SynArgInfo ([], false, None)), None), - Named (SynIdent (b, None), false, None, (3,4--3,5)), - Some - (SynBindingReturnInfo - (Tuple - (false, - [Type (LongIdent (SynLongIdent ([int], [], [None]))); - Star (3,12--3,13); - Type - (LongIdent (SynLongIdent ([string], [], [None]))); - Star (3,21--3,22); - Type (LongIdent (SynLongIdent ([bool], [], [None])))], - (3,8--3,27)), (3,8--3,27), [], - { ColonRange = Some (3,6--3,7) })), Typed - (Tuple - (false, - [Const (Int32 1, (3,30--3,31)); - Const - (String ("", Regular, (3,33--3,35)), (3,33--3,35)); - Const (Bool false, (3,37--3,42))], - [(3,31--3,32); (3,35--3,36)], (3,30--3,42)), + (Named (SynIdent (b, None), false, None, (3,4--3,5)), Tuple (false, [Type (LongIdent (SynLongIdent ([int], [], [None]))); @@ -72,10 +43,17 @@ ImplFile Type (LongIdent (SynLongIdent ([string], [], [None]))); Star (3,21--3,22); Type (LongIdent (SynLongIdent ([bool], [], [None])))], - (3,8--3,27)), (3,30--3,42)), (3,4--3,5), Yes (3,0--3,42), - { LeadingKeyword = Let (3,0--3,3) - InlineKeyword = None - EqualsRange = Some (3,28--3,29) })], (3,0--3,42))], - PreXmlDocEmpty, [], None, (2,0--4,0), { LeadingKeyword = None })], - (true, true), { ConditionalDirectives = [] - CodeComments = [] }, set [])) + (3,8--3,27)), (3,4--3,27)), None, + Tuple + (false, + [Const (Int32 1, (3,30--3,31)); + Const (String ("", Regular, (3,33--3,35)), (3,33--3,35)); + Const (Bool false, (3,37--3,42))], + [(3,31--3,32); (3,35--3,36)], (3,30--3,42)), (3,4--3,27), + Yes (3,0--3,42), { LeadingKeyword = Let (3,0--3,3) + InlineKeyword = None + EqualsRange = Some (3,28--3,29) })], + (3,0--3,42))], PreXmlDocEmpty, [], None, (2,0--4,0), + { LeadingKeyword = None })], (true, true), + { ConditionalDirectives = [] + CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/LeadingKeyword/OverrideKeyword.fs.bsl b/tests/service/data/SyntaxTree/LeadingKeyword/OverrideKeyword.fs.bsl index 896ea64e69b..dd91e790255 100644 --- a/tests/service/data/SyntaxTree/LeadingKeyword/OverrideKeyword.fs.bsl +++ b/tests/service/data/SyntaxTree/LeadingKeyword/OverrideKeyword.fs.bsl @@ -26,21 +26,15 @@ ImplFile SynValInfo ([[SynArgInfo ([], false, None)]; []], SynArgInfo ([], false, None)), None), - LongIdent - (SynLongIdent ([E], [], [None]), None, None, - Pats [], None, (3,13--3,14)), - Some - (SynBindingReturnInfo - (LongIdent - (SynLongIdent ([string], [], [None])), - (3,17--3,23), [], - { ColonRange = Some (3,15--3,16) })), Typed - (Const - (String ("", Regular, (3,26--3,28)), - (3,26--3,28)), + (LongIdent + (SynLongIdent ([E], [], [None]), None, None, + Pats [], None, (3,13--3,14)), LongIdent (SynLongIdent ([string], [], [None])), - (3,26--3,28)), (3,13--3,14), NoneAtInvisible, + (3,13--3,23)), None, + Const + (String ("", Regular, (3,26--3,28)), (3,26--3,28)), + (3,13--3,23), NoneAtInvisible, { LeadingKeyword = Override (3,4--3,12) InlineKeyword = None EqualsRange = Some (3,24--3,25) }), (3,4--3,28))], diff --git a/tests/service/data/SyntaxTree/LeadingKeyword/StaticMemberKeyword.fs.bsl b/tests/service/data/SyntaxTree/LeadingKeyword/StaticMemberKeyword.fs.bsl index 70b40e7ccd2..a031409caf7 100644 --- a/tests/service/data/SyntaxTree/LeadingKeyword/StaticMemberKeyword.fs.bsl +++ b/tests/service/data/SyntaxTree/LeadingKeyword/StaticMemberKeyword.fs.bsl @@ -25,18 +25,14 @@ ImplFile MemberKind = Member }, SynValInfo ([[]], SynArgInfo ([], false, None)), None), - LongIdent - (SynLongIdent ([Y], [], [None]), None, None, - Pats [], None, (3,18--3,19)), - Some - (SynBindingReturnInfo - (LongIdent (SynLongIdent ([int], [], [None])), - (3,22--3,25), [], - { ColonRange = Some (3,20--3,21) })), Typed - (Const (Int32 1, (3,28--3,29)), + (LongIdent + (SynLongIdent ([Y], [], [None]), None, None, + Pats [], None, (3,18--3,19)), LongIdent (SynLongIdent ([int], [], [None])), - (3,28--3,29)), (3,18--3,19), NoneAtInvisible, + (3,18--3,25)), None, + Const (Int32 1, (3,28--3,29)), (3,18--3,25), + NoneAtInvisible, { LeadingKeyword = StaticMember ((3,4--3,10), (3,11--3,17)) InlineKeyword = None diff --git a/tests/service/data/SyntaxTree/Member/Member 08.fs.bsl b/tests/service/data/SyntaxTree/Member/Member 08.fs.bsl index b2e10558c6a..e010d9b9a29 100644 --- a/tests/service/data/SyntaxTree/Member/Member 08.fs.bsl +++ b/tests/service/data/SyntaxTree/Member/Member 08.fs.bsl @@ -41,29 +41,19 @@ ImplFile SynValInfo ([[SynArgInfo ([], false, None)]; []], SynArgInfo ([], false, None)), None), - LongIdent - (SynLongIdent ([Norm], [], [None]), None, None, - Pats [], None, (4,42--4,46)), - Some - (SynBindingReturnInfo - (Fun - (Var - (SynTypar (T, None, false), (4,49--4,51)), - Var - (SynTypar (Measure, None, false), - (4,55--4,63)), (4,49--4,63), - { ArrowRange = (4,52--4,54) }), - (4,49--4,63), [], - { ColonRange = Some (4,47--4,48) })), Typed - (ArbitraryAfterError ("memberCore2", (4,63--4,63)), + (LongIdent + (SynLongIdent ([Norm], [], [None]), None, None, + Pats [], None, (4,42--4,46)), Fun (Var (SynTypar (T, None, false), (4,49--4,51)), Var (SynTypar (Measure, None, false), (4,55--4,63)), (4,49--4,63), - { ArrowRange = (4,52--4,54) }), (4,63--4,63)), - (4,42--4,46), NoneAtInvisible, + { ArrowRange = (4,52--4,54) }), (4,42--4,63)), + None, + ArbitraryAfterError ("memberCore2", (4,63--4,63)), + (4,42--4,63), NoneAtInvisible, { LeadingKeyword = Member (4,35--4,41) InlineKeyword = None EqualsRange = None }), (4,35--4,63))], diff --git a/tests/service/data/SyntaxTree/Member/Member 13.fs.bsl b/tests/service/data/SyntaxTree/Member/Member 13.fs.bsl index 129c9f529ce..a9ac8da2b4f 100644 --- a/tests/service/data/SyntaxTree/Member/Member 13.fs.bsl +++ b/tests/service/data/SyntaxTree/Member/Member 13.fs.bsl @@ -24,24 +24,20 @@ ImplFile MemberKind = Member }, SynValInfo ([[]], SynArgInfo ([], false, None)), None), - LongIdent - (SynLongIdent ([P], [], [None]), None, None, - Pats [], None, (4,18--4,19)), - Some - (SynBindingReturnInfo - (FromParseError (4,20--4,20), (4,20--4,20), [], - { ColonRange = Some (4,19--4,20) })), Typed - (ArbitraryAfterError ("memberCore2", (4,20--4,20)), - FromParseError (4,20--4,20), (4,20--4,20)), - (4,18--4,19), NoneAtInvisible, + (LongIdent + (SynLongIdent ([P], [], [None]), None, None, + Pats [], None, (4,18--4,19)), + FromParseError (4,20--4,20), (4,18--6,4)), None, + ArbitraryAfterError ("memberCore2", (6,4--6,4)), + (4,18--6,4), NoneAtInvisible, { LeadingKeyword = StaticMember ((4,4--4,10), (4,11--4,17)) InlineKeyword = None - EqualsRange = None }), (4,4--4,20))], (4,4--4,20)), - [], None, (3,5--4,20), { LeadingKeyword = Type (3,0--3,4) - EqualsRange = Some (3,7--3,8) - WithKeyword = None })], (3,0--4,20)); + EqualsRange = None }), (4,4--6,4))], (4,4--6,4)), + [], None, (3,5--6,4), { LeadingKeyword = Type (3,0--3,4) + EqualsRange = Some (3,7--3,8) + WithKeyword = None })], (3,0--6,4)); Types ([SynTypeDefn (SynComponentInfo diff --git a/tests/service/data/SyntaxTree/Member/SynTypeDefnWithMemberWithSetget.fs.bsl b/tests/service/data/SyntaxTree/Member/SynTypeDefnWithMemberWithSetget.fs.bsl index e3fe9618a23..bc9226840ee 100644 --- a/tests/service/data/SyntaxTree/Member/SynTypeDefnWithMemberWithSetget.fs.bsl +++ b/tests/service/data/SyntaxTree/Member/SynTypeDefnWithMemberWithSetget.fs.bsl @@ -31,26 +31,21 @@ ImplFile GetterOrSetterIsCompilerGenerated = false MemberKind = PropertyGet }, SynValInfo - ([[SynArgInfo ([], false, None)]; []], + ([[SynArgInfo ([], false, None)]], SynArgInfo ([], false, None)), None), - LongIdent - (SynLongIdent - ([this; Z], [(3,15--3,16)], [None; None]), - Some get, None, - Pats - [Paren - (Const (Unit, (3,52--3,54)), (3,52--3,54))], - None, (3,49--3,54)), - Some - (SynBindingReturnInfo - (LongIdent - (SynLongIdent ([int], [], [None])), - (3,55--3,58), [], - { ColonRange = Some (3,54--3,55) })), Typed - (Const (Int32 1, (3,61--3,62)), + (LongIdent + (SynLongIdent + ([this; Z], [(3,15--3,16)], [None; None]), + Some get, None, + Pats + [Paren + (Const (Unit, (3,52--3,54)), + (3,52--3,54))], None, (3,49--3,54)), LongIdent (SynLongIdent ([int], [], [None])), - (3,61--3,62)), (3,49--3,54), NoneAtInvisible, + (3,49--3,58)), None, + Const (Int32 1, (3,61--3,62)), (3,49--3,58), + NoneAtInvisible, { LeadingKeyword = Member (3,4--3,10) InlineKeyword = None EqualsRange = Some (3,59--3,60) })), @@ -68,31 +63,26 @@ ImplFile GetterOrSetterIsCompilerGenerated = false MemberKind = PropertySet }, SynValInfo - ([[SynArgInfo ([], false, None)]; - [SynArgInfo ([], false, None)]], + ([[SynArgInfo ([], false, None)]], SynArgInfo ([], false, None)), None), - LongIdent - (SynLongIdent - ([this; Z], [(3,15--3,16)], [None; None]), - Some set, None, - Pats - [Paren - (Typed - (Wild (3,28--3,29), - LongIdent - (SynLongIdent ([int], [], [None])), - (3,28--3,33)), (3,27--3,34))], None, - (3,23--3,34)), - Some - (SynBindingReturnInfo - (LongIdent - (SynLongIdent ([unit], [], [None])), - (3,35--3,39), [], - { ColonRange = Some (3,34--3,35) })), Typed - (Const (Unit, (3,42--3,44)), + (LongIdent + (SynLongIdent + ([this; Z], [(3,15--3,16)], [None; None]), + Some set, None, + Pats + [Paren + (Typed + (Wild (3,28--3,29), + LongIdent + (SynLongIdent + ([int], [], [None])), + (3,28--3,33)), (3,27--3,34))], + None, (3,23--3,34)), LongIdent (SynLongIdent ([unit], [], [None])), - (3,42--3,44)), (3,23--3,34), NoneAtInvisible, + (3,23--3,39)), None, + Const (Unit, (3,42--3,44)), (3,23--3,39), + NoneAtInvisible, { LeadingKeyword = Member (3,4--3,10) InlineKeyword = None EqualsRange = Some (3,40--3,41) })), diff --git a/tests/service/data/SyntaxTree/ModuleOrNamespace/Module - Attribute 01.fs.bsl b/tests/service/data/SyntaxTree/ModuleOrNamespace/Module - Attribute 01.fs.bsl index 70ca7f64fdb..1de0781daeb 100644 --- a/tests/service/data/SyntaxTree/ModuleOrNamespace/Module - Attribute 01.fs.bsl +++ b/tests/service/data/SyntaxTree/ModuleOrNamespace/Module - Attribute 01.fs.bsl @@ -11,15 +11,12 @@ ImplFile PreXmlDoc ((5,0), FSharp.Compiler.Xml.XmlDocCollector), SynValData (None, SynValInfo ([], SynArgInfo ([], false, None)), None), - Named (SynIdent (s, None), false, None, (5,4--5,5)), - Some - (SynBindingReturnInfo - (LongIdent (SynLongIdent ([string], [], [None])), - (5,8--5,14), [], { ColonRange = Some (5,6--5,7) })), Typed - (Const (String ("s", Regular, (5,17--5,20)), (5,17--5,20)), + (Named (SynIdent (s, None), false, None, (5,4--5,5)), LongIdent (SynLongIdent ([string], [], [None])), - (5,17--5,20)), (5,4--5,5), Yes (5,0--5,20), + (5,4--5,14)), None, + Const (String ("s", Regular, (5,17--5,20)), (5,17--5,20)), + (5,4--5,14), Yes (5,0--5,20), { LeadingKeyword = Let (5,0--5,3) InlineKeyword = None EqualsRange = Some (5,15--5,16) })], (5,0--5,20))], diff --git a/tests/service/data/SyntaxTree/Nullness/GenericFunctionReturnTypeNotStructNull.fs.bsl b/tests/service/data/SyntaxTree/Nullness/GenericFunctionReturnTypeNotStructNull.fs.bsl index d155f74abba..60921e95afb 100644 --- a/tests/service/data/SyntaxTree/Nullness/GenericFunctionReturnTypeNotStructNull.fs.bsl +++ b/tests/service/data/SyntaxTree/Nullness/GenericFunctionReturnTypeNotStructNull.fs.bsl @@ -10,30 +10,20 @@ ImplFile (None, Normal, false, false, [], PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), SynValData - (None, SynValInfo ([[]], SynArgInfo ([], false, None)), None), - LongIdent - (SynLongIdent ([myFunc], [], [None]), None, None, - Pats [Paren (Const (Unit, (1,10--1,12)), (1,10--1,12))], - None, (1,4--1,12)), - Some - (SynBindingReturnInfo - (WithGlobalConstraints - (Var (SynTypar (T, None, false), (1,15--1,17)), - [WhereTyparIsReferenceType - (SynTypar (T, None, false), (1,23--1,38)); - WhereTyparSupportsNull - (SynTypar (T, None, false), (1,43--1,50))], - (1,15--1,50)), (1,15--1,50), [], - { ColonRange = Some (1,13--1,14) })), + (None, SynValInfo ([], SynArgInfo ([], false, None)), None), Typed - (Null (1,53--1,57), + (LongIdent + (SynLongIdent ([myFunc], [], [None]), None, None, + Pats [Paren (Const (Unit, (1,10--1,12)), (1,10--1,12))], + None, (1,4--1,12)), WithGlobalConstraints (Var (SynTypar (T, None, false), (1,15--1,17)), [WhereTyparIsReferenceType (SynTypar (T, None, false), (1,23--1,38)); WhereTyparSupportsNull (SynTypar (T, None, false), (1,43--1,50))], - (1,15--1,50)), (1,53--1,57)), (1,4--1,12), NoneAtLet, + (1,15--1,50)), (1,4--1,50)), None, Null (1,53--1,57), + (1,4--1,50), Yes (1,0--1,57), { LeadingKeyword = Let (1,0--1,3) InlineKeyword = None EqualsRange = Some (1,51--1,52) })], (1,0--1,57))], diff --git a/tests/service/data/SyntaxTree/Nullness/IntListOrNull.fs.bsl b/tests/service/data/SyntaxTree/Nullness/IntListOrNull.fs.bsl index c678aa83577..63642576d42 100644 --- a/tests/service/data/SyntaxTree/Nullness/IntListOrNull.fs.bsl +++ b/tests/service/data/SyntaxTree/Nullness/IntListOrNull.fs.bsl @@ -11,25 +11,15 @@ ImplFile PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), SynValData (None, SynValInfo ([], SynArgInfo ([], false, None)), None), - Named (SynIdent (x, None), false, None, (1,4--1,5)), - Some - (SynBindingReturnInfo - (WithNull - (App - (LongIdent (SynLongIdent ([list], [], [None])), - None, - [LongIdent (SynLongIdent ([int], [], [None]))], [], - None, true, (1,8--1,16)), false, (1,8--1,23), - { BarRange = (1,17--1,18) }), (1,8--1,23), [], - { ColonRange = Some (1,6--1,7) })), Typed - (ArrayOrList (false, [], (1,26--1,28)), + (Named (SynIdent (x, None), false, None, (1,4--1,5)), WithNull (App (LongIdent (SynLongIdent ([list], [], [None])), None, [LongIdent (SynLongIdent ([int], [], [None]))], [], None, true, (1,8--1,16)), false, (1,8--1,23), - { BarRange = (1,17--1,18) }), (1,26--1,28)), (1,4--1,5), + { BarRange = (1,17--1,18) }), (1,4--1,23)), None, + ArrayOrList (false, [], (1,26--1,28)), (1,4--1,23), Yes (1,0--1,28), { LeadingKeyword = Let (1,0--1,3) InlineKeyword = None EqualsRange = Some (1,24--1,25) })], diff --git a/tests/service/data/SyntaxTree/Nullness/IntListOrNullOrNullOrNull.fs.bsl b/tests/service/data/SyntaxTree/Nullness/IntListOrNullOrNullOrNull.fs.bsl index 2ba94607f41..0a8f1df0a7e 100644 --- a/tests/service/data/SyntaxTree/Nullness/IntListOrNullOrNullOrNull.fs.bsl +++ b/tests/service/data/SyntaxTree/Nullness/IntListOrNullOrNullOrNull.fs.bsl @@ -11,30 +11,25 @@ ImplFile PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), SynValData (None, SynValInfo ([], SynArgInfo ([], false, None)), None), - Named (SynIdent (x, None), false, None, (1,4--1,5)), - Some - (SynBindingReturnInfo - (WithNull - (App - (LongIdent (SynLongIdent ([list], [], [None])), - None, - [LongIdent (SynLongIdent ([int], [], [None]))], [], - None, true, (1,8--1,16)), false, (1,8--1,23), - { BarRange = (1,17--1,18) }), (1,8--1,23), [], - { ColonRange = Some (1,6--1,7) })), - Typed - (ArbitraryAfterError ("localBinding2", (1,23--1,23)), - WithNull - (App - (LongIdent (SynLongIdent ([list], [], [None])), None, - [LongIdent (SynLongIdent ([int], [], [None]))], [], - None, true, (1,8--1,16)), false, (1,8--1,23), - { BarRange = (1,17--1,18) }), (1,23--1,23)), (1,4--1,5), - Yes (1,0--1,23), { LeadingKeyword = Let (1,0--1,3) + Or + (Or + (Typed + (Named (SynIdent (x, None), false, None, (1,4--1,5)), + WithNull + (App + (LongIdent (SynLongIdent ([list], [], [None])), + None, + [LongIdent (SynLongIdent ([int], [], [None]))], + [], None, true, (1,8--1,16)), false, + (1,8--1,23), { BarRange = (1,17--1,18) }), + (1,4--1,23)), Null (1,26--1,30), (1,4--1,30), + { BarRange = (1,24--1,25) }), Null (1,33--1,37), + (1,4--1,37), { BarRange = (1,31--1,32) }), None, + ArrayOrList (false, [], (1,40--1,42)), (1,4--1,37), + Yes (1,0--1,42), { LeadingKeyword = Let (1,0--1,3) InlineKeyword = None - EqualsRange = None })], (1,0--1,23))], - PreXmlDocEmpty, [], None, (1,0--2,0), { LeadingKeyword = None })], - (true, true), { ConditionalDirectives = [] - CodeComments = [] }, set [])) - -(1,24)-(1,25) parse error Unexpected symbol '|' (directly before 'null') in binding. Expected '=' or other token. + EqualsRange = Some (1,38--1,39) })], + (1,0--1,42))], PreXmlDocEmpty, [], None, (1,0--2,0), + { LeadingKeyword = None })], (true, true), + { ConditionalDirectives = [] + CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/Nullness/NullAnnotatedExpression.fs.bsl b/tests/service/data/SyntaxTree/Nullness/NullAnnotatedExpression.fs.bsl index 207a76250e4..a83025be962 100644 --- a/tests/service/data/SyntaxTree/Nullness/NullAnnotatedExpression.fs.bsl +++ b/tests/service/data/SyntaxTree/Nullness/NullAnnotatedExpression.fs.bsl @@ -11,37 +11,8 @@ ImplFile PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), SynValData (None, SynValInfo ([], SynArgInfo ([], false, None)), None), - Named (SynIdent (x, None), false, None, (1,4--1,5)), - Some - (SynBindingReturnInfo - (WithNull - (App - (LongIdent - (SynLongIdent ([Expression], [], [None])), - Some (1,18--1,19), - [WithNull - (App - (LongIdent - (SynLongIdent ([Func], [], [None])), - Some (1,23--1,24), - [WithNull - (LongIdent - (SynLongIdent ([string], [], [None])), - false, (1,24--1,37), - { BarRange = (1,31--1,32) }); - WithNull - (LongIdent - (SynLongIdent ([T], [], [None])), - false, (1,39--1,47), - { BarRange = (1,41--1,42) })], - [(1,37--1,38)], Some (1,47--1,48), false, - (1,19--1,48)), false, (1,19--1,55), - { BarRange = (1,49--1,50) })], [], - Some (1,55--1,56), false, (1,8--1,56)), false, - (1,8--1,63), { BarRange = (1,57--1,58) }), - (1,8--1,63), [], { ColonRange = Some (1,6--1,7) })), Typed - (Null (1,66--1,70), + (Named (SynIdent (x, None), false, None, (1,4--1,5)), WithNull (App (LongIdent (SynLongIdent ([Expression], [], [None])), @@ -63,8 +34,8 @@ ImplFile (1,19--1,48)), false, (1,19--1,55), { BarRange = (1,49--1,50) })], [], Some (1,55--1,56), false, (1,8--1,56)), false, - (1,8--1,63), { BarRange = (1,57--1,58) }), (1,66--1,70)), - (1,4--1,5), Yes (1,0--1,70), + (1,8--1,63), { BarRange = (1,57--1,58) }), (1,4--1,63)), + None, Null (1,66--1,70), (1,4--1,63), Yes (1,0--1,70), { LeadingKeyword = Let (1,0--1,3) InlineKeyword = None EqualsRange = Some (1,64--1,65) })], (1,0--1,70))], diff --git a/tests/service/data/SyntaxTree/Nullness/StringOrNull.fs.bsl b/tests/service/data/SyntaxTree/Nullness/StringOrNull.fs.bsl index 4e8240dd5fb..d2ec88c3c84 100644 --- a/tests/service/data/SyntaxTree/Nullness/StringOrNull.fs.bsl +++ b/tests/service/data/SyntaxTree/Nullness/StringOrNull.fs.bsl @@ -11,19 +11,12 @@ ImplFile PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), SynValData (None, SynValInfo ([], SynArgInfo ([], false, None)), None), - Named (SynIdent (x, None), false, None, (1,4--1,5)), - Some - (SynBindingReturnInfo - (WithNull - (LongIdent (SynLongIdent ([string], [], [None])), - false, (1,8--1,21), { BarRange = (1,15--1,16) }), - (1,8--1,21), [], { ColonRange = Some (1,6--1,7) })), Typed - (Null (1,24--1,28), + (Named (SynIdent (x, None), false, None, (1,4--1,5)), WithNull (LongIdent (SynLongIdent ([string], [], [None])), false, - (1,8--1,21), { BarRange = (1,15--1,16) }), (1,24--1,28)), - (1,4--1,5), Yes (1,0--1,28), + (1,8--1,21), { BarRange = (1,15--1,16) }), (1,4--1,21)), + None, Null (1,24--1,28), (1,4--1,21), Yes (1,0--1,28), { LeadingKeyword = Let (1,0--1,3) InlineKeyword = None EqualsRange = Some (1,22--1,23) })], (1,0--1,28))], diff --git a/tests/service/data/SyntaxTree/Pattern/Typed - Missing type 01.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Typed - Missing type 01.fs.bsl index 39999d8f69c..83ed3edb90e 100644 --- a/tests/service/data/SyntaxTree/Pattern/Typed - Missing type 01.fs.bsl +++ b/tests/service/data/SyntaxTree/Pattern/Typed - Missing type 01.fs.bsl @@ -11,19 +11,15 @@ ImplFile PreXmlDoc ((3,0), FSharp.Compiler.Xml.XmlDocCollector), SynValData (None, SynValInfo ([], SynArgInfo ([], false, None)), None), - Named (SynIdent (i, None), false, None, (3,4--3,5)), - Some - (SynBindingReturnInfo - (FromParseError (3,6--3,6), (3,6--3,6), [], - { ColonRange = Some (3,5--3,6) })), Typed - (ArbitraryAfterError ("localBinding2", (3,6--3,6)), - FromParseError (3,6--3,6), (3,6--3,6)), (3,4--3,5), - Yes (3,0--3,6), { LeadingKeyword = Let (3,0--3,3) + (Named (SynIdent (i, None), false, None, (3,4--3,5)), + FromParseError (3,6--3,6), (3,4--5,1)), None, + ArbitraryAfterError ("localBinding2", (5,1--5,1)), (3,4--5,1), + Yes (3,0--5,1), { LeadingKeyword = Let (3,0--3,3) InlineKeyword = None - EqualsRange = None })], (3,0--3,6))], + EqualsRange = None })], (3,0--5,1))], PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, - (1,0--3,6), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + (1,0--5,1), { LeadingKeyword = Module (1,0--1,6) })], (true, true), { ConditionalDirectives = [] CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/Pattern/Typed - Missing type 02.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Typed - Missing type 02.fs.bsl index b5b4b6e28e2..66b8e494f17 100644 --- a/tests/service/data/SyntaxTree/Pattern/Typed - Missing type 02.fs.bsl +++ b/tests/service/data/SyntaxTree/Pattern/Typed - Missing type 02.fs.bsl @@ -11,14 +11,10 @@ ImplFile PreXmlDoc ((3,0), FSharp.Compiler.Xml.XmlDocCollector), SynValData (None, SynValInfo ([], SynArgInfo ([], false, None)), None), - Named (SynIdent (i, None), false, None, (3,4--3,5)), - Some - (SynBindingReturnInfo - (FromParseError (3,6--3,6), (3,6--3,6), [], - { ColonRange = Some (3,5--3,6) })), Typed - (Const (Int32 1, (3,9--3,10)), FromParseError (3,6--3,6), - (3,9--3,10)), (3,4--3,5), Yes (3,0--3,10), + (Named (SynIdent (i, None), false, None, (3,4--3,5)), + FromParseError (3,6--3,6), (3,4--3,8)), None, + Const (Int32 1, (3,9--3,10)), (3,4--3,8), Yes (3,0--3,10), { LeadingKeyword = Let (3,0--3,3) InlineKeyword = None EqualsRange = Some (3,7--3,8) })], (3,0--3,10)); 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 7bd27b958c6..d1bb0776a63 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 @@ -16,25 +16,21 @@ ImplFile (None, SynValInfo ([], SynArgInfo ([], false, None)), None), - Named (SynIdent (i, None), false, None, (4,8--4,9)), - Some - (SynBindingReturnInfo - (FromParseError (4,10--4,10), (4,10--4,10), [], - { ColonRange = Some (4,9--4,10) })), Typed - (ArbitraryAfterError - ("localBinding2", (4,10--4,10)), - FromParseError (4,10--4,10), (4,10--4,10)), - (4,8--4,9), Yes (4,4--4,10), + (Named + (SynIdent (i, None), false, None, (4,8--4,9)), + FromParseError (4,10--4,10), (4,8--6,5)), None, + ArbitraryAfterError ("localBinding2", (6,5--6,5)), + (4,8--6,5), Yes (4,4--6,5), { LeadingKeyword = Let (4,4--4,7) InlineKeyword = None EqualsRange = None })], - ArbitraryAfterError ("seqExpr", (4,10--4,10)), - (4,4--4,10), { LetOrUseKeyword = (4,4--4,7) - InKeyword = None }), (4,4--4,10)), - (3,0--4,10)), (3,0--4,10))], + ArbitraryAfterError ("seqExpr", (6,5--6,5)), (4,4--6,5), + { LetOrUseKeyword = (4,4--4,7) + InKeyword = None }), (4,4--6,5)), (3,0--6,5)), + (3,0--6,5))], PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, - (1,0--4,10), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + (1,0--6,5), { LeadingKeyword = Module (1,0--1,6) })], (true, true), { ConditionalDirectives = [] CodeComments = [] }, set [])) 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 6120ff4f5fd..d8f94573b3e 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 @@ -14,18 +14,13 @@ ImplFile SynValData (None, SynValInfo ([], SynArgInfo ([], false, None)), None), - Named (SynIdent (i, None), false, None, (4,8--4,9)), - Some - (SynBindingReturnInfo - (FromParseError (4,10--4,10), (4,10--4,10), [], - { ColonRange = Some (4,9--4,10) })), Typed - (Const (Int32 1, (4,13--4,14)), - FromParseError (4,10--4,10), (4,13--4,14)), - (4,8--4,9), Yes (4,4--4,14), - { LeadingKeyword = Let (4,4--4,7) - InlineKeyword = None - EqualsRange = Some (4,11--4,12) })], + (Named (SynIdent (i, None), false, None, (4,8--4,9)), + FromParseError (4,10--4,10), (4,8--4,12)), None, + Const (Int32 1, (4,13--4,14)), (4,8--4,12), + Yes (4,4--4,14), { LeadingKeyword = Let (4,4--4,7) + InlineKeyword = None + EqualsRange = Some (4,11--4,12) })], Const (Unit, (6,4--6,6)), (4,4--6,6), { LetOrUseKeyword = (4,4--4,7) InKeyword = None }), (3,0--6,6)), (3,0--6,6))], diff --git a/tests/service/data/SyntaxTree/SynType/Fun 06.fs.bsl b/tests/service/data/SyntaxTree/SynType/Fun 06.fs.bsl index 79fba7f21d4..b60861b5bca 100644 --- a/tests/service/data/SyntaxTree/SynType/Fun 06.fs.bsl +++ b/tests/service/data/SyntaxTree/SynType/Fun 06.fs.bsl @@ -10,24 +10,16 @@ ImplFile PreXmlDoc ((3,0), FSharp.Compiler.Xml.XmlDocCollector), SynValData (None, SynValInfo ([], SynArgInfo ([], false, None)), None), - Wild (3,4--3,5), - Some - (SynBindingReturnInfo - (Fun - (LongIdent (SynLongIdent ([a], [], [None])), - LongIdent (SynLongIdent ([b], [], [None])), - (3,7--3,13), { ArrowRange = (3,9--3,11) }), - (3,7--3,13), [], { ColonRange = Some (3,5--3,6) })), Typed - (Const (Unit, (3,16--3,18)), + (Wild (3,4--3,5), Fun (LongIdent (SynLongIdent ([a], [], [None])), LongIdent (SynLongIdent ([b], [], [None])), (3,7--3,13), - { ArrowRange = (3,9--3,11) }), (3,16--3,18)), (3,4--3,5), - Yes (3,0--3,18), { LeadingKeyword = Let (3,0--3,3) - InlineKeyword = None - EqualsRange = Some (3,14--3,15) })], - (3,0--3,18))], + { ArrowRange = (3,9--3,11) }), (3,4--3,13)), None, + Const (Unit, (3,16--3,18)), (3,4--3,13), Yes (3,0--3,18), + { LeadingKeyword = Let (3,0--3,3) + InlineKeyword = None + EqualsRange = Some (3,14--3,15) })], (3,0--3,18))], PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, (1,0--3,18), { LeadingKeyword = Module (1,0--1,6) })], (true, true), { ConditionalDirectives = [] diff --git a/tests/service/data/SyntaxTree/SynType/Fun 07.fs.bsl b/tests/service/data/SyntaxTree/SynType/Fun 07.fs.bsl index fc09b3f737f..df25683b851 100644 --- a/tests/service/data/SyntaxTree/SynType/Fun 07.fs.bsl +++ b/tests/service/data/SyntaxTree/SynType/Fun 07.fs.bsl @@ -10,27 +10,16 @@ ImplFile PreXmlDoc ((3,0), FSharp.Compiler.Xml.XmlDocCollector), SynValData (None, SynValInfo ([], SynArgInfo ([], false, None)), None), - Wild (3,4--3,5), - Some - (SynBindingReturnInfo - (Fun - (LongIdent (SynLongIdent ([a], [], [None])), - Fun - (LongIdent (SynLongIdent ([b], [], [None])), - LongIdent (SynLongIdent ([c], [], [None])), - (3,12--3,18), { ArrowRange = (3,14--3,16) }), - (3,7--3,18), { ArrowRange = (3,9--3,11) }), - (3,7--3,18), [], { ColonRange = Some (3,5--3,6) })), Typed - (Const (Unit, (3,21--3,23)), + (Wild (3,4--3,5), Fun (LongIdent (SynLongIdent ([a], [], [None])), Fun (LongIdent (SynLongIdent ([b], [], [None])), LongIdent (SynLongIdent ([c], [], [None])), (3,12--3,18), { ArrowRange = (3,14--3,16) }), - (3,7--3,18), { ArrowRange = (3,9--3,11) }), (3,21--3,23)), - (3,4--3,5), Yes (3,0--3,23), + (3,7--3,18), { ArrowRange = (3,9--3,11) }), (3,4--3,18)), + None, Const (Unit, (3,21--3,23)), (3,4--3,18), Yes (3,0--3,23), { LeadingKeyword = Let (3,0--3,3) InlineKeyword = None EqualsRange = Some (3,19--3,20) })], (3,0--3,23))], diff --git a/tests/service/data/SyntaxTree/SynType/Fun 08.fs.bsl b/tests/service/data/SyntaxTree/SynType/Fun 08.fs.bsl index 914be23e3c5..2be3be58a19 100644 --- a/tests/service/data/SyntaxTree/SynType/Fun 08.fs.bsl +++ b/tests/service/data/SyntaxTree/SynType/Fun 08.fs.bsl @@ -10,27 +10,19 @@ ImplFile PreXmlDoc ((3,0), FSharp.Compiler.Xml.XmlDocCollector), SynValData (None, SynValInfo ([], SynArgInfo ([], false, None)), None), - Wild (3,4--3,5), - Some - (SynBindingReturnInfo - (Fun - (LongIdent (SynLongIdent ([a], [], [None])), - FromParseError (3,11--3,11), (3,7--3,13), - { ArrowRange = (3,9--3,11) }), (3,7--3,13), [], - { ColonRange = Some (3,5--3,6) })), Typed - (Const (Unit, (3,14--3,16)), + (Wild (3,4--3,5), Fun (LongIdent (SynLongIdent ([a], [], [None])), - FromParseError (3,11--3,11), (3,7--3,13), - { ArrowRange = (3,9--3,11) }), (3,14--3,16)), (3,4--3,5), - Yes (3,0--3,16), { LeadingKeyword = Let (3,0--3,3) - InlineKeyword = None - EqualsRange = Some (3,12--3,13) })], - (3,0--3,16))], + FromParseError (3,11--3,11), (3,7--3,11), + { ArrowRange = (3,9--3,11) }), (3,4--3,13)), None, + Const (Unit, (3,14--3,16)), (3,4--3,13), Yes (3,0--3,16), + { LeadingKeyword = Let (3,0--3,3) + InlineKeyword = None + EqualsRange = Some (3,12--3,13) })], (3,0--3,16))], PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, (1,0--3,16), { LeadingKeyword = Module (1,0--1,6) })], (true, true), { ConditionalDirectives = [] CodeComments = [] }, set [])) -(3,12)-(3,13) parse error Unexpected symbol '=' in binding +(3,12)-(3,13) parse error Unexpected symbol '=' in type diff --git a/tests/service/data/SyntaxTree/SynType/Fun 09.fs.bsl b/tests/service/data/SyntaxTree/SynType/Fun 09.fs.bsl index 3a7ecdba3cf..2cedea1e728 100644 --- a/tests/service/data/SyntaxTree/SynType/Fun 09.fs.bsl +++ b/tests/service/data/SyntaxTree/SynType/Fun 09.fs.bsl @@ -10,33 +10,22 @@ ImplFile PreXmlDoc ((3,0), FSharp.Compiler.Xml.XmlDocCollector), SynValData (None, SynValInfo ([], SynArgInfo ([], false, None)), None), - Wild (3,4--3,5), - Some - (SynBindingReturnInfo - (Fun - (LongIdent (SynLongIdent ([a], [], [None])), - Fun - (LongIdent (SynLongIdent ([b], [], [None])), - FromParseError (3,16--3,16), (3,12--3,18), - { ArrowRange = (3,14--3,16) }), (3,7--3,18), - { ArrowRange = (3,9--3,11) }), (3,7--3,18), [], - { ColonRange = Some (3,5--3,6) })), Typed - (Const (Unit, (3,19--3,21)), + (Wild (3,4--3,5), Fun (LongIdent (SynLongIdent ([a], [], [None])), Fun (LongIdent (SynLongIdent ([b], [], [None])), - FromParseError (3,16--3,16), (3,12--3,18), - { ArrowRange = (3,14--3,16) }), (3,7--3,18), - { ArrowRange = (3,9--3,11) }), (3,19--3,21)), (3,4--3,5), - Yes (3,0--3,21), { LeadingKeyword = Let (3,0--3,3) - InlineKeyword = None - EqualsRange = Some (3,17--3,18) })], - (3,0--3,21))], + FromParseError (3,16--3,16), (3,12--3,16), + { ArrowRange = (3,14--3,16) }), (3,7--3,16), + { ArrowRange = (3,9--3,11) }), (3,4--3,18)), None, + Const (Unit, (3,19--3,21)), (3,4--3,18), Yes (3,0--3,21), + { LeadingKeyword = Let (3,0--3,3) + InlineKeyword = None + EqualsRange = Some (3,17--3,18) })], (3,0--3,21))], PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, (1,0--3,21), { LeadingKeyword = Module (1,0--1,6) })], (true, true), { ConditionalDirectives = [] CodeComments = [] }, set [])) -(3,17)-(3,18) parse error Unexpected symbol '=' in binding +(3,17)-(3,18) parse error Unexpected symbol '=' in type diff --git a/tests/service/data/SyntaxTree/SynType/Fun 10.fs.bsl b/tests/service/data/SyntaxTree/SynType/Fun 10.fs.bsl index 061982252ad..16921935e20 100644 --- a/tests/service/data/SyntaxTree/SynType/Fun 10.fs.bsl +++ b/tests/service/data/SyntaxTree/SynType/Fun 10.fs.bsl @@ -10,27 +10,22 @@ ImplFile PreXmlDoc ((3,0), FSharp.Compiler.Xml.XmlDocCollector), SynValData (None, SynValInfo ([], SynArgInfo ([], false, None)), None), - Wild (3,4--3,5), - Some - (SynBindingReturnInfo - (Fun - (LongIdent (SynLongIdent ([a], [], [None])), - FromParseError (3,11--3,11), (3,7--3,14), - { ArrowRange = (3,9--3,11) }), (3,7--3,14), [], - { ColonRange = Some (3,5--3,6) })), Typed - (Const (Unit, (3,19--3,21)), + (Wild (3,4--3,5), Fun (LongIdent (SynLongIdent ([a], [], [None])), - FromParseError (3,11--3,11), (3,7--3,14), - { ArrowRange = (3,9--3,11) }), (3,19--3,21)), (3,4--3,5), - Yes (3,0--3,21), { LeadingKeyword = Let (3,0--3,3) - InlineKeyword = None - EqualsRange = Some (3,17--3,18) })], - (3,0--3,21))], + Fun + (FromParseError (3,12--3,12), + LongIdent (SynLongIdent ([c], [], [None])), + (3,12--3,16), { ArrowRange = (3,12--3,14) }), + (3,7--3,16), { ArrowRange = (3,9--3,11) }), (3,4--3,16)), + None, Const (Unit, (3,19--3,21)), (3,4--3,16), Yes (3,0--3,21), + { LeadingKeyword = Let (3,0--3,3) + InlineKeyword = None + EqualsRange = Some (3,17--3,18) })], (3,0--3,21))], PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, (1,0--3,21), { LeadingKeyword = Module (1,0--1,6) })], (true, true), { ConditionalDirectives = [] CodeComments = [] }, set [])) -(3,12)-(3,14) parse error Unexpected symbol '->' in binding +(3,12)-(3,14) parse error Expecting type diff --git a/tests/service/data/SyntaxTree/SynType/NestedSynTypeOrInsideSynExprTraitCall.fs.bsl b/tests/service/data/SyntaxTree/SynType/NestedSynTypeOrInsideSynExprTraitCall.fs.bsl index 1c58087b0d8..b7ea6e3291f 100644 --- a/tests/service/data/SyntaxTree/SynType/NestedSynTypeOrInsideSynExprTraitCall.fs.bsl +++ b/tests/service/data/SyntaxTree/SynType/NestedSynTypeOrInsideSynExprTraitCall.fs.bsl @@ -10,93 +10,86 @@ ImplFile (None, Normal, true, false, [], PreXmlDoc ((2,0), FSharp.Compiler.Xml.XmlDocCollector), SynValData - (None, - SynValInfo - ([[SynArgInfo ([], false, Some x)]], - SynArgInfo ([], false, None)), None), - LongIdent - (SynLongIdent - ([op_BangBang], [], - [Some - (OriginalNotationWithParen - ((2,11--2,12), "!!", (2,14--2,15)))]), None, None, - Pats - [Paren - (Typed - (Named - (SynIdent (x, None), false, None, (2,17--2,18)), - Tuple - (false, - [Type - (Var - (SynTypar (a, HeadType, false), - (2,20--2,22))); Star (2,23--2,24); - Type - (Var - (SynTypar (b, HeadType, false), - (2,25--2,27)))], (2,20--2,27)), - (2,17--2,27)), (2,16--2,28))], None, (2,11--2,28)), - Some - (SynBindingReturnInfo - (Var (SynTypar (c, HeadType, false), (2,31--2,33)), - (2,31--2,33), [], { ColonRange = Some (2,29--2,30) })), + (None, SynValInfo ([], SynArgInfo ([], false, None)), None), Typed - (Paren - (TraitCall - (Paren + (LongIdent + (SynLongIdent + ([op_BangBang], [], + [Some + (OriginalNotationWithParen + ((2,11--2,12), "!!", (2,14--2,15)))]), None, + None, + Pats + [Paren + (Typed + (Named + (SynIdent (x, None), false, None, + (2,17--2,18)), + Tuple + (false, + [Type + (Var + (SynTypar (a, HeadType, false), + (2,20--2,22))); Star (2,23--2,24); + Type + (Var + (SynTypar (b, HeadType, false), + (2,25--2,27)))], (2,20--2,27)), + (2,17--2,27)), (2,16--2,28))], None, + (2,11--2,28)), + Var (SynTypar (c, HeadType, false), (2,31--2,33)), + (2,11--2,33)), None, + Paren + (TraitCall + (Paren + (Or (Or - (Or - (Var - (SynTypar (a, HeadType, false), - (2,38--2,40)), - Var - (SynTypar (b, HeadType, false), - (2,44--2,46)), (2,38--2,46), - { OrKeyword = (2,41--2,43) }), + (Var + (SynTypar (a, HeadType, false), (2,38--2,40)), Var - (SynTypar (c, HeadType, false), (2,50--2,52)), - (2,38--2,52), { OrKeyword = (2,47--2,49) }), - (2,37--2,53)), - Member - (SynValSig - ([], SynIdent (op_Implicit, None), - SynValTyparDecls (None, true), - Fun - (Tuple - (false, - [Type - (Var - (SynTypar (a, HeadType, false), - (2,83--2,85))); Star (2,86--2,87); - Type - (Var - (SynTypar (b, HeadType, false), - (2,88--2,90)))], (2,83--2,90)), - Var - (SynTypar (c, HeadType, false), - (2,94--2,96)), (2,83--2,96), - { ArrowRange = (2,91--2,93) }), - SynValInfo - ([[SynArgInfo ([], false, None); - SynArgInfo ([], false, None)]], - SynArgInfo ([], false, None)), false, false, - PreXmlDoc ((2,56), FSharp.Compiler.Xml.XmlDocCollector), - Single None, None, (2,56--2,96), - { LeadingKeyword = - StaticMember ((2,56--2,62), (2,63--2,69)) - InlineKeyword = None - WithKeyword = None - EqualsRange = None }), - { IsInstance = false - IsDispatchSlot = false - IsOverrideOrExplicitImpl = false - IsFinal = false - GetterOrSetterIsCompilerGenerated = false - MemberKind = Member }, (2,56--2,96), - { GetSetKeywords = None }), Ident x, (2,36--2,100)), - (2,36--2,37), Some (2,99--2,100), (2,36--2,100)), - Var (SynTypar (c, HeadType, false), (2,31--2,33)), - (2,36--2,100)), (2,11--2,28), NoneAtLet, + (SynTypar (b, HeadType, false), (2,44--2,46)), + (2,38--2,46), { OrKeyword = (2,41--2,43) }), + Var (SynTypar (c, HeadType, false), (2,50--2,52)), + (2,38--2,52), { OrKeyword = (2,47--2,49) }), + (2,37--2,53)), + Member + (SynValSig + ([], SynIdent (op_Implicit, None), + SynValTyparDecls (None, true), + Fun + (Tuple + (false, + [Type + (Var + (SynTypar (a, HeadType, false), + (2,83--2,85))); Star (2,86--2,87); + Type + (Var + (SynTypar (b, HeadType, false), + (2,88--2,90)))], (2,83--2,90)), + Var + (SynTypar (c, HeadType, false), (2,94--2,96)), + (2,83--2,96), { ArrowRange = (2,91--2,93) }), + SynValInfo + ([[SynArgInfo ([], false, None); + SynArgInfo ([], false, None)]], + SynArgInfo ([], false, None)), false, false, + PreXmlDoc ((2,56), FSharp.Compiler.Xml.XmlDocCollector), + Single None, None, (2,56--2,96), + { LeadingKeyword = + StaticMember ((2,56--2,62), (2,63--2,69)) + InlineKeyword = None + WithKeyword = None + EqualsRange = None }), + { IsInstance = false + IsDispatchSlot = false + IsOverrideOrExplicitImpl = false + IsFinal = false + GetterOrSetterIsCompilerGenerated = false + MemberKind = Member }, (2,56--2,96), + { GetSetKeywords = None }), Ident x, (2,36--2,100)), + (2,36--2,37), Some (2,99--2,100), (2,36--2,100)), + (2,11--2,33), Yes (2,0--2,100), { LeadingKeyword = Let (2,0--2,3) InlineKeyword = Some (2,4--2,10) EqualsRange = Some (2,34--2,35) })], (2,0--2,100))], diff --git a/tests/service/data/SyntaxTree/SynType/SynTypeOrInsideSynExprTraitCall.fs.bsl b/tests/service/data/SyntaxTree/SynType/SynTypeOrInsideSynExprTraitCall.fs.bsl index 24fb731523f..7bab76a4ebd 100644 --- a/tests/service/data/SyntaxTree/SynType/SynTypeOrInsideSynExprTraitCall.fs.bsl +++ b/tests/service/data/SyntaxTree/SynType/SynTypeOrInsideSynExprTraitCall.fs.bsl @@ -10,70 +10,64 @@ ImplFile (None, Normal, true, false, [], PreXmlDoc ((2,0), FSharp.Compiler.Xml.XmlDocCollector), SynValData - (None, - SynValInfo - ([[SynArgInfo ([], false, Some x)]], - SynArgInfo ([], false, None)), None), - LongIdent - (SynLongIdent - ([op_BangBang], [], - [Some - (OriginalNotationWithParen - ((2,11--2,12), "!!", (2,14--2,15)))]), None, None, - Pats - [Paren - (Typed - (Named - (SynIdent (x, None), false, None, (2,17--2,18)), - Var (SynTypar (a, HeadType, false), (2,20--2,22)), - (2,17--2,22)), (2,16--2,23))], None, (2,11--2,23)), - Some - (SynBindingReturnInfo - (Var (SynTypar (b, HeadType, false), (2,26--2,28)), - (2,26--2,28), [], { ColonRange = Some (2,24--2,25) })), + (None, SynValInfo ([], SynArgInfo ([], false, None)), None), Typed - (Paren - (TraitCall - (Paren - (Or - (Var - (SynTypar (a, HeadType, false), (2,33--2,35)), + (LongIdent + (SynLongIdent + ([op_BangBang], [], + [Some + (OriginalNotationWithParen + ((2,11--2,12), "!!", (2,14--2,15)))]), None, + None, + Pats + [Paren + (Typed + (Named + (SynIdent (x, None), false, None, + (2,17--2,18)), Var - (SynTypar (b, HeadType, false), (2,39--2,41)), - (2,33--2,41), { OrKeyword = (2,36--2,38) }), - (2,32--2,42)), - Member - (SynValSig - ([], SynIdent (op_Implicit, None), - SynValTyparDecls (None, true), - Fun - (Var - (SynTypar (a, HeadType, false), - (2,72--2,74)), - Var - (SynTypar (b, HeadType, false), - (2,78--2,80)), (2,72--2,80), - { ArrowRange = (2,75--2,77) }), - SynValInfo - ([[SynArgInfo ([], false, None)]], - SynArgInfo ([], false, None)), false, false, - PreXmlDoc ((2,45), FSharp.Compiler.Xml.XmlDocCollector), - Single None, None, (2,45--2,80), - { LeadingKeyword = - StaticMember ((2,45--2,51), (2,52--2,58)) - InlineKeyword = None - WithKeyword = None - EqualsRange = None }), - { IsInstance = false - IsDispatchSlot = false - IsOverrideOrExplicitImpl = false - IsFinal = false - GetterOrSetterIsCompilerGenerated = false - MemberKind = Member }, (2,45--2,80), - { GetSetKeywords = None }), Ident x, (2,31--2,84)), - (2,31--2,32), Some (2,83--2,84), (2,31--2,84)), + (SynTypar (a, HeadType, false), (2,20--2,22)), + (2,17--2,22)), (2,16--2,23))], None, + (2,11--2,23)), Var (SynTypar (b, HeadType, false), (2,26--2,28)), - (2,31--2,84)), (2,11--2,23), NoneAtLet, + (2,11--2,28)), None, + Paren + (TraitCall + (Paren + (Or + (Var (SynTypar (a, HeadType, false), (2,33--2,35)), + Var (SynTypar (b, HeadType, false), (2,39--2,41)), + (2,33--2,41), { OrKeyword = (2,36--2,38) }), + (2,32--2,42)), + Member + (SynValSig + ([], SynIdent (op_Implicit, None), + SynValTyparDecls (None, true), + Fun + (Var + (SynTypar (a, HeadType, false), (2,72--2,74)), + Var + (SynTypar (b, HeadType, false), (2,78--2,80)), + (2,72--2,80), { ArrowRange = (2,75--2,77) }), + SynValInfo + ([[SynArgInfo ([], false, None)]], + SynArgInfo ([], false, None)), false, false, + PreXmlDoc ((2,45), FSharp.Compiler.Xml.XmlDocCollector), + Single None, None, (2,45--2,80), + { LeadingKeyword = + StaticMember ((2,45--2,51), (2,52--2,58)) + InlineKeyword = None + WithKeyword = None + EqualsRange = None }), + { IsInstance = false + IsDispatchSlot = false + IsOverrideOrExplicitImpl = false + IsFinal = false + GetterOrSetterIsCompilerGenerated = false + MemberKind = Member }, (2,45--2,80), + { GetSetKeywords = None }), Ident x, (2,31--2,84)), + (2,31--2,32), Some (2,83--2,84), (2,31--2,84)), + (2,11--2,28), Yes (2,0--2,84), { LeadingKeyword = Let (2,0--2,3) InlineKeyword = Some (2,4--2,10) EqualsRange = Some (2,29--2,30) })], (2,0--2,84))], diff --git a/tests/service/data/SyntaxTree/SynType/SynTypeOrInsideSynTypeConstraintWhereTyparSupportsMember.fs.bsl b/tests/service/data/SyntaxTree/SynType/SynTypeOrInsideSynTypeConstraintWhereTyparSupportsMember.fs.bsl index c2de9ccff5c..819785f04f7 100644 --- a/tests/service/data/SyntaxTree/SynType/SynTypeOrInsideSynTypeConstraintWhereTyparSupportsMember.fs.bsl +++ b/tests/service/data/SyntaxTree/SynType/SynTypeOrInsideSynTypeConstraintWhereTyparSupportsMember.fs.bsl @@ -13,77 +13,72 @@ ImplFile (None, Normal, true, false, [], PreXmlDoc ((2,0), FSharp.Compiler.Xml.XmlDocCollector), SynValData - (None, SynValInfo ([[]], SynArgInfo ([], false, None)), None), - LongIdent - (SynLongIdent ([f_StaticMethod], [], [None]), None, - Some - (SynValTyparDecls - (Some - (PostfixList - ([SynTyparDecl - ([], SynTypar (T1, None, false), [], - { AmpersandRanges = [] }); - SynTyparDecl - ([], SynTypar (T2, None, false), [], - { AmpersandRanges = [] })], - [WhereTyparSupportsMember - (Paren - (Or - (Var - (SynTypar (T1, None, false), - (2,41--2,44)), - Var - (SynTypar (T2, None, false), - (2,48--2,51)), (2,41--2,51), - { OrKeyword = (2,45--2,47) }), - (2,40--2,52)), - Member - (SynValSig - ([], SynIdent (StaticMethod, None), - SynValTyparDecls (None, true), - Fun - (LongIdent - (SynLongIdent - ([int], [], [None])), - LongIdent - (SynLongIdent - ([int], [], [None])), - (2,84--2,94), - { ArrowRange = (2,88--2,90) }), - SynValInfo - ([[SynArgInfo ([], false, None)]], - SynArgInfo ([], false, None)), - false, false, - PreXmlDoc ((2,56), FSharp.Compiler.Xml.XmlDocCollector), - Single None, None, (2,56--2,94), - { LeadingKeyword = - StaticMember - ((2,56--2,62), (2,63--2,69)) - InlineKeyword = None - WithKeyword = None - EqualsRange = None }), - { IsInstance = false - IsDispatchSlot = false - IsOverrideOrExplicitImpl = false - IsFinal = false - GetterOrSetterIsCompilerGenerated = - false - MemberKind = Member }, (2,56--2,94), - { GetSetKeywords = None }), (2,40--2,95))], - (2,25--2,97))), false)), - Pats [Paren (Const (Unit, (2,97--2,99)), (2,97--2,99))], - None, (2,11--2,99)), - Some - (SynBindingReturnInfo - (LongIdent (SynLongIdent ([int], [], [None])), - (2,102--2,105), [], { ColonRange = Some (2,100--2,101) })), + (None, SynValInfo ([], SynArgInfo ([], false, None)), None), Typed - (Const (Unit, (3,4--3,6)), - LongIdent (SynLongIdent ([int], [], [None])), (3,4--3,6)), - (2,11--2,99), NoneAtLet, { LeadingKeyword = Let (2,0--2,3) - InlineKeyword = Some (2,4--2,10) - EqualsRange = Some (2,106--2,107) })], - (2,0--3,6))], PreXmlDocEmpty, [], None, (2,0--4,0), - { LeadingKeyword = None })], (true, true), - { ConditionalDirectives = [] - CodeComments = [] }, set [])) + (LongIdent + (SynLongIdent ([f_StaticMethod], [], [None]), None, + Some + (SynValTyparDecls + (Some + (PostfixList + ([SynTyparDecl + ([], SynTypar (T1, None, false), [], + { AmpersandRanges = [] }); + SynTyparDecl + ([], SynTypar (T2, None, false), [], + { AmpersandRanges = [] })], + [WhereTyparSupportsMember + (Paren + (Or + (Var + (SynTypar (T1, None, false), + (2,41--2,44)), + Var + (SynTypar (T2, None, false), + (2,48--2,51)), (2,41--2,51), + { OrKeyword = (2,45--2,47) }), + (2,40--2,52)), + Member + (SynValSig + ([], SynIdent (StaticMethod, None), + SynValTyparDecls (None, true), + Fun + (LongIdent + (SynLongIdent + ([int], [], [None])), + LongIdent + (SynLongIdent + ([int], [], [None])), + (2,84--2,94), + { ArrowRange = (2,88--2,90) }), + SynValInfo + ([[SynArgInfo ([], false, None)]], + SynArgInfo ([], false, None)), + false, false, + PreXmlDoc ((2,56), FSharp.Compiler.Xml.XmlDocCollector), + Single None, None, (2,56--2,94), + { LeadingKeyword = + StaticMember + ((2,56--2,62), (2,63--2,69)) + InlineKeyword = None + WithKeyword = None + EqualsRange = None }), + { IsInstance = false + IsDispatchSlot = false + IsOverrideOrExplicitImpl = false + IsFinal = false + GetterOrSetterIsCompilerGenerated = + false + MemberKind = Member }, (2,56--2,94), + { GetSetKeywords = None }), + (2,40--2,95))], (2,25--2,97))), false)), + Pats [Paren (Const (Unit, (2,97--2,99)), (2,97--2,99))], + None, (2,11--2,99)), + LongIdent (SynLongIdent ([int], [], [None])), (2,11--2,105)), + None, Const (Unit, (3,4--3,6)), (2,11--2,105), Yes (2,0--3,6), + { LeadingKeyword = Let (2,0--2,3) + InlineKeyword = Some (2,4--2,10) + EqualsRange = Some (2,106--2,107) })], (2,0--3,6))], + PreXmlDocEmpty, [], None, (2,0--4,0), { LeadingKeyword = None })], + (true, true), { ConditionalDirectives = [] + CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/SynType/Tuple 09.fs.bsl b/tests/service/data/SyntaxTree/SynType/Tuple 09.fs.bsl index c0d052bcc9f..3919481361b 100644 --- a/tests/service/data/SyntaxTree/SynType/Tuple 09.fs.bsl +++ b/tests/service/data/SyntaxTree/SynType/Tuple 09.fs.bsl @@ -10,20 +10,8 @@ ImplFile PreXmlDoc ((3,0), FSharp.Compiler.Xml.XmlDocCollector), SynValData (None, SynValInfo ([], SynArgInfo ([], false, None)), None), - Wild (3,4--3,5), - Some - (SynBindingReturnInfo - (Fun - (LongIdent (SynLongIdent ([a], [], [None])), - Tuple - (false, - [Type (LongIdent (SynLongIdent ([b], [], [None]))); - Star (3,14--3,15); - Type (FromParseError (3,15--3,15))], (3,12--3,15)), - (3,7--3,17), { ArrowRange = (3,9--3,11) }), - (3,7--3,17), [], { ColonRange = Some (3,5--3,6) })), Typed - (Const (Unit, (3,18--3,20)), + (Wild (3,4--3,5), Fun (LongIdent (SynLongIdent ([a], [], [None])), Tuple @@ -31,8 +19,8 @@ ImplFile [Type (LongIdent (SynLongIdent ([b], [], [None]))); Star (3,14--3,15); Type (FromParseError (3,15--3,15))], (3,12--3,15)), - (3,7--3,17), { ArrowRange = (3,9--3,11) }), (3,18--3,20)), - (3,4--3,5), Yes (3,0--3,20), + (3,7--3,15), { ArrowRange = (3,9--3,11) }), (3,4--3,17)), + None, Const (Unit, (3,18--3,20)), (3,4--3,17), Yes (3,0--3,20), { LeadingKeyword = Let (3,0--3,3) InlineKeyword = None EqualsRange = Some (3,16--3,17) })], (3,0--3,20))], @@ -41,4 +29,4 @@ ImplFile { ConditionalDirectives = [] CodeComments = [] }, set [])) -(3,16)-(3,17) parse error Unexpected symbol '=' in binding +(3,16)-(3,17) parse error Unexpected symbol '=' in type diff --git a/tests/service/data/SyntaxTree/SynType/Tuple 10.fs.bsl b/tests/service/data/SyntaxTree/SynType/Tuple 10.fs.bsl index dc553f72214..0b69f2e2e17 100644 --- a/tests/service/data/SyntaxTree/SynType/Tuple 10.fs.bsl +++ b/tests/service/data/SyntaxTree/SynType/Tuple 10.fs.bsl @@ -10,20 +10,8 @@ ImplFile PreXmlDoc ((3,0), FSharp.Compiler.Xml.XmlDocCollector), SynValData (None, SynValInfo ([], SynArgInfo ([], false, None)), None), - Wild (3,4--3,5), - Some - (SynBindingReturnInfo - (Fun - (Tuple - (false, - [Type (LongIdent (SynLongIdent ([a], [], [None]))); - Star (3,9--3,10); - Type (FromParseError (3,10--3,10))], (3,7--3,10)), - LongIdent (SynLongIdent ([b], [], [None])), - (3,7--3,15), { ArrowRange = (3,11--3,13) }), - (3,7--3,15), [], { ColonRange = Some (3,5--3,6) })), Typed - (Const (Unit, (3,18--3,20)), + (Wild (3,4--3,5), Fun (Tuple (false, @@ -31,8 +19,8 @@ ImplFile Star (3,9--3,10); Type (FromParseError (3,10--3,10))], (3,7--3,10)), LongIdent (SynLongIdent ([b], [], [None])), (3,7--3,15), - { ArrowRange = (3,11--3,13) }), (3,18--3,20)), - (3,4--3,5), Yes (3,0--3,20), + { ArrowRange = (3,11--3,13) }), (3,4--3,15)), None, + Const (Unit, (3,18--3,20)), (3,4--3,15), Yes (3,0--3,20), { LeadingKeyword = Let (3,0--3,3) InlineKeyword = None EqualsRange = Some (3,16--3,17) })], (3,0--3,20))], @@ -41,4 +29,4 @@ ImplFile { ConditionalDirectives = [] CodeComments = [] }, set [])) -(3,11)-(3,13) parse error Unexpected symbol '->' in binding +(3,11)-(3,13) parse error Unexpected symbol '->' in type diff --git a/tests/service/data/SyntaxTree/SynType/Tuple 11.fs.bsl b/tests/service/data/SyntaxTree/SynType/Tuple 11.fs.bsl index 31ca0e7d595..14e28ee0708 100644 --- a/tests/service/data/SyntaxTree/SynType/Tuple 11.fs.bsl +++ b/tests/service/data/SyntaxTree/SynType/Tuple 11.fs.bsl @@ -10,24 +10,8 @@ ImplFile PreXmlDoc ((3,0), FSharp.Compiler.Xml.XmlDocCollector), SynValData (None, SynValInfo ([], SynArgInfo ([], false, None)), None), - Wild (3,4--3,5), - Some - (SynBindingReturnInfo - (Fun - (LongIdent (SynLongIdent ([a], [], [None])), - Tuple - (false, - [Type - (LongIdent (SynLongIdent ([b1], [], [None]))); - Star (3,15--3,16); - Type - (LongIdent (SynLongIdent ([b2], [], [None]))); - Star (3,20--3,21); - Type (FromParseError (3,21--3,21))], (3,12--3,21)), - (3,7--3,23), { ArrowRange = (3,9--3,11) }), - (3,7--3,23), [], { ColonRange = Some (3,5--3,6) })), Typed - (Const (Unit, (3,24--3,26)), + (Wild (3,4--3,5), Fun (LongIdent (SynLongIdent ([a], [], [None])), Tuple @@ -37,8 +21,8 @@ ImplFile Type (LongIdent (SynLongIdent ([b2], [], [None]))); Star (3,20--3,21); Type (FromParseError (3,21--3,21))], (3,12--3,21)), - (3,7--3,23), { ArrowRange = (3,9--3,11) }), (3,24--3,26)), - (3,4--3,5), Yes (3,0--3,26), + (3,7--3,21), { ArrowRange = (3,9--3,11) }), (3,4--3,23)), + None, Const (Unit, (3,24--3,26)), (3,4--3,23), Yes (3,0--3,26), { LeadingKeyword = Let (3,0--3,3) InlineKeyword = None EqualsRange = Some (3,22--3,23) })], (3,0--3,26))], @@ -47,4 +31,4 @@ ImplFile { ConditionalDirectives = [] CodeComments = [] }, set [])) -(3,22)-(3,23) parse error Unexpected symbol '=' in binding +(3,22)-(3,23) parse error Unexpected symbol '=' in type diff --git a/tests/service/data/SyntaxTree/SynType/Tuple 12.fs.bsl b/tests/service/data/SyntaxTree/SynType/Tuple 12.fs.bsl index 48dd1654f53..757f5161842 100644 --- a/tests/service/data/SyntaxTree/SynType/Tuple 12.fs.bsl +++ b/tests/service/data/SyntaxTree/SynType/Tuple 12.fs.bsl @@ -10,24 +10,8 @@ ImplFile PreXmlDoc ((3,0), FSharp.Compiler.Xml.XmlDocCollector), SynValData (None, SynValInfo ([], SynArgInfo ([], false, None)), None), - Wild (3,4--3,5), - Some - (SynBindingReturnInfo - (Fun - (Tuple - (false, - [Type - (LongIdent (SynLongIdent ([a1], [], [None]))); - Star (3,10--3,11); - Type - (LongIdent (SynLongIdent ([a2], [], [None]))); - Star (3,15--3,16); - Type (FromParseError (3,16--3,16))], (3,7--3,16)), - LongIdent (SynLongIdent ([b], [], [None])), - (3,7--3,21), { ArrowRange = (3,17--3,19) }), - (3,7--3,21), [], { ColonRange = Some (3,5--3,6) })), Typed - (Const (Unit, (3,24--3,26)), + (Wild (3,4--3,5), Fun (Tuple (false, @@ -37,8 +21,8 @@ ImplFile Star (3,15--3,16); Type (FromParseError (3,16--3,16))], (3,7--3,16)), LongIdent (SynLongIdent ([b], [], [None])), (3,7--3,21), - { ArrowRange = (3,17--3,19) }), (3,24--3,26)), - (3,4--3,5), Yes (3,0--3,26), + { ArrowRange = (3,17--3,19) }), (3,4--3,21)), None, + Const (Unit, (3,24--3,26)), (3,4--3,21), Yes (3,0--3,26), { LeadingKeyword = Let (3,0--3,3) InlineKeyword = None EqualsRange = Some (3,22--3,23) })], (3,0--3,26))], @@ -47,4 +31,4 @@ ImplFile { ConditionalDirectives = [] CodeComments = [] }, set [])) -(3,17)-(3,19) parse error Unexpected symbol '->' in binding +(3,17)-(3,19) parse error Unexpected symbol '->' in type diff --git a/tests/service/data/SyntaxTree/SynType/Tuple 13.fs.bsl b/tests/service/data/SyntaxTree/SynType/Tuple 13.fs.bsl index 1c4baa1ad5b..d9a2d48e118 100644 --- a/tests/service/data/SyntaxTree/SynType/Tuple 13.fs.bsl +++ b/tests/service/data/SyntaxTree/SynType/Tuple 13.fs.bsl @@ -10,25 +10,8 @@ ImplFile PreXmlDoc ((3,0), FSharp.Compiler.Xml.XmlDocCollector), SynValData (None, SynValInfo ([], SynArgInfo ([], false, None)), None), - Wild (3,4--3,5), - Some - (SynBindingReturnInfo - (Fun - (LongIdent (SynLongIdent ([a], [], [None])), - Tuple - (false, - [Type - (LongIdent (SynLongIdent ([b1], [], [None]))); - Star (3,15--3,16); - Type (FromParseError (3,18--3,18)); - Star (3,17--3,18); - Type - (LongIdent (SynLongIdent ([b3], [], [None])))], - (3,12--3,21)), (3,7--3,21), - { ArrowRange = (3,9--3,11) }), (3,7--3,21), [], - { ColonRange = Some (3,5--3,6) })), Typed - (Const (Unit, (3,24--3,26)), + (Wild (3,4--3,5), Fun (LongIdent (SynLongIdent ([a], [], [None])), Tuple @@ -39,11 +22,11 @@ ImplFile Star (3,17--3,18); Type (LongIdent (SynLongIdent ([b3], [], [None])))], (3,12--3,21)), (3,7--3,21), - { ArrowRange = (3,9--3,11) }), (3,24--3,26)), (3,4--3,5), - Yes (3,0--3,26), { LeadingKeyword = Let (3,0--3,3) - InlineKeyword = None - EqualsRange = Some (3,22--3,23) })], - (3,0--3,26))], + { ArrowRange = (3,9--3,11) }), (3,4--3,21)), None, + Const (Unit, (3,24--3,26)), (3,4--3,21), Yes (3,0--3,26), + { LeadingKeyword = Let (3,0--3,3) + InlineKeyword = None + EqualsRange = Some (3,22--3,23) })], (3,0--3,26))], PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, (1,0--3,26), { LeadingKeyword = Module (1,0--1,6) })], (true, true), { ConditionalDirectives = [] diff --git a/tests/service/data/SyntaxTree/SynType/Tuple 14.fs.bsl b/tests/service/data/SyntaxTree/SynType/Tuple 14.fs.bsl index 8f40539042b..04184c9e3de 100644 --- a/tests/service/data/SyntaxTree/SynType/Tuple 14.fs.bsl +++ b/tests/service/data/SyntaxTree/SynType/Tuple 14.fs.bsl @@ -10,25 +10,8 @@ ImplFile PreXmlDoc ((3,0), FSharp.Compiler.Xml.XmlDocCollector), SynValData (None, SynValInfo ([], SynArgInfo ([], false, None)), None), - Wild (3,4--3,5), - Some - (SynBindingReturnInfo - (Fun - (Tuple - (false, - [Type - (LongIdent (SynLongIdent ([a1], [], [None]))); - Star (3,10--3,11); - Type (FromParseError (3,13--3,13)); - Star (3,12--3,13); - Type - (LongIdent (SynLongIdent ([a3], [], [None])))], - (3,7--3,16)), - LongIdent (SynLongIdent ([b], [], [None])), - (3,7--3,21), { ArrowRange = (3,17--3,19) }), - (3,7--3,21), [], { ColonRange = Some (3,5--3,6) })), Typed - (Const (Unit, (3,24--3,26)), + (Wild (3,4--3,5), Fun (Tuple (false, @@ -39,8 +22,8 @@ ImplFile Type (LongIdent (SynLongIdent ([a3], [], [None])))], (3,7--3,16)), LongIdent (SynLongIdent ([b], [], [None])), (3,7--3,21), - { ArrowRange = (3,17--3,19) }), (3,24--3,26)), - (3,4--3,5), Yes (3,0--3,26), + { ArrowRange = (3,17--3,19) }), (3,4--3,21)), None, + Const (Unit, (3,24--3,26)), (3,4--3,21), Yes (3,0--3,26), { LeadingKeyword = Let (3,0--3,3) InlineKeyword = None EqualsRange = Some (3,22--3,23) })], (3,0--3,26))], diff --git a/tests/service/data/SyntaxTree/Type/SynTypeTupleWithStruct.fs.bsl b/tests/service/data/SyntaxTree/Type/SynTypeTupleWithStruct.fs.bsl index e0f51c6ee46..f3d4dde38cf 100644 --- a/tests/service/data/SyntaxTree/Type/SynTypeTupleWithStruct.fs.bsl +++ b/tests/service/data/SyntaxTree/Type/SynTypeTupleWithStruct.fs.bsl @@ -11,24 +11,15 @@ ImplFile PreXmlDoc ((2,0), FSharp.Compiler.Xml.XmlDocCollector), SynValData (None, SynValInfo ([], SynArgInfo ([], false, None)), None), - Wild (2,4--2,5), - Some - (SynBindingReturnInfo - (Tuple - (true, - [Type (LongIdent (SynLongIdent ([int], [], [None]))); - Star (2,19--2,20); - Type (LongIdent (SynLongIdent ([int], [], [None])))], - (2,7--2,25)), (2,7--2,25), [], - { ColonRange = Some (2,5--2,6) })), Typed - (Const (Unit, (2,28--2,30)), + (Wild (2,4--2,5), Tuple (true, [Type (LongIdent (SynLongIdent ([int], [], [None]))); Star (2,19--2,20); Type (LongIdent (SynLongIdent ([int], [], [None])))], - (2,7--2,25)), (2,28--2,30)), (2,4--2,5), Yes (2,0--2,30), + (2,7--2,25)), (2,4--2,25)), None, + Const (Unit, (2,28--2,30)), (2,4--2,25), Yes (2,0--2,30), { LeadingKeyword = Let (2,0--2,3) InlineKeyword = None EqualsRange = Some (2,26--2,27) })], (2,0--2,30))], diff --git a/tests/service/data/SyntaxTree/Type/SynTypeTupleWithStructRecovery.fs.bsl b/tests/service/data/SyntaxTree/Type/SynTypeTupleWithStructRecovery.fs.bsl index c69d94938c8..20330c0d8dc 100644 --- a/tests/service/data/SyntaxTree/Type/SynTypeTupleWithStructRecovery.fs.bsl +++ b/tests/service/data/SyntaxTree/Type/SynTypeTupleWithStructRecovery.fs.bsl @@ -11,24 +11,15 @@ ImplFile PreXmlDoc ((2,0), FSharp.Compiler.Xml.XmlDocCollector), SynValData (None, SynValInfo ([], SynArgInfo ([], false, None)), None), - Wild (2,4--2,5), - Some - (SynBindingReturnInfo - (Tuple - (true, - [Type (LongIdent (SynLongIdent ([int], [], [None]))); - Star (2,19--2,20); - Type (LongIdent (SynLongIdent ([int], [], [None])))], - (2,7--2,24)), (2,7--2,26), [], - { ColonRange = Some (2,5--2,6) })), Typed - (Const (Unit, (2,27--2,29)), + (Wild (2,4--2,5), Tuple (true, [Type (LongIdent (SynLongIdent ([int], [], [None]))); Star (2,19--2,20); Type (LongIdent (SynLongIdent ([int], [], [None])))], - (2,7--2,24)), (2,27--2,29)), (2,4--2,5), Yes (2,0--2,29), + (2,7--2,24)), (2,4--2,26)), None, + Const (Unit, (2,27--2,29)), (2,4--2,26), Yes (2,0--2,29), { LeadingKeyword = Let (2,0--2,3) InlineKeyword = None EqualsRange = Some (2,25--2,26) })], (2,0--2,29))], From 4e00653da6c6c14daf4ff57c5c191dc289776bb3 Mon Sep 17 00:00:00 2001 From: Edgar Gonzalez Date: Sat, 26 Apr 2025 09:21:16 +0100 Subject: [PATCH 04/26] try update mkSynMemberDefnGetSet --- src/Compiler/SyntaxTree/ParseHelpers.fs | 26 ++++++++----------------- 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/src/Compiler/SyntaxTree/ParseHelpers.fs b/src/Compiler/SyntaxTree/ParseHelpers.fs index a8a8724f58b..7ee76c4b92e 100644 --- a/src/Compiler/SyntaxTree/ParseHelpers.fs +++ b/src/Compiler/SyntaxTree/ParseHelpers.fs @@ -354,20 +354,11 @@ let mkSynMemberDefnGetSet | None -> None | Some memberKind -> - // REVIEW: It's hard not to ignore the optPropertyType type annotation for 'set' properties. To apply it, - // we should apply it to the last argument, but at this point we've already pushed the patterns that - // make up the arguments onto the RHS. So we just always give a warning. - - (match optPropertyType with - | Some _ -> errorR (Error(FSComp.SR.parsTypeAnnotationsOnGetSet (), mBindLhs)) - | None -> ()) - + // Ensure we prioritize the explicit return type on the accessor if present let optReturnType = - match (memberKind, optReturnType) with - | SynMemberKind.PropertySet, _ -> optReturnType - | _, None -> optPropertyType - | _ -> optReturnType - + match optReturnType with + | Some _ -> optReturnType // Use accessor's explicit return type if provided + | None -> optPropertyType // Otherwise fall back to property type // REDO with the correct member kind let binding = mkSynBinding @@ -405,10 +396,6 @@ let mkSynMemberDefnGetSet | _ -> SynInfo.unnamedTopArg match memberKind, valSynInfo, memFlags.IsInstance with - | SynMemberKind.PropertyGet, SynValInfo([], _ret), false - | SynMemberKind.PropertyGet, SynValInfo([ _ ], _ret), true -> - raiseParseErrorAt mWholeBindLhs (FSComp.SR.parsGetterMustHaveAtLeastOneArgument ()) - | SynMemberKind.PropertyGet, SynValInfo(thisArg :: indexOrUnitArgs :: rest, ret), true -> if not rest.IsEmpty then reportParseErrorAt mWholeBindLhs (FSComp.SR.parsGetterAtMostOneArgument ()) @@ -437,7 +424,10 @@ let mkSynMemberDefnGetSet reportParseErrorAt mWholeBindLhs (FSComp.SR.parsSetterAtMostTwoArguments ()) SynValInfo([ indexArgs @ adjustValueArg valueArg ], ret) - + // For getters and setters with explicit return types or other patterns + // that don't match earlier cases, use valInfo as is + | SynMemberKind.PropertyGet, valInfo, _ + | SynMemberKind.PropertySet, valInfo, _ -> valInfo | _ -> // should be unreachable, cover just in case raiseParseErrorAt mWholeBindLhs (FSComp.SR.parsInvalidProperty ()) From b223cd4eb5ae569e814cde2c6b06fb584f5dd795 Mon Sep 17 00:00:00 2001 From: Edgar Gonzalez Date: Sat, 26 Apr 2025 09:38:50 +0100 Subject: [PATCH 05/26] format code --- src/Compiler/SyntaxTree/ParseHelpers.fs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Compiler/SyntaxTree/ParseHelpers.fs b/src/Compiler/SyntaxTree/ParseHelpers.fs index 7ee76c4b92e..ffe11eea48c 100644 --- a/src/Compiler/SyntaxTree/ParseHelpers.fs +++ b/src/Compiler/SyntaxTree/ParseHelpers.fs @@ -357,8 +357,8 @@ let mkSynMemberDefnGetSet // Ensure we prioritize the explicit return type on the accessor if present let optReturnType = match optReturnType with - | Some _ -> optReturnType // Use accessor's explicit return type if provided - | None -> optPropertyType // Otherwise fall back to property type + | Some _ -> optReturnType // Use accessor's explicit return type if provided + | None -> optPropertyType // Otherwise fall back to property type // REDO with the correct member kind let binding = mkSynBinding @@ -427,7 +427,7 @@ let mkSynMemberDefnGetSet // For getters and setters with explicit return types or other patterns // that don't match earlier cases, use valInfo as is | SynMemberKind.PropertyGet, valInfo, _ - | SynMemberKind.PropertySet, valInfo, _ -> valInfo + | SynMemberKind.PropertySet, valInfo, _ -> valInfo | _ -> // should be unreachable, cover just in case raiseParseErrorAt mWholeBindLhs (FSComp.SR.parsInvalidProperty ()) From 7c592a8899cd3e8b0d1904fee5520155a6169ef5 Mon Sep 17 00:00:00 2001 From: Edgar Gonzalez Date: Sat, 26 Apr 2025 16:21:50 +0100 Subject: [PATCH 06/26] try different parser rule --- src/Compiler/pars.fsy | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/Compiler/pars.fsy b/src/Compiler/pars.fsy index b1297754683..28a114e2d51 100644 --- a/src/Compiler/pars.fsy +++ b/src/Compiler/pars.fsy @@ -4448,6 +4448,18 @@ declExpr: let trivia: SynExprLetOrUseBangTrivia = { LetOrUseBangKeyword = rhs parseState 1 ; EqualsRange = Some mEquals } SynExpr.LetOrUseBang(spBind, ($1 = "use"), true, $2, $4, $7, $8, m, trivia) } + | BINDER atomicPatternLongIdent COLON typeWithTypeConstraints EQUALS typedSequentialExprBlock IN opt_OBLOCKSEP moreBinders typedSequentialExprBlock %prec expr_let + { + // Handle type annotations on simple identifier patterns in let!/use! bindings + let spBind = DebugPointAtBinding.Yes(rhs2 parseState 1 7) + let vis, lidwd = $2 + let pat = mkSynPatMaybeVar lidwd vis (rhs parseState 2) + let pat = SynPat.Typed(pat, $4, unionRanges pat.Range $4.Range) + let mEquals = rhs parseState 5 + let m = unionRanges (rhs parseState 1) $10.Range + let trivia: SynExprLetOrUseBangTrivia = { LetOrUseBangKeyword = rhs parseState 1 ; EqualsRange = Some mEquals } + SynExpr.LetOrUseBang(spBind, ($1 = "use"), true, pat, $6, $9, $10, m, trivia) } + | OBINDER headBindingPattern EQUALS typedSequentialExprBlock hardwhiteDefnBindingsTerminator opt_OBLOCKSEP moreBinders typedSequentialExprBlock %prec expr_let { let report, mIn, _ = $5 report (if $1 = "use" then "use!" else "let!") (rhs parseState 1) // report unterminated error @@ -4457,6 +4469,20 @@ declExpr: let trivia: SynExprLetOrUseBangTrivia = { LetOrUseBangKeyword = rhs parseState 1 ; EqualsRange = Some mEquals } SynExpr.LetOrUseBang(spBind, ($1 = "use"), true, $2, $4, $7, $8, m, trivia) } + | OBINDER atomicPatternLongIdent COLON typeWithTypeConstraints EQUALS typedSequentialExprBlock hardwhiteDefnBindingsTerminator opt_OBLOCKSEP moreBinders typedSequentialExprBlock %prec expr_let + { + // Handle type annotations on simple identifier patterns in let!/use! bindings (offside-sensitive version) + let report, mIn, _ = $7 + report (if $1 = "use" then "use!" else "let!") (rhs parseState 1) // report unterminated error + let spBind = DebugPointAtBinding.Yes(unionRanges (rhs parseState 1) $6.Range) + let vis, lidwd = $2 + let pat = mkSynPatMaybeVar lidwd vis (rhs parseState 2) + let pat = SynPat.Typed(pat, $4, unionRanges pat.Range $4.Range) + let mEquals = rhs parseState 5 + let m = unionRanges (rhs parseState 1) $10.Range + let trivia: SynExprLetOrUseBangTrivia = { LetOrUseBangKeyword = rhs parseState 1 ; EqualsRange = Some mEquals } + SynExpr.LetOrUseBang(spBind, ($1 = "use"), true, pat, $6, $9, $10, m, trivia) } + | OBINDER headBindingPattern EQUALS typedSequentialExprBlock hardwhiteDefnBindingsTerminator opt_OBLOCKSEP error %prec expr_let { // error recovery that allows intellisense when writing incomplete computation expressions let spBind = DebugPointAtBinding.Yes(unionRanges (rhs parseState 1) $4.Range) From e3f7b8ca2ada473459ab12a20f5b3bee5c4a7c3d Mon Sep 17 00:00:00 2001 From: Edgar Gonzalez Date: Sat, 26 Apr 2025 16:22:05 +0100 Subject: [PATCH 07/26] Add new test --- .../Language/ComputationExpressionTests.fs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/FSharp.Compiler.ComponentTests/Language/ComputationExpressionTests.fs b/tests/FSharp.Compiler.ComponentTests/Language/ComputationExpressionTests.fs index 6b0a260a42f..ff364d6c18a 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/ComputationExpressionTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/ComputationExpressionTests.fs @@ -22,6 +22,21 @@ let x = lb {1; 2;} |> compile |> shouldSucceed |> ignore + + [] + let ``Allow let! and use! binding with type annotation without parentheses.``() = + FSharp """ +module ComputationExpressionTests +let f = + async { + let! (a: int) = async { return 1 } + let! b: int = async { return 1 } + return a + } + """ + |> typecheck + |> shouldSucceed + |> ignore [] let ``A CE explicitly using Zero fails without a defined Zero``() = From 43e9ea285699c7abfb3ab5a08c9204b487af1548 Mon Sep 17 00:00:00 2001 From: Edgar Gonzalez Date: Sat, 26 Apr 2025 16:22:23 +0100 Subject: [PATCH 08/26] Revert "new parser production rule." This reverts commit c4b40cb9bf806ea5cf5a956103721224c90d8362. --- src/Compiler/pars.fsy | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/Compiler/pars.fsy b/src/Compiler/pars.fsy index 28a114e2d51..b6b3cb209dc 100644 --- a/src/Compiler/pars.fsy +++ b/src/Compiler/pars.fsy @@ -3574,17 +3574,6 @@ headBindingPattern: let pat2 = SynPat.Wild(mColonColon.EndRange) SynPat.ListCons($1, pat2, rhs2 parseState 1 2, { ColonColonRange = mColonColon }) } - | headBindingPattern COLON typeWithTypeConstraints %prec paren_pat_colon - { let mLhs = lhs parseState - SynPat.Typed($1, $3, mLhs) } - - | headBindingPattern COLON recover - { let mColon = rhs parseState 2 - if not $3 then - reportParseErrorAt mColon (FSComp.SR.parsExpectingPattern ()) - let ty = SynType.FromParseError(mColon.EndRange) - SynPat.Typed($1, ty, lhs parseState) } - | tuplePatternElements %prec pat_tuple { let pats, commas = $1 let pats, commas = normalizeTuplePat pats commas From b26be8b8b4ce84f97a19c86b6f497cf27b004ea6 Mon Sep 17 00:00:00 2001 From: Edgar Gonzalez Date: Sat, 26 Apr 2025 16:23:07 +0100 Subject: [PATCH 09/26] Revert "try update mkSynMemberDefnGetSet" This reverts commit 4e00653da6c6c14daf4ff57c5c191dc289776bb3. # Conflicts: # src/Compiler/SyntaxTree/ParseHelpers.fs --- src/Compiler/SyntaxTree/ParseHelpers.fs | 26 +++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/src/Compiler/SyntaxTree/ParseHelpers.fs b/src/Compiler/SyntaxTree/ParseHelpers.fs index ffe11eea48c..a8a8724f58b 100644 --- a/src/Compiler/SyntaxTree/ParseHelpers.fs +++ b/src/Compiler/SyntaxTree/ParseHelpers.fs @@ -354,11 +354,20 @@ let mkSynMemberDefnGetSet | None -> None | Some memberKind -> - // Ensure we prioritize the explicit return type on the accessor if present + // REVIEW: It's hard not to ignore the optPropertyType type annotation for 'set' properties. To apply it, + // we should apply it to the last argument, but at this point we've already pushed the patterns that + // make up the arguments onto the RHS. So we just always give a warning. + + (match optPropertyType with + | Some _ -> errorR (Error(FSComp.SR.parsTypeAnnotationsOnGetSet (), mBindLhs)) + | None -> ()) + let optReturnType = - match optReturnType with - | Some _ -> optReturnType // Use accessor's explicit return type if provided - | None -> optPropertyType // Otherwise fall back to property type + match (memberKind, optReturnType) with + | SynMemberKind.PropertySet, _ -> optReturnType + | _, None -> optPropertyType + | _ -> optReturnType + // REDO with the correct member kind let binding = mkSynBinding @@ -396,6 +405,10 @@ let mkSynMemberDefnGetSet | _ -> SynInfo.unnamedTopArg match memberKind, valSynInfo, memFlags.IsInstance with + | SynMemberKind.PropertyGet, SynValInfo([], _ret), false + | SynMemberKind.PropertyGet, SynValInfo([ _ ], _ret), true -> + raiseParseErrorAt mWholeBindLhs (FSComp.SR.parsGetterMustHaveAtLeastOneArgument ()) + | SynMemberKind.PropertyGet, SynValInfo(thisArg :: indexOrUnitArgs :: rest, ret), true -> if not rest.IsEmpty then reportParseErrorAt mWholeBindLhs (FSComp.SR.parsGetterAtMostOneArgument ()) @@ -424,10 +437,7 @@ let mkSynMemberDefnGetSet reportParseErrorAt mWholeBindLhs (FSComp.SR.parsSetterAtMostTwoArguments ()) SynValInfo([ indexArgs @ adjustValueArg valueArg ], ret) - // For getters and setters with explicit return types or other patterns - // that don't match earlier cases, use valInfo as is - | SynMemberKind.PropertyGet, valInfo, _ - | SynMemberKind.PropertySet, valInfo, _ -> valInfo + | _ -> // should be unreachable, cover just in case raiseParseErrorAt mWholeBindLhs (FSComp.SR.parsInvalidProperty ()) From cbe3d48a466c23c39e6f3b5822edf63ff911e3f9 Mon Sep 17 00:00:00 2001 From: Edgar Gonzalez Date: Sat, 26 Apr 2025 16:26:29 +0100 Subject: [PATCH 10/26] Revert "Update existing syntax tree tests" This reverts commit be13fe03113ca727938f75f2d7eecf0038f044bd. --- ...ColonBeforeReturnTypeIsPartOfTrivia.fs.bsl | 44 ++--- ...eturnTypeIsPartOfTriviaInProperties.fs.bsl | 68 ++++---- ...ouldBePresentInLocalLetBindingTyped.fs.bsl | 11 +- ...resentInMemberBindingWithReturnType.fs.bsl | 26 +-- ...esentInSynModuleDeclLetBindingTyped.fs.bsl | 24 +-- ...turnTypeOfBindingShouldContainStars.fs.bsl | 66 ++++--- .../LeadingKeyword/OverrideKeyword.fs.bsl | 20 ++- .../LeadingKeyword/StaticMemberKeyword.fs.bsl | 16 +- .../data/SyntaxTree/Member/Member 08.fs.bsl | 24 ++- .../data/SyntaxTree/Member/Member 13.fs.bsl | 24 +-- .../SynTypeDefnWithMemberWithSetget.fs.bsl | 68 ++++---- .../Module - Attribute 01.fs.bsl | 11 +- ...ericFunctionReturnTypeNotStructNull.fs.bsl | 24 ++- .../SyntaxTree/Nullness/IntListOrNull.fs.bsl | 16 +- .../Nullness/IntListOrNullOrNullOrNull.fs.bsl | 47 ++--- .../Nullness/NullAnnotatedExpression.fs.bsl | 35 +++- .../SyntaxTree/Nullness/StringOrNull.fs.bsl | 13 +- .../Pattern/Typed - Missing type 01.fs.bsl | 16 +- .../Pattern/Typed - Missing type 02.fs.bsl | 10 +- .../Pattern/Typed - Missing type 05.fs.bsl | 24 +-- .../Pattern/Typed - Missing type 06.fs.bsl | 17 +- .../data/SyntaxTree/SynType/Fun 06.fs.bsl | 20 ++- .../data/SyntaxTree/SynType/Fun 07.fs.bsl | 17 +- .../data/SyntaxTree/SynType/Fun 08.fs.bsl | 24 ++- .../data/SyntaxTree/SynType/Fun 09.fs.bsl | 29 +++- .../data/SyntaxTree/SynType/Fun 10.fs.bsl | 27 +-- ...stedSynTypeOrInsideSynExprTraitCall.fs.bsl | 161 +++++++++--------- .../SynTypeOrInsideSynExprTraitCall.fs.bsl | 116 +++++++------ ...eConstraintWhereTyparSupportsMember.fs.bsl | 141 +++++++-------- .../data/SyntaxTree/SynType/Tuple 09.fs.bsl | 20 ++- .../data/SyntaxTree/SynType/Tuple 10.fs.bsl | 20 ++- .../data/SyntaxTree/SynType/Tuple 11.fs.bsl | 24 ++- .../data/SyntaxTree/SynType/Tuple 12.fs.bsl | 24 ++- .../data/SyntaxTree/SynType/Tuple 13.fs.bsl | 29 +++- .../data/SyntaxTree/SynType/Tuple 14.fs.bsl | 23 ++- .../Type/SynTypeTupleWithStruct.fs.bsl | 15 +- .../SynTypeTupleWithStructRecovery.fs.bsl | 15 +- 37 files changed, 823 insertions(+), 486 deletions(-) diff --git a/tests/service/data/SyntaxTree/Binding/ColonBeforeReturnTypeIsPartOfTrivia.fs.bsl b/tests/service/data/SyntaxTree/Binding/ColonBeforeReturnTypeIsPartOfTrivia.fs.bsl index 5830bfbd85e..17fea8f0a33 100644 --- a/tests/service/data/SyntaxTree/Binding/ColonBeforeReturnTypeIsPartOfTrivia.fs.bsl +++ b/tests/service/data/SyntaxTree/Binding/ColonBeforeReturnTypeIsPartOfTrivia.fs.bsl @@ -10,23 +10,29 @@ ImplFile (None, Normal, false, false, [], PreXmlDoc ((2,0), FSharp.Compiler.Xml.XmlDocCollector), SynValData - (None, SynValInfo ([], SynArgInfo ([], false, None)), None), + (None, + SynValInfo + ([[SynArgInfo ([], false, Some y)]], + SynArgInfo ([], false, None)), None), + LongIdent + (SynLongIdent ([x], [], [None]), None, None, + Pats [Named (SynIdent (y, None), false, None, (2,6--2,7))], + None, (2,4--2,7)), + Some + (SynBindingReturnInfo + (LongIdent (SynLongIdent ([int], [], [None])), + (2,10--2,13), [], { ColonRange = Some (2,8--2,9) })), Typed - (LongIdent - (SynLongIdent ([x], [], [None]), None, None, - Pats - [Named (SynIdent (y, None), false, None, (2,6--2,7))], - None, (2,4--2,7)), - LongIdent (SynLongIdent ([int], [], [None])), (2,4--2,13)), - None, - App - (NonAtomic, false, Ident failwith, - Const - (String ("todo", Regular, (2,25--2,31)), (2,25--2,31)), - (2,16--2,31)), (2,4--2,13), Yes (2,0--2,31), - { LeadingKeyword = Let (2,0--2,3) - InlineKeyword = None - EqualsRange = Some (2,14--2,15) })], (2,0--2,31))], - PreXmlDocEmpty, [], None, (2,0--3,0), { LeadingKeyword = None })], - (true, true), { ConditionalDirectives = [] - CodeComments = [] }, set [])) + (App + (NonAtomic, false, Ident failwith, + Const + (String ("todo", Regular, (2,25--2,31)), (2,25--2,31)), + (2,16--2,31)), + LongIdent (SynLongIdent ([int], [], [None])), (2,16--2,31)), + (2,4--2,7), NoneAtLet, { LeadingKeyword = Let (2,0--2,3) + InlineKeyword = None + EqualsRange = Some (2,14--2,15) })], + (2,0--2,31))], PreXmlDocEmpty, [], None, (2,0--3,0), + { LeadingKeyword = None })], (true, true), + { ConditionalDirectives = [] + CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/Binding/ColonBeforeReturnTypeIsPartOfTriviaInProperties.fs.bsl b/tests/service/data/SyntaxTree/Binding/ColonBeforeReturnTypeIsPartOfTriviaInProperties.fs.bsl index 70e6949f11f..dd5022f2bc2 100644 --- a/tests/service/data/SyntaxTree/Binding/ColonBeforeReturnTypeIsPartOfTriviaInProperties.fs.bsl +++ b/tests/service/data/SyntaxTree/Binding/ColonBeforeReturnTypeIsPartOfTriviaInProperties.fs.bsl @@ -28,21 +28,26 @@ ImplFile GetterOrSetterIsCompilerGenerated = false MemberKind = PropertyGet }, SynValInfo - ([[SynArgInfo ([], false, None)]], + ([[SynArgInfo ([], false, None)]; []], SynArgInfo ([], false, None)), None), + LongIdent + (SynLongIdent + ([this; Y], [(3,15--3,16)], [None; None]), + Some get, None, + Pats + [Paren + (Const (Unit, (3,26--3,28)), (3,26--3,28))], + None, (3,23--3,28)), + Some + (SynBindingReturnInfo + (LongIdent + (SynLongIdent ([int], [], [None])), + (3,29--3,32), [], + { ColonRange = Some (3,28--3,29) })), Typed - (LongIdent - (SynLongIdent - ([this; Y], [(3,15--3,16)], [None; None]), - Some get, None, - Pats - [Paren - (Const (Unit, (3,26--3,28)), - (3,26--3,28))], None, (3,23--3,28)), + (Const (Int32 1, (3,35--3,36)), LongIdent (SynLongIdent ([int], [], [None])), - (3,23--3,32)), None, - Const (Int32 1, (3,35--3,36)), (3,23--3,32), - NoneAtInvisible, + (3,35--3,36)), (3,23--3,28), NoneAtInvisible, { LeadingKeyword = Member (3,4--3,10) InlineKeyword = None EqualsRange = Some (3,33--3,34) })), @@ -60,26 +65,31 @@ ImplFile GetterOrSetterIsCompilerGenerated = false MemberKind = PropertySet }, SynValInfo - ([[SynArgInfo ([], false, None)]], + ([[SynArgInfo ([], false, None)]; + [SynArgInfo ([], false, None)]], SynArgInfo ([], false, None)), None), + LongIdent + (SynLongIdent + ([this; Y], [(3,15--3,16)], [None; None]), + Some set, None, + Pats + [Paren + (Typed + (Wild (3,46--3,47), + LongIdent + (SynLongIdent ([int], [], [None])), + (3,46--3,51)), (3,45--3,52))], None, + (3,41--3,52)), + Some + (SynBindingReturnInfo + (LongIdent + (SynLongIdent ([unit], [], [None])), + (3,53--3,57), [], + { ColonRange = Some (3,52--3,53) })), Typed - (LongIdent - (SynLongIdent - ([this; Y], [(3,15--3,16)], [None; None]), - Some set, None, - Pats - [Paren - (Typed - (Wild (3,46--3,47), - LongIdent - (SynLongIdent - ([int], [], [None])), - (3,46--3,51)), (3,45--3,52))], - None, (3,41--3,52)), + (Const (Unit, (3,60--3,62)), LongIdent (SynLongIdent ([unit], [], [None])), - (3,41--3,57)), None, - Const (Unit, (3,60--3,62)), (3,41--3,57), - NoneAtInvisible, + (3,60--3,62)), (3,41--3,52), NoneAtInvisible, { LeadingKeyword = Member (3,4--3,10) InlineKeyword = None EqualsRange = Some (3,58--3,59) })), diff --git a/tests/service/data/SyntaxTree/Binding/RangeOfEqualSignShouldBePresentInLocalLetBindingTyped.fs.bsl b/tests/service/data/SyntaxTree/Binding/RangeOfEqualSignShouldBePresentInLocalLetBindingTyped.fs.bsl index a4d233f1dbe..93dabea4c82 100644 --- a/tests/service/data/SyntaxTree/Binding/RangeOfEqualSignShouldBePresentInLocalLetBindingTyped.fs.bsl +++ b/tests/service/data/SyntaxTree/Binding/RangeOfEqualSignShouldBePresentInLocalLetBindingTyped.fs.bsl @@ -17,11 +17,16 @@ ImplFile SynValData (None, SynValInfo ([], SynArgInfo ([], false, None)), None), + Named (SynIdent (z, None), false, None, (3,8--3,9)), + Some + (SynBindingReturnInfo + (LongIdent (SynLongIdent ([int], [], [None])), + (3,11--3,14), [], + { ColonRange = Some (3,9--3,10) })), Typed - (Named (SynIdent (z, None), false, None, (3,8--3,9)), + (Const (Int32 2, (3,17--3,18)), LongIdent (SynLongIdent ([int], [], [None])), - (3,8--3,14)), None, Const (Int32 2, (3,17--3,18)), - (3,8--3,14), Yes (3,4--3,18), + (3,17--3,18)), (3,8--3,9), Yes (3,4--3,18), { LeadingKeyword = Let (3,4--3,7) InlineKeyword = None EqualsRange = Some (3,15--3,16) })], diff --git a/tests/service/data/SyntaxTree/Binding/RangeOfEqualSignShouldBePresentInMemberBindingWithReturnType.fs.bsl b/tests/service/data/SyntaxTree/Binding/RangeOfEqualSignShouldBePresentInMemberBindingWithReturnType.fs.bsl index 03156d26521..49eeec4d346 100644 --- a/tests/service/data/SyntaxTree/Binding/RangeOfEqualSignShouldBePresentInMemberBindingWithReturnType.fs.bsl +++ b/tests/service/data/SyntaxTree/Binding/RangeOfEqualSignShouldBePresentInMemberBindingWithReturnType.fs.bsl @@ -33,18 +33,24 @@ ImplFile SynValInfo ([[SynArgInfo ([], false, None)]; []], SynArgInfo ([], false, None)), None), + LongIdent + (SynLongIdent + ([this; Y], [(3,15--3,16)], [None; None]), None, + None, + Pats + [Paren + (Const (Unit, (3,18--3,20)), (3,18--3,20))], + None, (3,11--3,20)), + Some + (SynBindingReturnInfo + (LongIdent + (SynLongIdent ([string], [], [None])), + (3,23--3,29), [], + { ColonRange = Some (3,21--3,22) })), Typed - (LongIdent - (SynLongIdent - ([this; Y], [(3,15--3,16)], [None; None]), - None, None, - Pats - [Paren - (Const (Unit, (3,18--3,20)), (3,18--3,20))], - None, (3,11--3,20)), + (Ident z, LongIdent (SynLongIdent ([string], [], [None])), - (3,11--3,29)), None, Ident z, (3,11--3,29), - NoneAtInvisible, + (3,32--3,33)), (3,11--3,20), NoneAtInvisible, { LeadingKeyword = Member (3,4--3,10) InlineKeyword = None EqualsRange = Some (3,30--3,31) }), (3,4--3,33))], diff --git a/tests/service/data/SyntaxTree/Binding/RangeOfEqualSignShouldBePresentInSynModuleDeclLetBindingTyped.fs.bsl b/tests/service/data/SyntaxTree/Binding/RangeOfEqualSignShouldBePresentInSynModuleDeclLetBindingTyped.fs.bsl index 01b13d42f53..651cdb4f8ce 100644 --- a/tests/service/data/SyntaxTree/Binding/RangeOfEqualSignShouldBePresentInSynModuleDeclLetBindingTyped.fs.bsl +++ b/tests/service/data/SyntaxTree/Binding/RangeOfEqualSignShouldBePresentInSynModuleDeclLetBindingTyped.fs.bsl @@ -14,14 +14,18 @@ ImplFile PreXmlDoc ((2,0), FSharp.Compiler.Xml.XmlDocCollector), SynValData (None, SynValInfo ([], SynArgInfo ([], false, None)), None), + Named (SynIdent (v, None), false, None, (2,4--2,5)), + Some + (SynBindingReturnInfo + (LongIdent (SynLongIdent ([int], [], [None])), + (2,8--2,11), [], { ColonRange = Some (2,6--2,7) })), Typed - (Named (SynIdent (v, None), false, None, (2,4--2,5)), - LongIdent (SynLongIdent ([int], [], [None])), (2,4--2,11)), - None, Const (Int32 12, (2,14--2,16)), (2,4--2,11), - Yes (2,0--2,16), { LeadingKeyword = Let (2,0--2,3) - InlineKeyword = None - EqualsRange = Some (2,12--2,13) })], - (2,0--2,16))], PreXmlDocEmpty, [], None, (2,0--3,0), - { LeadingKeyword = None })], (true, true), - { ConditionalDirectives = [] - CodeComments = [] }, set [])) + (Const (Int32 12, (2,14--2,16)), + LongIdent (SynLongIdent ([int], [], [None])), (2,14--2,16)), + (2,4--2,5), Yes (2,0--2,16), + { LeadingKeyword = Let (2,0--2,3) + InlineKeyword = None + EqualsRange = Some (2,12--2,13) })], (2,0--2,16))], + PreXmlDocEmpty, [], None, (2,0--3,0), { LeadingKeyword = None })], + (true, true), { ConditionalDirectives = [] + CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/Binding/TupleReturnTypeOfBindingShouldContainStars.fs.bsl b/tests/service/data/SyntaxTree/Binding/TupleReturnTypeOfBindingShouldContainStars.fs.bsl index 58d8afeac0b..a8dae863d64 100644 --- a/tests/service/data/SyntaxTree/Binding/TupleReturnTypeOfBindingShouldContainStars.fs.bsl +++ b/tests/service/data/SyntaxTree/Binding/TupleReturnTypeOfBindingShouldContainStars.fs.bsl @@ -11,19 +11,29 @@ ImplFile PreXmlDoc ((2,0), FSharp.Compiler.Xml.XmlDocCollector), SynValData (None, SynValInfo ([], SynArgInfo ([], false, None)), None), + Named (SynIdent (a, None), false, None, (2,4--2,5)), + Some + (SynBindingReturnInfo + (Tuple + (false, + [Type (LongIdent (SynLongIdent ([int], [], [None]))); + Star (2,12--2,13); + Type + (LongIdent (SynLongIdent ([string], [], [None])))], + (2,8--2,20)), (2,8--2,20), [], + { ColonRange = Some (2,6--2,7) })), Typed - (Named (SynIdent (a, None), false, None, (2,4--2,5)), + (App + (NonAtomic, false, Ident failwith, + Const + (String ("todo", Regular, (2,32--2,38)), (2,32--2,38)), + (2,23--2,38)), Tuple (false, [Type (LongIdent (SynLongIdent ([int], [], [None]))); Star (2,12--2,13); Type (LongIdent (SynLongIdent ([string], [], [None])))], - (2,8--2,20)), (2,4--2,20)), None, - App - (NonAtomic, false, Ident failwith, - Const - (String ("todo", Regular, (2,32--2,38)), (2,32--2,38)), - (2,23--2,38)), (2,4--2,20), Yes (2,0--2,38), + (2,8--2,20)), (2,23--2,38)), (2,4--2,5), Yes (2,0--2,38), { LeadingKeyword = Let (2,0--2,3) InlineKeyword = None EqualsRange = Some (2,21--2,22) })], (2,0--2,38)); @@ -34,8 +44,27 @@ ImplFile PreXmlDoc ((3,0), FSharp.Compiler.Xml.XmlDocCollector), SynValData (None, SynValInfo ([], SynArgInfo ([], false, None)), None), + Named (SynIdent (b, None), false, None, (3,4--3,5)), + Some + (SynBindingReturnInfo + (Tuple + (false, + [Type (LongIdent (SynLongIdent ([int], [], [None]))); + Star (3,12--3,13); + Type + (LongIdent (SynLongIdent ([string], [], [None]))); + Star (3,21--3,22); + Type (LongIdent (SynLongIdent ([bool], [], [None])))], + (3,8--3,27)), (3,8--3,27), [], + { ColonRange = Some (3,6--3,7) })), Typed - (Named (SynIdent (b, None), false, None, (3,4--3,5)), + (Tuple + (false, + [Const (Int32 1, (3,30--3,31)); + Const + (String ("", Regular, (3,33--3,35)), (3,33--3,35)); + Const (Bool false, (3,37--3,42))], + [(3,31--3,32); (3,35--3,36)], (3,30--3,42)), Tuple (false, [Type (LongIdent (SynLongIdent ([int], [], [None]))); @@ -43,17 +72,10 @@ ImplFile Type (LongIdent (SynLongIdent ([string], [], [None]))); Star (3,21--3,22); Type (LongIdent (SynLongIdent ([bool], [], [None])))], - (3,8--3,27)), (3,4--3,27)), None, - Tuple - (false, - [Const (Int32 1, (3,30--3,31)); - Const (String ("", Regular, (3,33--3,35)), (3,33--3,35)); - Const (Bool false, (3,37--3,42))], - [(3,31--3,32); (3,35--3,36)], (3,30--3,42)), (3,4--3,27), - Yes (3,0--3,42), { LeadingKeyword = Let (3,0--3,3) - InlineKeyword = None - EqualsRange = Some (3,28--3,29) })], - (3,0--3,42))], PreXmlDocEmpty, [], None, (2,0--4,0), - { LeadingKeyword = None })], (true, true), - { ConditionalDirectives = [] - CodeComments = [] }, set [])) + (3,8--3,27)), (3,30--3,42)), (3,4--3,5), Yes (3,0--3,42), + { LeadingKeyword = Let (3,0--3,3) + InlineKeyword = None + EqualsRange = Some (3,28--3,29) })], (3,0--3,42))], + PreXmlDocEmpty, [], None, (2,0--4,0), { LeadingKeyword = None })], + (true, true), { ConditionalDirectives = [] + CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/LeadingKeyword/OverrideKeyword.fs.bsl b/tests/service/data/SyntaxTree/LeadingKeyword/OverrideKeyword.fs.bsl index dd91e790255..896ea64e69b 100644 --- a/tests/service/data/SyntaxTree/LeadingKeyword/OverrideKeyword.fs.bsl +++ b/tests/service/data/SyntaxTree/LeadingKeyword/OverrideKeyword.fs.bsl @@ -26,15 +26,21 @@ ImplFile SynValInfo ([[SynArgInfo ([], false, None)]; []], SynArgInfo ([], false, None)), None), + LongIdent + (SynLongIdent ([E], [], [None]), None, None, + Pats [], None, (3,13--3,14)), + Some + (SynBindingReturnInfo + (LongIdent + (SynLongIdent ([string], [], [None])), + (3,17--3,23), [], + { ColonRange = Some (3,15--3,16) })), Typed - (LongIdent - (SynLongIdent ([E], [], [None]), None, None, - Pats [], None, (3,13--3,14)), + (Const + (String ("", Regular, (3,26--3,28)), + (3,26--3,28)), LongIdent (SynLongIdent ([string], [], [None])), - (3,13--3,23)), None, - Const - (String ("", Regular, (3,26--3,28)), (3,26--3,28)), - (3,13--3,23), NoneAtInvisible, + (3,26--3,28)), (3,13--3,14), NoneAtInvisible, { LeadingKeyword = Override (3,4--3,12) InlineKeyword = None EqualsRange = Some (3,24--3,25) }), (3,4--3,28))], diff --git a/tests/service/data/SyntaxTree/LeadingKeyword/StaticMemberKeyword.fs.bsl b/tests/service/data/SyntaxTree/LeadingKeyword/StaticMemberKeyword.fs.bsl index a031409caf7..70b40e7ccd2 100644 --- a/tests/service/data/SyntaxTree/LeadingKeyword/StaticMemberKeyword.fs.bsl +++ b/tests/service/data/SyntaxTree/LeadingKeyword/StaticMemberKeyword.fs.bsl @@ -25,14 +25,18 @@ ImplFile MemberKind = Member }, SynValInfo ([[]], SynArgInfo ([], false, None)), None), + LongIdent + (SynLongIdent ([Y], [], [None]), None, None, + Pats [], None, (3,18--3,19)), + Some + (SynBindingReturnInfo + (LongIdent (SynLongIdent ([int], [], [None])), + (3,22--3,25), [], + { ColonRange = Some (3,20--3,21) })), Typed - (LongIdent - (SynLongIdent ([Y], [], [None]), None, None, - Pats [], None, (3,18--3,19)), + (Const (Int32 1, (3,28--3,29)), LongIdent (SynLongIdent ([int], [], [None])), - (3,18--3,25)), None, - Const (Int32 1, (3,28--3,29)), (3,18--3,25), - NoneAtInvisible, + (3,28--3,29)), (3,18--3,19), NoneAtInvisible, { LeadingKeyword = StaticMember ((3,4--3,10), (3,11--3,17)) InlineKeyword = None diff --git a/tests/service/data/SyntaxTree/Member/Member 08.fs.bsl b/tests/service/data/SyntaxTree/Member/Member 08.fs.bsl index e010d9b9a29..b2e10558c6a 100644 --- a/tests/service/data/SyntaxTree/Member/Member 08.fs.bsl +++ b/tests/service/data/SyntaxTree/Member/Member 08.fs.bsl @@ -41,19 +41,29 @@ ImplFile SynValInfo ([[SynArgInfo ([], false, None)]; []], SynArgInfo ([], false, None)), None), + LongIdent + (SynLongIdent ([Norm], [], [None]), None, None, + Pats [], None, (4,42--4,46)), + Some + (SynBindingReturnInfo + (Fun + (Var + (SynTypar (T, None, false), (4,49--4,51)), + Var + (SynTypar (Measure, None, false), + (4,55--4,63)), (4,49--4,63), + { ArrowRange = (4,52--4,54) }), + (4,49--4,63), [], + { ColonRange = Some (4,47--4,48) })), Typed - (LongIdent - (SynLongIdent ([Norm], [], [None]), None, None, - Pats [], None, (4,42--4,46)), + (ArbitraryAfterError ("memberCore2", (4,63--4,63)), Fun (Var (SynTypar (T, None, false), (4,49--4,51)), Var (SynTypar (Measure, None, false), (4,55--4,63)), (4,49--4,63), - { ArrowRange = (4,52--4,54) }), (4,42--4,63)), - None, - ArbitraryAfterError ("memberCore2", (4,63--4,63)), - (4,42--4,63), NoneAtInvisible, + { ArrowRange = (4,52--4,54) }), (4,63--4,63)), + (4,42--4,46), NoneAtInvisible, { LeadingKeyword = Member (4,35--4,41) InlineKeyword = None EqualsRange = None }), (4,35--4,63))], diff --git a/tests/service/data/SyntaxTree/Member/Member 13.fs.bsl b/tests/service/data/SyntaxTree/Member/Member 13.fs.bsl index a9ac8da2b4f..129c9f529ce 100644 --- a/tests/service/data/SyntaxTree/Member/Member 13.fs.bsl +++ b/tests/service/data/SyntaxTree/Member/Member 13.fs.bsl @@ -24,20 +24,24 @@ ImplFile MemberKind = Member }, SynValInfo ([[]], SynArgInfo ([], false, None)), None), + LongIdent + (SynLongIdent ([P], [], [None]), None, None, + Pats [], None, (4,18--4,19)), + Some + (SynBindingReturnInfo + (FromParseError (4,20--4,20), (4,20--4,20), [], + { ColonRange = Some (4,19--4,20) })), Typed - (LongIdent - (SynLongIdent ([P], [], [None]), None, None, - Pats [], None, (4,18--4,19)), - FromParseError (4,20--4,20), (4,18--6,4)), None, - ArbitraryAfterError ("memberCore2", (6,4--6,4)), - (4,18--6,4), NoneAtInvisible, + (ArbitraryAfterError ("memberCore2", (4,20--4,20)), + FromParseError (4,20--4,20), (4,20--4,20)), + (4,18--4,19), NoneAtInvisible, { LeadingKeyword = StaticMember ((4,4--4,10), (4,11--4,17)) InlineKeyword = None - EqualsRange = None }), (4,4--6,4))], (4,4--6,4)), - [], None, (3,5--6,4), { LeadingKeyword = Type (3,0--3,4) - EqualsRange = Some (3,7--3,8) - WithKeyword = None })], (3,0--6,4)); + EqualsRange = None }), (4,4--4,20))], (4,4--4,20)), + [], None, (3,5--4,20), { LeadingKeyword = Type (3,0--3,4) + EqualsRange = Some (3,7--3,8) + WithKeyword = None })], (3,0--4,20)); Types ([SynTypeDefn (SynComponentInfo diff --git a/tests/service/data/SyntaxTree/Member/SynTypeDefnWithMemberWithSetget.fs.bsl b/tests/service/data/SyntaxTree/Member/SynTypeDefnWithMemberWithSetget.fs.bsl index bc9226840ee..e3fe9618a23 100644 --- a/tests/service/data/SyntaxTree/Member/SynTypeDefnWithMemberWithSetget.fs.bsl +++ b/tests/service/data/SyntaxTree/Member/SynTypeDefnWithMemberWithSetget.fs.bsl @@ -31,21 +31,26 @@ ImplFile GetterOrSetterIsCompilerGenerated = false MemberKind = PropertyGet }, SynValInfo - ([[SynArgInfo ([], false, None)]], + ([[SynArgInfo ([], false, None)]; []], SynArgInfo ([], false, None)), None), + LongIdent + (SynLongIdent + ([this; Z], [(3,15--3,16)], [None; None]), + Some get, None, + Pats + [Paren + (Const (Unit, (3,52--3,54)), (3,52--3,54))], + None, (3,49--3,54)), + Some + (SynBindingReturnInfo + (LongIdent + (SynLongIdent ([int], [], [None])), + (3,55--3,58), [], + { ColonRange = Some (3,54--3,55) })), Typed - (LongIdent - (SynLongIdent - ([this; Z], [(3,15--3,16)], [None; None]), - Some get, None, - Pats - [Paren - (Const (Unit, (3,52--3,54)), - (3,52--3,54))], None, (3,49--3,54)), + (Const (Int32 1, (3,61--3,62)), LongIdent (SynLongIdent ([int], [], [None])), - (3,49--3,58)), None, - Const (Int32 1, (3,61--3,62)), (3,49--3,58), - NoneAtInvisible, + (3,61--3,62)), (3,49--3,54), NoneAtInvisible, { LeadingKeyword = Member (3,4--3,10) InlineKeyword = None EqualsRange = Some (3,59--3,60) })), @@ -63,26 +68,31 @@ ImplFile GetterOrSetterIsCompilerGenerated = false MemberKind = PropertySet }, SynValInfo - ([[SynArgInfo ([], false, None)]], + ([[SynArgInfo ([], false, None)]; + [SynArgInfo ([], false, None)]], SynArgInfo ([], false, None)), None), + LongIdent + (SynLongIdent + ([this; Z], [(3,15--3,16)], [None; None]), + Some set, None, + Pats + [Paren + (Typed + (Wild (3,28--3,29), + LongIdent + (SynLongIdent ([int], [], [None])), + (3,28--3,33)), (3,27--3,34))], None, + (3,23--3,34)), + Some + (SynBindingReturnInfo + (LongIdent + (SynLongIdent ([unit], [], [None])), + (3,35--3,39), [], + { ColonRange = Some (3,34--3,35) })), Typed - (LongIdent - (SynLongIdent - ([this; Z], [(3,15--3,16)], [None; None]), - Some set, None, - Pats - [Paren - (Typed - (Wild (3,28--3,29), - LongIdent - (SynLongIdent - ([int], [], [None])), - (3,28--3,33)), (3,27--3,34))], - None, (3,23--3,34)), + (Const (Unit, (3,42--3,44)), LongIdent (SynLongIdent ([unit], [], [None])), - (3,23--3,39)), None, - Const (Unit, (3,42--3,44)), (3,23--3,39), - NoneAtInvisible, + (3,42--3,44)), (3,23--3,34), NoneAtInvisible, { LeadingKeyword = Member (3,4--3,10) InlineKeyword = None EqualsRange = Some (3,40--3,41) })), diff --git a/tests/service/data/SyntaxTree/ModuleOrNamespace/Module - Attribute 01.fs.bsl b/tests/service/data/SyntaxTree/ModuleOrNamespace/Module - Attribute 01.fs.bsl index 1de0781daeb..70ca7f64fdb 100644 --- a/tests/service/data/SyntaxTree/ModuleOrNamespace/Module - Attribute 01.fs.bsl +++ b/tests/service/data/SyntaxTree/ModuleOrNamespace/Module - Attribute 01.fs.bsl @@ -11,12 +11,15 @@ ImplFile PreXmlDoc ((5,0), FSharp.Compiler.Xml.XmlDocCollector), SynValData (None, SynValInfo ([], SynArgInfo ([], false, None)), None), + Named (SynIdent (s, None), false, None, (5,4--5,5)), + Some + (SynBindingReturnInfo + (LongIdent (SynLongIdent ([string], [], [None])), + (5,8--5,14), [], { ColonRange = Some (5,6--5,7) })), Typed - (Named (SynIdent (s, None), false, None, (5,4--5,5)), + (Const (String ("s", Regular, (5,17--5,20)), (5,17--5,20)), LongIdent (SynLongIdent ([string], [], [None])), - (5,4--5,14)), None, - Const (String ("s", Regular, (5,17--5,20)), (5,17--5,20)), - (5,4--5,14), Yes (5,0--5,20), + (5,17--5,20)), (5,4--5,5), Yes (5,0--5,20), { LeadingKeyword = Let (5,0--5,3) InlineKeyword = None EqualsRange = Some (5,15--5,16) })], (5,0--5,20))], diff --git a/tests/service/data/SyntaxTree/Nullness/GenericFunctionReturnTypeNotStructNull.fs.bsl b/tests/service/data/SyntaxTree/Nullness/GenericFunctionReturnTypeNotStructNull.fs.bsl index 60921e95afb..d155f74abba 100644 --- a/tests/service/data/SyntaxTree/Nullness/GenericFunctionReturnTypeNotStructNull.fs.bsl +++ b/tests/service/data/SyntaxTree/Nullness/GenericFunctionReturnTypeNotStructNull.fs.bsl @@ -10,20 +10,30 @@ ImplFile (None, Normal, false, false, [], PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), SynValData - (None, SynValInfo ([], SynArgInfo ([], false, None)), None), + (None, SynValInfo ([[]], SynArgInfo ([], false, None)), None), + LongIdent + (SynLongIdent ([myFunc], [], [None]), None, None, + Pats [Paren (Const (Unit, (1,10--1,12)), (1,10--1,12))], + None, (1,4--1,12)), + Some + (SynBindingReturnInfo + (WithGlobalConstraints + (Var (SynTypar (T, None, false), (1,15--1,17)), + [WhereTyparIsReferenceType + (SynTypar (T, None, false), (1,23--1,38)); + WhereTyparSupportsNull + (SynTypar (T, None, false), (1,43--1,50))], + (1,15--1,50)), (1,15--1,50), [], + { ColonRange = Some (1,13--1,14) })), Typed - (LongIdent - (SynLongIdent ([myFunc], [], [None]), None, None, - Pats [Paren (Const (Unit, (1,10--1,12)), (1,10--1,12))], - None, (1,4--1,12)), + (Null (1,53--1,57), WithGlobalConstraints (Var (SynTypar (T, None, false), (1,15--1,17)), [WhereTyparIsReferenceType (SynTypar (T, None, false), (1,23--1,38)); WhereTyparSupportsNull (SynTypar (T, None, false), (1,43--1,50))], - (1,15--1,50)), (1,4--1,50)), None, Null (1,53--1,57), - (1,4--1,50), Yes (1,0--1,57), + (1,15--1,50)), (1,53--1,57)), (1,4--1,12), NoneAtLet, { LeadingKeyword = Let (1,0--1,3) InlineKeyword = None EqualsRange = Some (1,51--1,52) })], (1,0--1,57))], diff --git a/tests/service/data/SyntaxTree/Nullness/IntListOrNull.fs.bsl b/tests/service/data/SyntaxTree/Nullness/IntListOrNull.fs.bsl index 63642576d42..c678aa83577 100644 --- a/tests/service/data/SyntaxTree/Nullness/IntListOrNull.fs.bsl +++ b/tests/service/data/SyntaxTree/Nullness/IntListOrNull.fs.bsl @@ -11,15 +11,25 @@ ImplFile PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), SynValData (None, SynValInfo ([], SynArgInfo ([], false, None)), None), + Named (SynIdent (x, None), false, None, (1,4--1,5)), + Some + (SynBindingReturnInfo + (WithNull + (App + (LongIdent (SynLongIdent ([list], [], [None])), + None, + [LongIdent (SynLongIdent ([int], [], [None]))], [], + None, true, (1,8--1,16)), false, (1,8--1,23), + { BarRange = (1,17--1,18) }), (1,8--1,23), [], + { ColonRange = Some (1,6--1,7) })), Typed - (Named (SynIdent (x, None), false, None, (1,4--1,5)), + (ArrayOrList (false, [], (1,26--1,28)), WithNull (App (LongIdent (SynLongIdent ([list], [], [None])), None, [LongIdent (SynLongIdent ([int], [], [None]))], [], None, true, (1,8--1,16)), false, (1,8--1,23), - { BarRange = (1,17--1,18) }), (1,4--1,23)), None, - ArrayOrList (false, [], (1,26--1,28)), (1,4--1,23), + { BarRange = (1,17--1,18) }), (1,26--1,28)), (1,4--1,5), Yes (1,0--1,28), { LeadingKeyword = Let (1,0--1,3) InlineKeyword = None EqualsRange = Some (1,24--1,25) })], diff --git a/tests/service/data/SyntaxTree/Nullness/IntListOrNullOrNullOrNull.fs.bsl b/tests/service/data/SyntaxTree/Nullness/IntListOrNullOrNullOrNull.fs.bsl index 0a8f1df0a7e..2ba94607f41 100644 --- a/tests/service/data/SyntaxTree/Nullness/IntListOrNullOrNullOrNull.fs.bsl +++ b/tests/service/data/SyntaxTree/Nullness/IntListOrNullOrNullOrNull.fs.bsl @@ -11,25 +11,30 @@ ImplFile PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), SynValData (None, SynValInfo ([], SynArgInfo ([], false, None)), None), - Or - (Or - (Typed - (Named (SynIdent (x, None), false, None, (1,4--1,5)), - WithNull - (App - (LongIdent (SynLongIdent ([list], [], [None])), - None, - [LongIdent (SynLongIdent ([int], [], [None]))], - [], None, true, (1,8--1,16)), false, - (1,8--1,23), { BarRange = (1,17--1,18) }), - (1,4--1,23)), Null (1,26--1,30), (1,4--1,30), - { BarRange = (1,24--1,25) }), Null (1,33--1,37), - (1,4--1,37), { BarRange = (1,31--1,32) }), None, - ArrayOrList (false, [], (1,40--1,42)), (1,4--1,37), - Yes (1,0--1,42), { LeadingKeyword = Let (1,0--1,3) + Named (SynIdent (x, None), false, None, (1,4--1,5)), + Some + (SynBindingReturnInfo + (WithNull + (App + (LongIdent (SynLongIdent ([list], [], [None])), + None, + [LongIdent (SynLongIdent ([int], [], [None]))], [], + None, true, (1,8--1,16)), false, (1,8--1,23), + { BarRange = (1,17--1,18) }), (1,8--1,23), [], + { ColonRange = Some (1,6--1,7) })), + Typed + (ArbitraryAfterError ("localBinding2", (1,23--1,23)), + WithNull + (App + (LongIdent (SynLongIdent ([list], [], [None])), None, + [LongIdent (SynLongIdent ([int], [], [None]))], [], + None, true, (1,8--1,16)), false, (1,8--1,23), + { BarRange = (1,17--1,18) }), (1,23--1,23)), (1,4--1,5), + Yes (1,0--1,23), { LeadingKeyword = Let (1,0--1,3) InlineKeyword = None - EqualsRange = Some (1,38--1,39) })], - (1,0--1,42))], PreXmlDocEmpty, [], None, (1,0--2,0), - { LeadingKeyword = None })], (true, true), - { ConditionalDirectives = [] - CodeComments = [] }, set [])) + EqualsRange = None })], (1,0--1,23))], + PreXmlDocEmpty, [], None, (1,0--2,0), { LeadingKeyword = None })], + (true, true), { ConditionalDirectives = [] + CodeComments = [] }, set [])) + +(1,24)-(1,25) parse error Unexpected symbol '|' (directly before 'null') in binding. Expected '=' or other token. diff --git a/tests/service/data/SyntaxTree/Nullness/NullAnnotatedExpression.fs.bsl b/tests/service/data/SyntaxTree/Nullness/NullAnnotatedExpression.fs.bsl index a83025be962..207a76250e4 100644 --- a/tests/service/data/SyntaxTree/Nullness/NullAnnotatedExpression.fs.bsl +++ b/tests/service/data/SyntaxTree/Nullness/NullAnnotatedExpression.fs.bsl @@ -11,8 +11,37 @@ ImplFile PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), SynValData (None, SynValInfo ([], SynArgInfo ([], false, None)), None), + Named (SynIdent (x, None), false, None, (1,4--1,5)), + Some + (SynBindingReturnInfo + (WithNull + (App + (LongIdent + (SynLongIdent ([Expression], [], [None])), + Some (1,18--1,19), + [WithNull + (App + (LongIdent + (SynLongIdent ([Func], [], [None])), + Some (1,23--1,24), + [WithNull + (LongIdent + (SynLongIdent ([string], [], [None])), + false, (1,24--1,37), + { BarRange = (1,31--1,32) }); + WithNull + (LongIdent + (SynLongIdent ([T], [], [None])), + false, (1,39--1,47), + { BarRange = (1,41--1,42) })], + [(1,37--1,38)], Some (1,47--1,48), false, + (1,19--1,48)), false, (1,19--1,55), + { BarRange = (1,49--1,50) })], [], + Some (1,55--1,56), false, (1,8--1,56)), false, + (1,8--1,63), { BarRange = (1,57--1,58) }), + (1,8--1,63), [], { ColonRange = Some (1,6--1,7) })), Typed - (Named (SynIdent (x, None), false, None, (1,4--1,5)), + (Null (1,66--1,70), WithNull (App (LongIdent (SynLongIdent ([Expression], [], [None])), @@ -34,8 +63,8 @@ ImplFile (1,19--1,48)), false, (1,19--1,55), { BarRange = (1,49--1,50) })], [], Some (1,55--1,56), false, (1,8--1,56)), false, - (1,8--1,63), { BarRange = (1,57--1,58) }), (1,4--1,63)), - None, Null (1,66--1,70), (1,4--1,63), Yes (1,0--1,70), + (1,8--1,63), { BarRange = (1,57--1,58) }), (1,66--1,70)), + (1,4--1,5), Yes (1,0--1,70), { LeadingKeyword = Let (1,0--1,3) InlineKeyword = None EqualsRange = Some (1,64--1,65) })], (1,0--1,70))], diff --git a/tests/service/data/SyntaxTree/Nullness/StringOrNull.fs.bsl b/tests/service/data/SyntaxTree/Nullness/StringOrNull.fs.bsl index d2ec88c3c84..4e8240dd5fb 100644 --- a/tests/service/data/SyntaxTree/Nullness/StringOrNull.fs.bsl +++ b/tests/service/data/SyntaxTree/Nullness/StringOrNull.fs.bsl @@ -11,12 +11,19 @@ ImplFile PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), SynValData (None, SynValInfo ([], SynArgInfo ([], false, None)), None), + Named (SynIdent (x, None), false, None, (1,4--1,5)), + Some + (SynBindingReturnInfo + (WithNull + (LongIdent (SynLongIdent ([string], [], [None])), + false, (1,8--1,21), { BarRange = (1,15--1,16) }), + (1,8--1,21), [], { ColonRange = Some (1,6--1,7) })), Typed - (Named (SynIdent (x, None), false, None, (1,4--1,5)), + (Null (1,24--1,28), WithNull (LongIdent (SynLongIdent ([string], [], [None])), false, - (1,8--1,21), { BarRange = (1,15--1,16) }), (1,4--1,21)), - None, Null (1,24--1,28), (1,4--1,21), Yes (1,0--1,28), + (1,8--1,21), { BarRange = (1,15--1,16) }), (1,24--1,28)), + (1,4--1,5), Yes (1,0--1,28), { LeadingKeyword = Let (1,0--1,3) InlineKeyword = None EqualsRange = Some (1,22--1,23) })], (1,0--1,28))], diff --git a/tests/service/data/SyntaxTree/Pattern/Typed - Missing type 01.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Typed - Missing type 01.fs.bsl index 83ed3edb90e..39999d8f69c 100644 --- a/tests/service/data/SyntaxTree/Pattern/Typed - Missing type 01.fs.bsl +++ b/tests/service/data/SyntaxTree/Pattern/Typed - Missing type 01.fs.bsl @@ -11,15 +11,19 @@ ImplFile PreXmlDoc ((3,0), FSharp.Compiler.Xml.XmlDocCollector), SynValData (None, SynValInfo ([], SynArgInfo ([], false, None)), None), + Named (SynIdent (i, None), false, None, (3,4--3,5)), + Some + (SynBindingReturnInfo + (FromParseError (3,6--3,6), (3,6--3,6), [], + { ColonRange = Some (3,5--3,6) })), Typed - (Named (SynIdent (i, None), false, None, (3,4--3,5)), - FromParseError (3,6--3,6), (3,4--5,1)), None, - ArbitraryAfterError ("localBinding2", (5,1--5,1)), (3,4--5,1), - Yes (3,0--5,1), { LeadingKeyword = Let (3,0--3,3) + (ArbitraryAfterError ("localBinding2", (3,6--3,6)), + FromParseError (3,6--3,6), (3,6--3,6)), (3,4--3,5), + Yes (3,0--3,6), { LeadingKeyword = Let (3,0--3,3) InlineKeyword = None - EqualsRange = None })], (3,0--5,1))], + EqualsRange = None })], (3,0--3,6))], PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, - (1,0--5,1), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + (1,0--3,6), { LeadingKeyword = Module (1,0--1,6) })], (true, true), { ConditionalDirectives = [] CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/Pattern/Typed - Missing type 02.fs.bsl b/tests/service/data/SyntaxTree/Pattern/Typed - Missing type 02.fs.bsl index 66b8e494f17..b5b4b6e28e2 100644 --- a/tests/service/data/SyntaxTree/Pattern/Typed - Missing type 02.fs.bsl +++ b/tests/service/data/SyntaxTree/Pattern/Typed - Missing type 02.fs.bsl @@ -11,10 +11,14 @@ ImplFile PreXmlDoc ((3,0), FSharp.Compiler.Xml.XmlDocCollector), SynValData (None, SynValInfo ([], SynArgInfo ([], false, None)), None), + Named (SynIdent (i, None), false, None, (3,4--3,5)), + Some + (SynBindingReturnInfo + (FromParseError (3,6--3,6), (3,6--3,6), [], + { ColonRange = Some (3,5--3,6) })), Typed - (Named (SynIdent (i, None), false, None, (3,4--3,5)), - FromParseError (3,6--3,6), (3,4--3,8)), None, - Const (Int32 1, (3,9--3,10)), (3,4--3,8), Yes (3,0--3,10), + (Const (Int32 1, (3,9--3,10)), FromParseError (3,6--3,6), + (3,9--3,10)), (3,4--3,5), Yes (3,0--3,10), { LeadingKeyword = Let (3,0--3,3) InlineKeyword = None EqualsRange = Some (3,7--3,8) })], (3,0--3,10)); 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 d1bb0776a63..7bd27b958c6 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 @@ -16,21 +16,25 @@ ImplFile (None, SynValInfo ([], SynArgInfo ([], false, None)), None), + Named (SynIdent (i, None), false, None, (4,8--4,9)), + Some + (SynBindingReturnInfo + (FromParseError (4,10--4,10), (4,10--4,10), [], + { ColonRange = Some (4,9--4,10) })), Typed - (Named - (SynIdent (i, None), false, None, (4,8--4,9)), - FromParseError (4,10--4,10), (4,8--6,5)), None, - ArbitraryAfterError ("localBinding2", (6,5--6,5)), - (4,8--6,5), Yes (4,4--6,5), + (ArbitraryAfterError + ("localBinding2", (4,10--4,10)), + FromParseError (4,10--4,10), (4,10--4,10)), + (4,8--4,9), Yes (4,4--4,10), { LeadingKeyword = Let (4,4--4,7) InlineKeyword = None EqualsRange = None })], - ArbitraryAfterError ("seqExpr", (6,5--6,5)), (4,4--6,5), - { LetOrUseKeyword = (4,4--4,7) - InKeyword = None }), (4,4--6,5)), (3,0--6,5)), - (3,0--6,5))], + ArbitraryAfterError ("seqExpr", (4,10--4,10)), + (4,4--4,10), { LetOrUseKeyword = (4,4--4,7) + InKeyword = None }), (4,4--4,10)), + (3,0--4,10)), (3,0--4,10))], PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, - (1,0--6,5), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + (1,0--4,10), { LeadingKeyword = Module (1,0--1,6) })], (true, true), { ConditionalDirectives = [] CodeComments = [] }, set [])) 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 d8f94573b3e..6120ff4f5fd 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 @@ -14,13 +14,18 @@ ImplFile SynValData (None, SynValInfo ([], SynArgInfo ([], false, None)), None), + Named (SynIdent (i, None), false, None, (4,8--4,9)), + Some + (SynBindingReturnInfo + (FromParseError (4,10--4,10), (4,10--4,10), [], + { ColonRange = Some (4,9--4,10) })), Typed - (Named (SynIdent (i, None), false, None, (4,8--4,9)), - FromParseError (4,10--4,10), (4,8--4,12)), None, - Const (Int32 1, (4,13--4,14)), (4,8--4,12), - Yes (4,4--4,14), { LeadingKeyword = Let (4,4--4,7) - InlineKeyword = None - EqualsRange = Some (4,11--4,12) })], + (Const (Int32 1, (4,13--4,14)), + FromParseError (4,10--4,10), (4,13--4,14)), + (4,8--4,9), Yes (4,4--4,14), + { LeadingKeyword = Let (4,4--4,7) + InlineKeyword = None + EqualsRange = Some (4,11--4,12) })], Const (Unit, (6,4--6,6)), (4,4--6,6), { LetOrUseKeyword = (4,4--4,7) InKeyword = None }), (3,0--6,6)), (3,0--6,6))], diff --git a/tests/service/data/SyntaxTree/SynType/Fun 06.fs.bsl b/tests/service/data/SyntaxTree/SynType/Fun 06.fs.bsl index b60861b5bca..79fba7f21d4 100644 --- a/tests/service/data/SyntaxTree/SynType/Fun 06.fs.bsl +++ b/tests/service/data/SyntaxTree/SynType/Fun 06.fs.bsl @@ -10,16 +10,24 @@ ImplFile PreXmlDoc ((3,0), FSharp.Compiler.Xml.XmlDocCollector), SynValData (None, SynValInfo ([], SynArgInfo ([], false, None)), None), + Wild (3,4--3,5), + Some + (SynBindingReturnInfo + (Fun + (LongIdent (SynLongIdent ([a], [], [None])), + LongIdent (SynLongIdent ([b], [], [None])), + (3,7--3,13), { ArrowRange = (3,9--3,11) }), + (3,7--3,13), [], { ColonRange = Some (3,5--3,6) })), Typed - (Wild (3,4--3,5), + (Const (Unit, (3,16--3,18)), Fun (LongIdent (SynLongIdent ([a], [], [None])), LongIdent (SynLongIdent ([b], [], [None])), (3,7--3,13), - { ArrowRange = (3,9--3,11) }), (3,4--3,13)), None, - Const (Unit, (3,16--3,18)), (3,4--3,13), Yes (3,0--3,18), - { LeadingKeyword = Let (3,0--3,3) - InlineKeyword = None - EqualsRange = Some (3,14--3,15) })], (3,0--3,18))], + { ArrowRange = (3,9--3,11) }), (3,16--3,18)), (3,4--3,5), + Yes (3,0--3,18), { LeadingKeyword = Let (3,0--3,3) + InlineKeyword = None + EqualsRange = Some (3,14--3,15) })], + (3,0--3,18))], PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, (1,0--3,18), { LeadingKeyword = Module (1,0--1,6) })], (true, true), { ConditionalDirectives = [] diff --git a/tests/service/data/SyntaxTree/SynType/Fun 07.fs.bsl b/tests/service/data/SyntaxTree/SynType/Fun 07.fs.bsl index df25683b851..fc09b3f737f 100644 --- a/tests/service/data/SyntaxTree/SynType/Fun 07.fs.bsl +++ b/tests/service/data/SyntaxTree/SynType/Fun 07.fs.bsl @@ -10,16 +10,27 @@ ImplFile PreXmlDoc ((3,0), FSharp.Compiler.Xml.XmlDocCollector), SynValData (None, SynValInfo ([], SynArgInfo ([], false, None)), None), + Wild (3,4--3,5), + Some + (SynBindingReturnInfo + (Fun + (LongIdent (SynLongIdent ([a], [], [None])), + Fun + (LongIdent (SynLongIdent ([b], [], [None])), + LongIdent (SynLongIdent ([c], [], [None])), + (3,12--3,18), { ArrowRange = (3,14--3,16) }), + (3,7--3,18), { ArrowRange = (3,9--3,11) }), + (3,7--3,18), [], { ColonRange = Some (3,5--3,6) })), Typed - (Wild (3,4--3,5), + (Const (Unit, (3,21--3,23)), Fun (LongIdent (SynLongIdent ([a], [], [None])), Fun (LongIdent (SynLongIdent ([b], [], [None])), LongIdent (SynLongIdent ([c], [], [None])), (3,12--3,18), { ArrowRange = (3,14--3,16) }), - (3,7--3,18), { ArrowRange = (3,9--3,11) }), (3,4--3,18)), - None, Const (Unit, (3,21--3,23)), (3,4--3,18), Yes (3,0--3,23), + (3,7--3,18), { ArrowRange = (3,9--3,11) }), (3,21--3,23)), + (3,4--3,5), Yes (3,0--3,23), { LeadingKeyword = Let (3,0--3,3) InlineKeyword = None EqualsRange = Some (3,19--3,20) })], (3,0--3,23))], diff --git a/tests/service/data/SyntaxTree/SynType/Fun 08.fs.bsl b/tests/service/data/SyntaxTree/SynType/Fun 08.fs.bsl index 2be3be58a19..914be23e3c5 100644 --- a/tests/service/data/SyntaxTree/SynType/Fun 08.fs.bsl +++ b/tests/service/data/SyntaxTree/SynType/Fun 08.fs.bsl @@ -10,19 +10,27 @@ ImplFile PreXmlDoc ((3,0), FSharp.Compiler.Xml.XmlDocCollector), SynValData (None, SynValInfo ([], SynArgInfo ([], false, None)), None), + Wild (3,4--3,5), + Some + (SynBindingReturnInfo + (Fun + (LongIdent (SynLongIdent ([a], [], [None])), + FromParseError (3,11--3,11), (3,7--3,13), + { ArrowRange = (3,9--3,11) }), (3,7--3,13), [], + { ColonRange = Some (3,5--3,6) })), Typed - (Wild (3,4--3,5), + (Const (Unit, (3,14--3,16)), Fun (LongIdent (SynLongIdent ([a], [], [None])), - FromParseError (3,11--3,11), (3,7--3,11), - { ArrowRange = (3,9--3,11) }), (3,4--3,13)), None, - Const (Unit, (3,14--3,16)), (3,4--3,13), Yes (3,0--3,16), - { LeadingKeyword = Let (3,0--3,3) - InlineKeyword = None - EqualsRange = Some (3,12--3,13) })], (3,0--3,16))], + FromParseError (3,11--3,11), (3,7--3,13), + { ArrowRange = (3,9--3,11) }), (3,14--3,16)), (3,4--3,5), + Yes (3,0--3,16), { LeadingKeyword = Let (3,0--3,3) + InlineKeyword = None + EqualsRange = Some (3,12--3,13) })], + (3,0--3,16))], PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, (1,0--3,16), { LeadingKeyword = Module (1,0--1,6) })], (true, true), { ConditionalDirectives = [] CodeComments = [] }, set [])) -(3,12)-(3,13) parse error Unexpected symbol '=' in type +(3,12)-(3,13) parse error Unexpected symbol '=' in binding diff --git a/tests/service/data/SyntaxTree/SynType/Fun 09.fs.bsl b/tests/service/data/SyntaxTree/SynType/Fun 09.fs.bsl index 2cedea1e728..3a7ecdba3cf 100644 --- a/tests/service/data/SyntaxTree/SynType/Fun 09.fs.bsl +++ b/tests/service/data/SyntaxTree/SynType/Fun 09.fs.bsl @@ -10,22 +10,33 @@ ImplFile PreXmlDoc ((3,0), FSharp.Compiler.Xml.XmlDocCollector), SynValData (None, SynValInfo ([], SynArgInfo ([], false, None)), None), + Wild (3,4--3,5), + Some + (SynBindingReturnInfo + (Fun + (LongIdent (SynLongIdent ([a], [], [None])), + Fun + (LongIdent (SynLongIdent ([b], [], [None])), + FromParseError (3,16--3,16), (3,12--3,18), + { ArrowRange = (3,14--3,16) }), (3,7--3,18), + { ArrowRange = (3,9--3,11) }), (3,7--3,18), [], + { ColonRange = Some (3,5--3,6) })), Typed - (Wild (3,4--3,5), + (Const (Unit, (3,19--3,21)), Fun (LongIdent (SynLongIdent ([a], [], [None])), Fun (LongIdent (SynLongIdent ([b], [], [None])), - FromParseError (3,16--3,16), (3,12--3,16), - { ArrowRange = (3,14--3,16) }), (3,7--3,16), - { ArrowRange = (3,9--3,11) }), (3,4--3,18)), None, - Const (Unit, (3,19--3,21)), (3,4--3,18), Yes (3,0--3,21), - { LeadingKeyword = Let (3,0--3,3) - InlineKeyword = None - EqualsRange = Some (3,17--3,18) })], (3,0--3,21))], + FromParseError (3,16--3,16), (3,12--3,18), + { ArrowRange = (3,14--3,16) }), (3,7--3,18), + { ArrowRange = (3,9--3,11) }), (3,19--3,21)), (3,4--3,5), + Yes (3,0--3,21), { LeadingKeyword = Let (3,0--3,3) + InlineKeyword = None + EqualsRange = Some (3,17--3,18) })], + (3,0--3,21))], PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, (1,0--3,21), { LeadingKeyword = Module (1,0--1,6) })], (true, true), { ConditionalDirectives = [] CodeComments = [] }, set [])) -(3,17)-(3,18) parse error Unexpected symbol '=' in type +(3,17)-(3,18) parse error Unexpected symbol '=' in binding diff --git a/tests/service/data/SyntaxTree/SynType/Fun 10.fs.bsl b/tests/service/data/SyntaxTree/SynType/Fun 10.fs.bsl index 16921935e20..061982252ad 100644 --- a/tests/service/data/SyntaxTree/SynType/Fun 10.fs.bsl +++ b/tests/service/data/SyntaxTree/SynType/Fun 10.fs.bsl @@ -10,22 +10,27 @@ ImplFile PreXmlDoc ((3,0), FSharp.Compiler.Xml.XmlDocCollector), SynValData (None, SynValInfo ([], SynArgInfo ([], false, None)), None), + Wild (3,4--3,5), + Some + (SynBindingReturnInfo + (Fun + (LongIdent (SynLongIdent ([a], [], [None])), + FromParseError (3,11--3,11), (3,7--3,14), + { ArrowRange = (3,9--3,11) }), (3,7--3,14), [], + { ColonRange = Some (3,5--3,6) })), Typed - (Wild (3,4--3,5), + (Const (Unit, (3,19--3,21)), Fun (LongIdent (SynLongIdent ([a], [], [None])), - Fun - (FromParseError (3,12--3,12), - LongIdent (SynLongIdent ([c], [], [None])), - (3,12--3,16), { ArrowRange = (3,12--3,14) }), - (3,7--3,16), { ArrowRange = (3,9--3,11) }), (3,4--3,16)), - None, Const (Unit, (3,19--3,21)), (3,4--3,16), Yes (3,0--3,21), - { LeadingKeyword = Let (3,0--3,3) - InlineKeyword = None - EqualsRange = Some (3,17--3,18) })], (3,0--3,21))], + FromParseError (3,11--3,11), (3,7--3,14), + { ArrowRange = (3,9--3,11) }), (3,19--3,21)), (3,4--3,5), + Yes (3,0--3,21), { LeadingKeyword = Let (3,0--3,3) + InlineKeyword = None + EqualsRange = Some (3,17--3,18) })], + (3,0--3,21))], PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, (1,0--3,21), { LeadingKeyword = Module (1,0--1,6) })], (true, true), { ConditionalDirectives = [] CodeComments = [] }, set [])) -(3,12)-(3,14) parse error Expecting type +(3,12)-(3,14) parse error Unexpected symbol '->' in binding diff --git a/tests/service/data/SyntaxTree/SynType/NestedSynTypeOrInsideSynExprTraitCall.fs.bsl b/tests/service/data/SyntaxTree/SynType/NestedSynTypeOrInsideSynExprTraitCall.fs.bsl index b7ea6e3291f..1c58087b0d8 100644 --- a/tests/service/data/SyntaxTree/SynType/NestedSynTypeOrInsideSynExprTraitCall.fs.bsl +++ b/tests/service/data/SyntaxTree/SynType/NestedSynTypeOrInsideSynExprTraitCall.fs.bsl @@ -10,86 +10,93 @@ ImplFile (None, Normal, true, false, [], PreXmlDoc ((2,0), FSharp.Compiler.Xml.XmlDocCollector), SynValData - (None, SynValInfo ([], SynArgInfo ([], false, None)), None), + (None, + SynValInfo + ([[SynArgInfo ([], false, Some x)]], + SynArgInfo ([], false, None)), None), + LongIdent + (SynLongIdent + ([op_BangBang], [], + [Some + (OriginalNotationWithParen + ((2,11--2,12), "!!", (2,14--2,15)))]), None, None, + Pats + [Paren + (Typed + (Named + (SynIdent (x, None), false, None, (2,17--2,18)), + Tuple + (false, + [Type + (Var + (SynTypar (a, HeadType, false), + (2,20--2,22))); Star (2,23--2,24); + Type + (Var + (SynTypar (b, HeadType, false), + (2,25--2,27)))], (2,20--2,27)), + (2,17--2,27)), (2,16--2,28))], None, (2,11--2,28)), + Some + (SynBindingReturnInfo + (Var (SynTypar (c, HeadType, false), (2,31--2,33)), + (2,31--2,33), [], { ColonRange = Some (2,29--2,30) })), Typed - (LongIdent - (SynLongIdent - ([op_BangBang], [], - [Some - (OriginalNotationWithParen - ((2,11--2,12), "!!", (2,14--2,15)))]), None, - None, - Pats - [Paren - (Typed - (Named - (SynIdent (x, None), false, None, - (2,17--2,18)), - Tuple - (false, - [Type - (Var - (SynTypar (a, HeadType, false), - (2,20--2,22))); Star (2,23--2,24); - Type - (Var - (SynTypar (b, HeadType, false), - (2,25--2,27)))], (2,20--2,27)), - (2,17--2,27)), (2,16--2,28))], None, - (2,11--2,28)), - Var (SynTypar (c, HeadType, false), (2,31--2,33)), - (2,11--2,33)), None, - Paren - (TraitCall - (Paren - (Or + (Paren + (TraitCall + (Paren (Or - (Var - (SynTypar (a, HeadType, false), (2,38--2,40)), - Var - (SynTypar (b, HeadType, false), (2,44--2,46)), - (2,38--2,46), { OrKeyword = (2,41--2,43) }), - Var (SynTypar (c, HeadType, false), (2,50--2,52)), - (2,38--2,52), { OrKeyword = (2,47--2,49) }), - (2,37--2,53)), - Member - (SynValSig - ([], SynIdent (op_Implicit, None), - SynValTyparDecls (None, true), - Fun - (Tuple - (false, - [Type - (Var - (SynTypar (a, HeadType, false), - (2,83--2,85))); Star (2,86--2,87); - Type - (Var - (SynTypar (b, HeadType, false), - (2,88--2,90)))], (2,83--2,90)), + (Or + (Var + (SynTypar (a, HeadType, false), + (2,38--2,40)), + Var + (SynTypar (b, HeadType, false), + (2,44--2,46)), (2,38--2,46), + { OrKeyword = (2,41--2,43) }), Var - (SynTypar (c, HeadType, false), (2,94--2,96)), - (2,83--2,96), { ArrowRange = (2,91--2,93) }), - SynValInfo - ([[SynArgInfo ([], false, None); - SynArgInfo ([], false, None)]], - SynArgInfo ([], false, None)), false, false, - PreXmlDoc ((2,56), FSharp.Compiler.Xml.XmlDocCollector), - Single None, None, (2,56--2,96), - { LeadingKeyword = - StaticMember ((2,56--2,62), (2,63--2,69)) - InlineKeyword = None - WithKeyword = None - EqualsRange = None }), - { IsInstance = false - IsDispatchSlot = false - IsOverrideOrExplicitImpl = false - IsFinal = false - GetterOrSetterIsCompilerGenerated = false - MemberKind = Member }, (2,56--2,96), - { GetSetKeywords = None }), Ident x, (2,36--2,100)), - (2,36--2,37), Some (2,99--2,100), (2,36--2,100)), - (2,11--2,33), Yes (2,0--2,100), + (SynTypar (c, HeadType, false), (2,50--2,52)), + (2,38--2,52), { OrKeyword = (2,47--2,49) }), + (2,37--2,53)), + Member + (SynValSig + ([], SynIdent (op_Implicit, None), + SynValTyparDecls (None, true), + Fun + (Tuple + (false, + [Type + (Var + (SynTypar (a, HeadType, false), + (2,83--2,85))); Star (2,86--2,87); + Type + (Var + (SynTypar (b, HeadType, false), + (2,88--2,90)))], (2,83--2,90)), + Var + (SynTypar (c, HeadType, false), + (2,94--2,96)), (2,83--2,96), + { ArrowRange = (2,91--2,93) }), + SynValInfo + ([[SynArgInfo ([], false, None); + SynArgInfo ([], false, None)]], + SynArgInfo ([], false, None)), false, false, + PreXmlDoc ((2,56), FSharp.Compiler.Xml.XmlDocCollector), + Single None, None, (2,56--2,96), + { LeadingKeyword = + StaticMember ((2,56--2,62), (2,63--2,69)) + InlineKeyword = None + WithKeyword = None + EqualsRange = None }), + { IsInstance = false + IsDispatchSlot = false + IsOverrideOrExplicitImpl = false + IsFinal = false + GetterOrSetterIsCompilerGenerated = false + MemberKind = Member }, (2,56--2,96), + { GetSetKeywords = None }), Ident x, (2,36--2,100)), + (2,36--2,37), Some (2,99--2,100), (2,36--2,100)), + Var (SynTypar (c, HeadType, false), (2,31--2,33)), + (2,36--2,100)), (2,11--2,28), NoneAtLet, { LeadingKeyword = Let (2,0--2,3) InlineKeyword = Some (2,4--2,10) EqualsRange = Some (2,34--2,35) })], (2,0--2,100))], diff --git a/tests/service/data/SyntaxTree/SynType/SynTypeOrInsideSynExprTraitCall.fs.bsl b/tests/service/data/SyntaxTree/SynType/SynTypeOrInsideSynExprTraitCall.fs.bsl index 7bab76a4ebd..24fb731523f 100644 --- a/tests/service/data/SyntaxTree/SynType/SynTypeOrInsideSynExprTraitCall.fs.bsl +++ b/tests/service/data/SyntaxTree/SynType/SynTypeOrInsideSynExprTraitCall.fs.bsl @@ -10,64 +10,70 @@ ImplFile (None, Normal, true, false, [], PreXmlDoc ((2,0), FSharp.Compiler.Xml.XmlDocCollector), SynValData - (None, SynValInfo ([], SynArgInfo ([], false, None)), None), + (None, + SynValInfo + ([[SynArgInfo ([], false, Some x)]], + SynArgInfo ([], false, None)), None), + LongIdent + (SynLongIdent + ([op_BangBang], [], + [Some + (OriginalNotationWithParen + ((2,11--2,12), "!!", (2,14--2,15)))]), None, None, + Pats + [Paren + (Typed + (Named + (SynIdent (x, None), false, None, (2,17--2,18)), + Var (SynTypar (a, HeadType, false), (2,20--2,22)), + (2,17--2,22)), (2,16--2,23))], None, (2,11--2,23)), + Some + (SynBindingReturnInfo + (Var (SynTypar (b, HeadType, false), (2,26--2,28)), + (2,26--2,28), [], { ColonRange = Some (2,24--2,25) })), Typed - (LongIdent - (SynLongIdent - ([op_BangBang], [], - [Some - (OriginalNotationWithParen - ((2,11--2,12), "!!", (2,14--2,15)))]), None, - None, - Pats - [Paren - (Typed - (Named - (SynIdent (x, None), false, None, - (2,17--2,18)), - Var - (SynTypar (a, HeadType, false), (2,20--2,22)), - (2,17--2,22)), (2,16--2,23))], None, - (2,11--2,23)), - Var (SynTypar (b, HeadType, false), (2,26--2,28)), - (2,11--2,28)), None, - Paren - (TraitCall - (Paren - (Or - (Var (SynTypar (a, HeadType, false), (2,33--2,35)), - Var (SynTypar (b, HeadType, false), (2,39--2,41)), - (2,33--2,41), { OrKeyword = (2,36--2,38) }), - (2,32--2,42)), - Member - (SynValSig - ([], SynIdent (op_Implicit, None), - SynValTyparDecls (None, true), - Fun + (Paren + (TraitCall + (Paren + (Or (Var - (SynTypar (a, HeadType, false), (2,72--2,74)), + (SynTypar (a, HeadType, false), (2,33--2,35)), Var - (SynTypar (b, HeadType, false), (2,78--2,80)), - (2,72--2,80), { ArrowRange = (2,75--2,77) }), - SynValInfo - ([[SynArgInfo ([], false, None)]], - SynArgInfo ([], false, None)), false, false, - PreXmlDoc ((2,45), FSharp.Compiler.Xml.XmlDocCollector), - Single None, None, (2,45--2,80), - { LeadingKeyword = - StaticMember ((2,45--2,51), (2,52--2,58)) - InlineKeyword = None - WithKeyword = None - EqualsRange = None }), - { IsInstance = false - IsDispatchSlot = false - IsOverrideOrExplicitImpl = false - IsFinal = false - GetterOrSetterIsCompilerGenerated = false - MemberKind = Member }, (2,45--2,80), - { GetSetKeywords = None }), Ident x, (2,31--2,84)), - (2,31--2,32), Some (2,83--2,84), (2,31--2,84)), - (2,11--2,28), Yes (2,0--2,84), + (SynTypar (b, HeadType, false), (2,39--2,41)), + (2,33--2,41), { OrKeyword = (2,36--2,38) }), + (2,32--2,42)), + Member + (SynValSig + ([], SynIdent (op_Implicit, None), + SynValTyparDecls (None, true), + Fun + (Var + (SynTypar (a, HeadType, false), + (2,72--2,74)), + Var + (SynTypar (b, HeadType, false), + (2,78--2,80)), (2,72--2,80), + { ArrowRange = (2,75--2,77) }), + SynValInfo + ([[SynArgInfo ([], false, None)]], + SynArgInfo ([], false, None)), false, false, + PreXmlDoc ((2,45), FSharp.Compiler.Xml.XmlDocCollector), + Single None, None, (2,45--2,80), + { LeadingKeyword = + StaticMember ((2,45--2,51), (2,52--2,58)) + InlineKeyword = None + WithKeyword = None + EqualsRange = None }), + { IsInstance = false + IsDispatchSlot = false + IsOverrideOrExplicitImpl = false + IsFinal = false + GetterOrSetterIsCompilerGenerated = false + MemberKind = Member }, (2,45--2,80), + { GetSetKeywords = None }), Ident x, (2,31--2,84)), + (2,31--2,32), Some (2,83--2,84), (2,31--2,84)), + Var (SynTypar (b, HeadType, false), (2,26--2,28)), + (2,31--2,84)), (2,11--2,23), NoneAtLet, { LeadingKeyword = Let (2,0--2,3) InlineKeyword = Some (2,4--2,10) EqualsRange = Some (2,29--2,30) })], (2,0--2,84))], diff --git a/tests/service/data/SyntaxTree/SynType/SynTypeOrInsideSynTypeConstraintWhereTyparSupportsMember.fs.bsl b/tests/service/data/SyntaxTree/SynType/SynTypeOrInsideSynTypeConstraintWhereTyparSupportsMember.fs.bsl index 819785f04f7..c2de9ccff5c 100644 --- a/tests/service/data/SyntaxTree/SynType/SynTypeOrInsideSynTypeConstraintWhereTyparSupportsMember.fs.bsl +++ b/tests/service/data/SyntaxTree/SynType/SynTypeOrInsideSynTypeConstraintWhereTyparSupportsMember.fs.bsl @@ -13,72 +13,77 @@ ImplFile (None, Normal, true, false, [], PreXmlDoc ((2,0), FSharp.Compiler.Xml.XmlDocCollector), SynValData - (None, SynValInfo ([], SynArgInfo ([], false, None)), None), + (None, SynValInfo ([[]], SynArgInfo ([], false, None)), None), + LongIdent + (SynLongIdent ([f_StaticMethod], [], [None]), None, + Some + (SynValTyparDecls + (Some + (PostfixList + ([SynTyparDecl + ([], SynTypar (T1, None, false), [], + { AmpersandRanges = [] }); + SynTyparDecl + ([], SynTypar (T2, None, false), [], + { AmpersandRanges = [] })], + [WhereTyparSupportsMember + (Paren + (Or + (Var + (SynTypar (T1, None, false), + (2,41--2,44)), + Var + (SynTypar (T2, None, false), + (2,48--2,51)), (2,41--2,51), + { OrKeyword = (2,45--2,47) }), + (2,40--2,52)), + Member + (SynValSig + ([], SynIdent (StaticMethod, None), + SynValTyparDecls (None, true), + Fun + (LongIdent + (SynLongIdent + ([int], [], [None])), + LongIdent + (SynLongIdent + ([int], [], [None])), + (2,84--2,94), + { ArrowRange = (2,88--2,90) }), + SynValInfo + ([[SynArgInfo ([], false, None)]], + SynArgInfo ([], false, None)), + false, false, + PreXmlDoc ((2,56), FSharp.Compiler.Xml.XmlDocCollector), + Single None, None, (2,56--2,94), + { LeadingKeyword = + StaticMember + ((2,56--2,62), (2,63--2,69)) + InlineKeyword = None + WithKeyword = None + EqualsRange = None }), + { IsInstance = false + IsDispatchSlot = false + IsOverrideOrExplicitImpl = false + IsFinal = false + GetterOrSetterIsCompilerGenerated = + false + MemberKind = Member }, (2,56--2,94), + { GetSetKeywords = None }), (2,40--2,95))], + (2,25--2,97))), false)), + Pats [Paren (Const (Unit, (2,97--2,99)), (2,97--2,99))], + None, (2,11--2,99)), + Some + (SynBindingReturnInfo + (LongIdent (SynLongIdent ([int], [], [None])), + (2,102--2,105), [], { ColonRange = Some (2,100--2,101) })), Typed - (LongIdent - (SynLongIdent ([f_StaticMethod], [], [None]), None, - Some - (SynValTyparDecls - (Some - (PostfixList - ([SynTyparDecl - ([], SynTypar (T1, None, false), [], - { AmpersandRanges = [] }); - SynTyparDecl - ([], SynTypar (T2, None, false), [], - { AmpersandRanges = [] })], - [WhereTyparSupportsMember - (Paren - (Or - (Var - (SynTypar (T1, None, false), - (2,41--2,44)), - Var - (SynTypar (T2, None, false), - (2,48--2,51)), (2,41--2,51), - { OrKeyword = (2,45--2,47) }), - (2,40--2,52)), - Member - (SynValSig - ([], SynIdent (StaticMethod, None), - SynValTyparDecls (None, true), - Fun - (LongIdent - (SynLongIdent - ([int], [], [None])), - LongIdent - (SynLongIdent - ([int], [], [None])), - (2,84--2,94), - { ArrowRange = (2,88--2,90) }), - SynValInfo - ([[SynArgInfo ([], false, None)]], - SynArgInfo ([], false, None)), - false, false, - PreXmlDoc ((2,56), FSharp.Compiler.Xml.XmlDocCollector), - Single None, None, (2,56--2,94), - { LeadingKeyword = - StaticMember - ((2,56--2,62), (2,63--2,69)) - InlineKeyword = None - WithKeyword = None - EqualsRange = None }), - { IsInstance = false - IsDispatchSlot = false - IsOverrideOrExplicitImpl = false - IsFinal = false - GetterOrSetterIsCompilerGenerated = - false - MemberKind = Member }, (2,56--2,94), - { GetSetKeywords = None }), - (2,40--2,95))], (2,25--2,97))), false)), - Pats [Paren (Const (Unit, (2,97--2,99)), (2,97--2,99))], - None, (2,11--2,99)), - LongIdent (SynLongIdent ([int], [], [None])), (2,11--2,105)), - None, Const (Unit, (3,4--3,6)), (2,11--2,105), Yes (2,0--3,6), - { LeadingKeyword = Let (2,0--2,3) - InlineKeyword = Some (2,4--2,10) - EqualsRange = Some (2,106--2,107) })], (2,0--3,6))], - PreXmlDocEmpty, [], None, (2,0--4,0), { LeadingKeyword = None })], - (true, true), { ConditionalDirectives = [] - CodeComments = [] }, set [])) + (Const (Unit, (3,4--3,6)), + LongIdent (SynLongIdent ([int], [], [None])), (3,4--3,6)), + (2,11--2,99), NoneAtLet, { LeadingKeyword = Let (2,0--2,3) + InlineKeyword = Some (2,4--2,10) + EqualsRange = Some (2,106--2,107) })], + (2,0--3,6))], PreXmlDocEmpty, [], None, (2,0--4,0), + { LeadingKeyword = None })], (true, true), + { ConditionalDirectives = [] + CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/SynType/Tuple 09.fs.bsl b/tests/service/data/SyntaxTree/SynType/Tuple 09.fs.bsl index 3919481361b..c0d052bcc9f 100644 --- a/tests/service/data/SyntaxTree/SynType/Tuple 09.fs.bsl +++ b/tests/service/data/SyntaxTree/SynType/Tuple 09.fs.bsl @@ -10,8 +10,20 @@ ImplFile PreXmlDoc ((3,0), FSharp.Compiler.Xml.XmlDocCollector), SynValData (None, SynValInfo ([], SynArgInfo ([], false, None)), None), + Wild (3,4--3,5), + Some + (SynBindingReturnInfo + (Fun + (LongIdent (SynLongIdent ([a], [], [None])), + Tuple + (false, + [Type (LongIdent (SynLongIdent ([b], [], [None]))); + Star (3,14--3,15); + Type (FromParseError (3,15--3,15))], (3,12--3,15)), + (3,7--3,17), { ArrowRange = (3,9--3,11) }), + (3,7--3,17), [], { ColonRange = Some (3,5--3,6) })), Typed - (Wild (3,4--3,5), + (Const (Unit, (3,18--3,20)), Fun (LongIdent (SynLongIdent ([a], [], [None])), Tuple @@ -19,8 +31,8 @@ ImplFile [Type (LongIdent (SynLongIdent ([b], [], [None]))); Star (3,14--3,15); Type (FromParseError (3,15--3,15))], (3,12--3,15)), - (3,7--3,15), { ArrowRange = (3,9--3,11) }), (3,4--3,17)), - None, Const (Unit, (3,18--3,20)), (3,4--3,17), Yes (3,0--3,20), + (3,7--3,17), { ArrowRange = (3,9--3,11) }), (3,18--3,20)), + (3,4--3,5), Yes (3,0--3,20), { LeadingKeyword = Let (3,0--3,3) InlineKeyword = None EqualsRange = Some (3,16--3,17) })], (3,0--3,20))], @@ -29,4 +41,4 @@ ImplFile { ConditionalDirectives = [] CodeComments = [] }, set [])) -(3,16)-(3,17) parse error Unexpected symbol '=' in type +(3,16)-(3,17) parse error Unexpected symbol '=' in binding diff --git a/tests/service/data/SyntaxTree/SynType/Tuple 10.fs.bsl b/tests/service/data/SyntaxTree/SynType/Tuple 10.fs.bsl index 0b69f2e2e17..dc553f72214 100644 --- a/tests/service/data/SyntaxTree/SynType/Tuple 10.fs.bsl +++ b/tests/service/data/SyntaxTree/SynType/Tuple 10.fs.bsl @@ -10,8 +10,20 @@ ImplFile PreXmlDoc ((3,0), FSharp.Compiler.Xml.XmlDocCollector), SynValData (None, SynValInfo ([], SynArgInfo ([], false, None)), None), + Wild (3,4--3,5), + Some + (SynBindingReturnInfo + (Fun + (Tuple + (false, + [Type (LongIdent (SynLongIdent ([a], [], [None]))); + Star (3,9--3,10); + Type (FromParseError (3,10--3,10))], (3,7--3,10)), + LongIdent (SynLongIdent ([b], [], [None])), + (3,7--3,15), { ArrowRange = (3,11--3,13) }), + (3,7--3,15), [], { ColonRange = Some (3,5--3,6) })), Typed - (Wild (3,4--3,5), + (Const (Unit, (3,18--3,20)), Fun (Tuple (false, @@ -19,8 +31,8 @@ ImplFile Star (3,9--3,10); Type (FromParseError (3,10--3,10))], (3,7--3,10)), LongIdent (SynLongIdent ([b], [], [None])), (3,7--3,15), - { ArrowRange = (3,11--3,13) }), (3,4--3,15)), None, - Const (Unit, (3,18--3,20)), (3,4--3,15), Yes (3,0--3,20), + { ArrowRange = (3,11--3,13) }), (3,18--3,20)), + (3,4--3,5), Yes (3,0--3,20), { LeadingKeyword = Let (3,0--3,3) InlineKeyword = None EqualsRange = Some (3,16--3,17) })], (3,0--3,20))], @@ -29,4 +41,4 @@ ImplFile { ConditionalDirectives = [] CodeComments = [] }, set [])) -(3,11)-(3,13) parse error Unexpected symbol '->' in type +(3,11)-(3,13) parse error Unexpected symbol '->' in binding diff --git a/tests/service/data/SyntaxTree/SynType/Tuple 11.fs.bsl b/tests/service/data/SyntaxTree/SynType/Tuple 11.fs.bsl index 14e28ee0708..31ca0e7d595 100644 --- a/tests/service/data/SyntaxTree/SynType/Tuple 11.fs.bsl +++ b/tests/service/data/SyntaxTree/SynType/Tuple 11.fs.bsl @@ -10,8 +10,24 @@ ImplFile PreXmlDoc ((3,0), FSharp.Compiler.Xml.XmlDocCollector), SynValData (None, SynValInfo ([], SynArgInfo ([], false, None)), None), + Wild (3,4--3,5), + Some + (SynBindingReturnInfo + (Fun + (LongIdent (SynLongIdent ([a], [], [None])), + Tuple + (false, + [Type + (LongIdent (SynLongIdent ([b1], [], [None]))); + Star (3,15--3,16); + Type + (LongIdent (SynLongIdent ([b2], [], [None]))); + Star (3,20--3,21); + Type (FromParseError (3,21--3,21))], (3,12--3,21)), + (3,7--3,23), { ArrowRange = (3,9--3,11) }), + (3,7--3,23), [], { ColonRange = Some (3,5--3,6) })), Typed - (Wild (3,4--3,5), + (Const (Unit, (3,24--3,26)), Fun (LongIdent (SynLongIdent ([a], [], [None])), Tuple @@ -21,8 +37,8 @@ ImplFile Type (LongIdent (SynLongIdent ([b2], [], [None]))); Star (3,20--3,21); Type (FromParseError (3,21--3,21))], (3,12--3,21)), - (3,7--3,21), { ArrowRange = (3,9--3,11) }), (3,4--3,23)), - None, Const (Unit, (3,24--3,26)), (3,4--3,23), Yes (3,0--3,26), + (3,7--3,23), { ArrowRange = (3,9--3,11) }), (3,24--3,26)), + (3,4--3,5), Yes (3,0--3,26), { LeadingKeyword = Let (3,0--3,3) InlineKeyword = None EqualsRange = Some (3,22--3,23) })], (3,0--3,26))], @@ -31,4 +47,4 @@ ImplFile { ConditionalDirectives = [] CodeComments = [] }, set [])) -(3,22)-(3,23) parse error Unexpected symbol '=' in type +(3,22)-(3,23) parse error Unexpected symbol '=' in binding diff --git a/tests/service/data/SyntaxTree/SynType/Tuple 12.fs.bsl b/tests/service/data/SyntaxTree/SynType/Tuple 12.fs.bsl index 757f5161842..48dd1654f53 100644 --- a/tests/service/data/SyntaxTree/SynType/Tuple 12.fs.bsl +++ b/tests/service/data/SyntaxTree/SynType/Tuple 12.fs.bsl @@ -10,8 +10,24 @@ ImplFile PreXmlDoc ((3,0), FSharp.Compiler.Xml.XmlDocCollector), SynValData (None, SynValInfo ([], SynArgInfo ([], false, None)), None), + Wild (3,4--3,5), + Some + (SynBindingReturnInfo + (Fun + (Tuple + (false, + [Type + (LongIdent (SynLongIdent ([a1], [], [None]))); + Star (3,10--3,11); + Type + (LongIdent (SynLongIdent ([a2], [], [None]))); + Star (3,15--3,16); + Type (FromParseError (3,16--3,16))], (3,7--3,16)), + LongIdent (SynLongIdent ([b], [], [None])), + (3,7--3,21), { ArrowRange = (3,17--3,19) }), + (3,7--3,21), [], { ColonRange = Some (3,5--3,6) })), Typed - (Wild (3,4--3,5), + (Const (Unit, (3,24--3,26)), Fun (Tuple (false, @@ -21,8 +37,8 @@ ImplFile Star (3,15--3,16); Type (FromParseError (3,16--3,16))], (3,7--3,16)), LongIdent (SynLongIdent ([b], [], [None])), (3,7--3,21), - { ArrowRange = (3,17--3,19) }), (3,4--3,21)), None, - Const (Unit, (3,24--3,26)), (3,4--3,21), Yes (3,0--3,26), + { ArrowRange = (3,17--3,19) }), (3,24--3,26)), + (3,4--3,5), Yes (3,0--3,26), { LeadingKeyword = Let (3,0--3,3) InlineKeyword = None EqualsRange = Some (3,22--3,23) })], (3,0--3,26))], @@ -31,4 +47,4 @@ ImplFile { ConditionalDirectives = [] CodeComments = [] }, set [])) -(3,17)-(3,19) parse error Unexpected symbol '->' in type +(3,17)-(3,19) parse error Unexpected symbol '->' in binding diff --git a/tests/service/data/SyntaxTree/SynType/Tuple 13.fs.bsl b/tests/service/data/SyntaxTree/SynType/Tuple 13.fs.bsl index d9a2d48e118..1c4baa1ad5b 100644 --- a/tests/service/data/SyntaxTree/SynType/Tuple 13.fs.bsl +++ b/tests/service/data/SyntaxTree/SynType/Tuple 13.fs.bsl @@ -10,8 +10,25 @@ ImplFile PreXmlDoc ((3,0), FSharp.Compiler.Xml.XmlDocCollector), SynValData (None, SynValInfo ([], SynArgInfo ([], false, None)), None), + Wild (3,4--3,5), + Some + (SynBindingReturnInfo + (Fun + (LongIdent (SynLongIdent ([a], [], [None])), + Tuple + (false, + [Type + (LongIdent (SynLongIdent ([b1], [], [None]))); + Star (3,15--3,16); + Type (FromParseError (3,18--3,18)); + Star (3,17--3,18); + Type + (LongIdent (SynLongIdent ([b3], [], [None])))], + (3,12--3,21)), (3,7--3,21), + { ArrowRange = (3,9--3,11) }), (3,7--3,21), [], + { ColonRange = Some (3,5--3,6) })), Typed - (Wild (3,4--3,5), + (Const (Unit, (3,24--3,26)), Fun (LongIdent (SynLongIdent ([a], [], [None])), Tuple @@ -22,11 +39,11 @@ ImplFile Star (3,17--3,18); Type (LongIdent (SynLongIdent ([b3], [], [None])))], (3,12--3,21)), (3,7--3,21), - { ArrowRange = (3,9--3,11) }), (3,4--3,21)), None, - Const (Unit, (3,24--3,26)), (3,4--3,21), Yes (3,0--3,26), - { LeadingKeyword = Let (3,0--3,3) - InlineKeyword = None - EqualsRange = Some (3,22--3,23) })], (3,0--3,26))], + { ArrowRange = (3,9--3,11) }), (3,24--3,26)), (3,4--3,5), + Yes (3,0--3,26), { LeadingKeyword = Let (3,0--3,3) + InlineKeyword = None + EqualsRange = Some (3,22--3,23) })], + (3,0--3,26))], PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, (1,0--3,26), { LeadingKeyword = Module (1,0--1,6) })], (true, true), { ConditionalDirectives = [] diff --git a/tests/service/data/SyntaxTree/SynType/Tuple 14.fs.bsl b/tests/service/data/SyntaxTree/SynType/Tuple 14.fs.bsl index 04184c9e3de..8f40539042b 100644 --- a/tests/service/data/SyntaxTree/SynType/Tuple 14.fs.bsl +++ b/tests/service/data/SyntaxTree/SynType/Tuple 14.fs.bsl @@ -10,8 +10,25 @@ ImplFile PreXmlDoc ((3,0), FSharp.Compiler.Xml.XmlDocCollector), SynValData (None, SynValInfo ([], SynArgInfo ([], false, None)), None), + Wild (3,4--3,5), + Some + (SynBindingReturnInfo + (Fun + (Tuple + (false, + [Type + (LongIdent (SynLongIdent ([a1], [], [None]))); + Star (3,10--3,11); + Type (FromParseError (3,13--3,13)); + Star (3,12--3,13); + Type + (LongIdent (SynLongIdent ([a3], [], [None])))], + (3,7--3,16)), + LongIdent (SynLongIdent ([b], [], [None])), + (3,7--3,21), { ArrowRange = (3,17--3,19) }), + (3,7--3,21), [], { ColonRange = Some (3,5--3,6) })), Typed - (Wild (3,4--3,5), + (Const (Unit, (3,24--3,26)), Fun (Tuple (false, @@ -22,8 +39,8 @@ ImplFile Type (LongIdent (SynLongIdent ([a3], [], [None])))], (3,7--3,16)), LongIdent (SynLongIdent ([b], [], [None])), (3,7--3,21), - { ArrowRange = (3,17--3,19) }), (3,4--3,21)), None, - Const (Unit, (3,24--3,26)), (3,4--3,21), Yes (3,0--3,26), + { ArrowRange = (3,17--3,19) }), (3,24--3,26)), + (3,4--3,5), Yes (3,0--3,26), { LeadingKeyword = Let (3,0--3,3) InlineKeyword = None EqualsRange = Some (3,22--3,23) })], (3,0--3,26))], diff --git a/tests/service/data/SyntaxTree/Type/SynTypeTupleWithStruct.fs.bsl b/tests/service/data/SyntaxTree/Type/SynTypeTupleWithStruct.fs.bsl index f3d4dde38cf..e0f51c6ee46 100644 --- a/tests/service/data/SyntaxTree/Type/SynTypeTupleWithStruct.fs.bsl +++ b/tests/service/data/SyntaxTree/Type/SynTypeTupleWithStruct.fs.bsl @@ -11,15 +11,24 @@ ImplFile PreXmlDoc ((2,0), FSharp.Compiler.Xml.XmlDocCollector), SynValData (None, SynValInfo ([], SynArgInfo ([], false, None)), None), + Wild (2,4--2,5), + Some + (SynBindingReturnInfo + (Tuple + (true, + [Type (LongIdent (SynLongIdent ([int], [], [None]))); + Star (2,19--2,20); + Type (LongIdent (SynLongIdent ([int], [], [None])))], + (2,7--2,25)), (2,7--2,25), [], + { ColonRange = Some (2,5--2,6) })), Typed - (Wild (2,4--2,5), + (Const (Unit, (2,28--2,30)), Tuple (true, [Type (LongIdent (SynLongIdent ([int], [], [None]))); Star (2,19--2,20); Type (LongIdent (SynLongIdent ([int], [], [None])))], - (2,7--2,25)), (2,4--2,25)), None, - Const (Unit, (2,28--2,30)), (2,4--2,25), Yes (2,0--2,30), + (2,7--2,25)), (2,28--2,30)), (2,4--2,5), Yes (2,0--2,30), { LeadingKeyword = Let (2,0--2,3) InlineKeyword = None EqualsRange = Some (2,26--2,27) })], (2,0--2,30))], diff --git a/tests/service/data/SyntaxTree/Type/SynTypeTupleWithStructRecovery.fs.bsl b/tests/service/data/SyntaxTree/Type/SynTypeTupleWithStructRecovery.fs.bsl index 20330c0d8dc..c69d94938c8 100644 --- a/tests/service/data/SyntaxTree/Type/SynTypeTupleWithStructRecovery.fs.bsl +++ b/tests/service/data/SyntaxTree/Type/SynTypeTupleWithStructRecovery.fs.bsl @@ -11,15 +11,24 @@ ImplFile PreXmlDoc ((2,0), FSharp.Compiler.Xml.XmlDocCollector), SynValData (None, SynValInfo ([], SynArgInfo ([], false, None)), None), + Wild (2,4--2,5), + Some + (SynBindingReturnInfo + (Tuple + (true, + [Type (LongIdent (SynLongIdent ([int], [], [None]))); + Star (2,19--2,20); + Type (LongIdent (SynLongIdent ([int], [], [None])))], + (2,7--2,24)), (2,7--2,26), [], + { ColonRange = Some (2,5--2,6) })), Typed - (Wild (2,4--2,5), + (Const (Unit, (2,27--2,29)), Tuple (true, [Type (LongIdent (SynLongIdent ([int], [], [None]))); Star (2,19--2,20); Type (LongIdent (SynLongIdent ([int], [], [None])))], - (2,7--2,24)), (2,4--2,26)), None, - Const (Unit, (2,27--2,29)), (2,4--2,26), Yes (2,0--2,29), + (2,7--2,24)), (2,27--2,29)), (2,4--2,5), Yes (2,0--2,29), { LeadingKeyword = Let (2,0--2,3) InlineKeyword = None EqualsRange = Some (2,25--2,26) })], (2,0--2,29))], From acb8742beb6ce3999a5ef25ab6665b29e0576976 Mon Sep 17 00:00:00 2001 From: Edgar Gonzalez Date: Sat, 26 Apr 2025 16:34:26 +0100 Subject: [PATCH 11/26] update ce let! and use! test --- .../SyntaxTree/SynType/Typed LetBang 01.fs | 5 ++- .../SynType/Typed LetBang 01.fs.bsl | 38 ++++++++++------- .../SyntaxTree/SynType/Typed LetBang 02.fs | 5 ++- .../SynType/Typed LetBang 02.fs.bsl | 41 +++++++++++-------- .../SyntaxTree/SynType/Typed UseBang 01.fs | 5 ++- .../SynType/Typed UseBang 01.fs.bsl | 38 ++++++++++------- .../SyntaxTree/SynType/Typed UseBang 02.fs | 5 ++- .../SynType/Typed UseBang 02.fs.bsl | 41 +++++++++++-------- 8 files changed, 110 insertions(+), 68 deletions(-) diff --git a/tests/service/data/SyntaxTree/SynType/Typed LetBang 01.fs b/tests/service/data/SyntaxTree/SynType/Typed LetBang 01.fs index 4691c618a8f..4f51c602008 100644 --- a/tests/service/data/SyntaxTree/SynType/Typed LetBang 01.fs +++ b/tests/service/data/SyntaxTree/SynType/Typed LetBang 01.fs @@ -1,3 +1,6 @@ module Module -let! res: Async = () +async { + let! res: Async = () + return () +} 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 873f9c6ad10..ab0696fdb40 100644 --- a/tests/service/data/SyntaxTree/SynType/Typed LetBang 01.fs.bsl +++ b/tests/service/data/SyntaxTree/SynType/Typed LetBang 01.fs.bsl @@ -5,21 +5,29 @@ ImplFile [SynModuleOrNamespace ([Module], false, NamedModule, [Expr - (LetOrUseBang - (Yes (3,0--3,25), false, true, - Typed - (Named (SynIdent (res, None), false, None, (3,5--3,8)), - App - (LongIdent (SynLongIdent ([Async], [], [None])), - Some (3,15--3,16), - [LongIdent (SynLongIdent ([int], [], [None]))], [], - Some (3,19--3,20), false, (3,10--3,20)), (3,5--3,20)), - Const (Unit, (3,23--3,25)), [], ImplicitZero (3,25--3,25), - (3,0--4,0), { LetOrUseBangKeyword = (3,0--3,4) - EqualsRange = Some (3,21--3,22) }), (3,0--4,0))], + (App + (NonAtomic, false, Ident async, + ComputationExpr + (false, + LetOrUseBang + (Yes (4,4--4,29), false, true, + Typed + (LongIdent + (SynLongIdent ([res], [], [None]), None, None, + Pats [], None, (4,9--4,12)), + App + (LongIdent (SynLongIdent ([Async], [], [None])), + Some (4,19--4,20), + [LongIdent (SynLongIdent ([int], [], [None]))], [], + Some (4,23--4,24), false, (4,14--4,24)), + (4,9--4,24)), Const (Unit, (4,27--4,29)), [], + YieldOrReturn + ((false, true), Const (Unit, (5,11--5,13)), (5,4--5,13), + { YieldOrReturnKeyword = (5,4--5,10) }), (4,4--5,13), + { LetOrUseBangKeyword = (4,4--4,8) + EqualsRange = Some (4,25--4,26) }), (3,6--6,1)), + (3,0--6,1)), (3,0--6,1))], PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, - (1,0--4,0), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + (1,0--6,1), { LeadingKeyword = Module (1,0--1,6) })], (true, true), { ConditionalDirectives = [] CodeComments = [] }, set [])) - -(4,0)-(4,0) parse error Incomplete structured construct at or before this point in expression diff --git a/tests/service/data/SyntaxTree/SynType/Typed LetBang 02.fs b/tests/service/data/SyntaxTree/SynType/Typed LetBang 02.fs index d37c56f638c..f3d748b919b 100644 --- a/tests/service/data/SyntaxTree/SynType/Typed LetBang 02.fs +++ b/tests/service/data/SyntaxTree/SynType/Typed LetBang 02.fs @@ -1,3 +1,6 @@ module Module -let! (res: Async) = () +async { + let! (res: Async) = () + return () +} 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 93b4a8822eb..f79c8715624 100644 --- a/tests/service/data/SyntaxTree/SynType/Typed LetBang 02.fs.bsl +++ b/tests/service/data/SyntaxTree/SynType/Typed LetBang 02.fs.bsl @@ -5,23 +5,30 @@ ImplFile [SynModuleOrNamespace ([Module], false, NamedModule, [Expr - (LetOrUseBang - (Yes (3,0--3,27), false, true, - Paren - (Typed - (Named (SynIdent (res, None), false, None, (3,6--3,9)), - App - (LongIdent (SynLongIdent ([Async], [], [None])), - Some (3,16--3,17), - [LongIdent (SynLongIdent ([int], [], [None]))], [], - Some (3,20--3,21), false, (3,11--3,21)), (3,6--3,21)), - (3,5--3,22)), Const (Unit, (3,25--3,27)), [], - ImplicitZero (3,27--3,27), (3,0--4,0), - { LetOrUseBangKeyword = (3,0--3,4) - EqualsRange = Some (3,23--3,24) }), (3,0--4,0))], + (App + (NonAtomic, false, Ident async, + ComputationExpr + (false, + LetOrUseBang + (Yes (4,4--4,31), false, true, + Paren + (Typed + (Named + (SynIdent (res, None), false, None, (4,10--4,13)), + App + (LongIdent (SynLongIdent ([Async], [], [None])), + Some (4,20--4,21), + [LongIdent (SynLongIdent ([int], [], [None]))], + [], Some (4,24--4,25), false, (4,15--4,25)), + (4,10--4,25)), (4,9--4,26)), + Const (Unit, (4,29--4,31)), [], + YieldOrReturn + ((false, true), Const (Unit, (5,11--5,13)), (5,4--5,13), + { YieldOrReturnKeyword = (5,4--5,10) }), (4,4--5,13), + { LetOrUseBangKeyword = (4,4--4,8) + EqualsRange = Some (4,27--4,28) }), (3,6--6,1)), + (3,0--6,1)), (3,0--6,1))], PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, - (1,0--4,0), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + (1,0--6,1), { LeadingKeyword = Module (1,0--1,6) })], (true, true), { ConditionalDirectives = [] CodeComments = [] }, set [])) - -(4,0)-(4,0) parse error Incomplete structured construct at or before this point in expression diff --git a/tests/service/data/SyntaxTree/SynType/Typed UseBang 01.fs b/tests/service/data/SyntaxTree/SynType/Typed UseBang 01.fs index 598b6f6c47c..f850febb981 100644 --- a/tests/service/data/SyntaxTree/SynType/Typed UseBang 01.fs +++ b/tests/service/data/SyntaxTree/SynType/Typed UseBang 01.fs @@ -1,3 +1,6 @@ module Module -use! res: Async = () +async { + use! res: Async = () + return () +} 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 88e4214c49c..7be703c7d14 100644 --- a/tests/service/data/SyntaxTree/SynType/Typed UseBang 01.fs.bsl +++ b/tests/service/data/SyntaxTree/SynType/Typed UseBang 01.fs.bsl @@ -5,21 +5,29 @@ ImplFile [SynModuleOrNamespace ([Module], false, NamedModule, [Expr - (LetOrUseBang - (Yes (3,0--3,25), true, true, - Typed - (Named (SynIdent (res, None), false, None, (3,5--3,8)), - App - (LongIdent (SynLongIdent ([Async], [], [None])), - Some (3,15--3,16), - [LongIdent (SynLongIdent ([int], [], [None]))], [], - Some (3,19--3,20), false, (3,10--3,20)), (3,5--3,20)), - Const (Unit, (3,23--3,25)), [], ImplicitZero (3,25--3,25), - (3,0--4,0), { LetOrUseBangKeyword = (3,0--3,4) - EqualsRange = Some (3,21--3,22) }), (3,0--4,0))], + (App + (NonAtomic, false, Ident async, + ComputationExpr + (false, + LetOrUseBang + (Yes (4,4--4,29), true, true, + Typed + (LongIdent + (SynLongIdent ([res], [], [None]), None, None, + Pats [], None, (4,9--4,12)), + App + (LongIdent (SynLongIdent ([Async], [], [None])), + Some (4,19--4,20), + [LongIdent (SynLongIdent ([int], [], [None]))], [], + Some (4,23--4,24), false, (4,14--4,24)), + (4,9--4,24)), Const (Unit, (4,27--4,29)), [], + YieldOrReturn + ((false, true), Const (Unit, (5,11--5,13)), (5,4--5,13), + { YieldOrReturnKeyword = (5,4--5,10) }), (4,4--5,13), + { LetOrUseBangKeyword = (4,4--4,8) + EqualsRange = Some (4,25--4,26) }), (3,6--6,1)), + (3,0--6,1)), (3,0--6,1))], PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, - (1,0--4,0), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + (1,0--6,1), { LeadingKeyword = Module (1,0--1,6) })], (true, true), { ConditionalDirectives = [] CodeComments = [] }, set [])) - -(4,0)-(4,0) parse error Incomplete structured construct at or before this point in expression diff --git a/tests/service/data/SyntaxTree/SynType/Typed UseBang 02.fs b/tests/service/data/SyntaxTree/SynType/Typed UseBang 02.fs index 563fc095c99..23a3532cbc8 100644 --- a/tests/service/data/SyntaxTree/SynType/Typed UseBang 02.fs +++ b/tests/service/data/SyntaxTree/SynType/Typed UseBang 02.fs @@ -1,3 +1,6 @@ module Module -use! (res: Async) = () +async { + use! (res: Async) = () + return () +} 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 df441b04e73..f8114c0177d 100644 --- a/tests/service/data/SyntaxTree/SynType/Typed UseBang 02.fs.bsl +++ b/tests/service/data/SyntaxTree/SynType/Typed UseBang 02.fs.bsl @@ -5,23 +5,30 @@ ImplFile [SynModuleOrNamespace ([Module], false, NamedModule, [Expr - (LetOrUseBang - (Yes (3,0--3,27), true, true, - Paren - (Typed - (Named (SynIdent (res, None), false, None, (3,6--3,9)), - App - (LongIdent (SynLongIdent ([Async], [], [None])), - Some (3,16--3,17), - [LongIdent (SynLongIdent ([int], [], [None]))], [], - Some (3,20--3,21), false, (3,11--3,21)), (3,6--3,21)), - (3,5--3,22)), Const (Unit, (3,25--3,27)), [], - ImplicitZero (3,27--3,27), (3,0--4,0), - { LetOrUseBangKeyword = (3,0--3,4) - EqualsRange = Some (3,23--3,24) }), (3,0--4,0))], + (App + (NonAtomic, false, Ident async, + ComputationExpr + (false, + LetOrUseBang + (Yes (4,4--4,31), true, true, + Paren + (Typed + (Named + (SynIdent (res, None), false, None, (4,10--4,13)), + App + (LongIdent (SynLongIdent ([Async], [], [None])), + Some (4,20--4,21), + [LongIdent (SynLongIdent ([int], [], [None]))], + [], Some (4,24--4,25), false, (4,15--4,25)), + (4,10--4,25)), (4,9--4,26)), + Const (Unit, (4,29--4,31)), [], + YieldOrReturn + ((false, true), Const (Unit, (5,11--5,13)), (5,4--5,13), + { YieldOrReturnKeyword = (5,4--5,10) }), (4,4--5,13), + { LetOrUseBangKeyword = (4,4--4,8) + EqualsRange = Some (4,27--4,28) }), (3,6--6,1)), + (3,0--6,1)), (3,0--6,1))], PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, - (1,0--4,0), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + (1,0--6,1), { LeadingKeyword = Module (1,0--1,6) })], (true, true), { ConditionalDirectives = [] CodeComments = [] }, set [])) - -(4,0)-(4,0) parse error Incomplete structured construct at or before this point in expression From 3034ffb2cdb761f4134a5405cdb2c85fac1330c7 Mon Sep 17 00:00:00 2001 From: edgargonzalez Date: Mon, 28 Apr 2025 18:51:16 +0100 Subject: [PATCH 12/26] more tests --- .../SyntaxTree/SynType/Typed LetBang 01.fs | 4 +- .../SynType/Typed LetBang 01.fs.bsl | 25 ++-- .../SyntaxTree/SynType/Typed LetBang 02.fs | 4 +- .../SynType/Typed LetBang 02.fs.bsl | 26 ++-- .../SyntaxTree/SynType/Typed LetBang 03.fs | 7 + .../SynType/Typed LetBang 03.fs.bsl | 125 ++++++++++++++++++ .../SyntaxTree/SynType/Typed LetBang 04.fs | 7 + .../SynType/Typed LetBang 04.fs.bsl | 51 +++++++ .../SyntaxTree/SynType/Typed LetBang 05.fs | 3 + .../SynType/Typed LetBang 05.fs.bsl | 49 +++++++ .../SyntaxTree/SynType/Typed UseBang 01.fs | 4 +- .../SynType/Typed UseBang 01.fs.bsl | 25 ++-- .../SyntaxTree/SynType/Typed UseBang 02.fs | 4 +- .../SynType/Typed UseBang 02.fs.bsl | 26 ++-- .../SyntaxTree/SynType/Typed UseBang 03.fs | 4 + .../SynType/Typed UseBang 03.fs.bsl | 49 +++++++ 16 files changed, 363 insertions(+), 50 deletions(-) create mode 100644 tests/service/data/SyntaxTree/SynType/Typed LetBang 03.fs create mode 100644 tests/service/data/SyntaxTree/SynType/Typed LetBang 03.fs.bsl create mode 100644 tests/service/data/SyntaxTree/SynType/Typed LetBang 04.fs create mode 100644 tests/service/data/SyntaxTree/SynType/Typed LetBang 04.fs.bsl create mode 100644 tests/service/data/SyntaxTree/SynType/Typed LetBang 05.fs create mode 100644 tests/service/data/SyntaxTree/SynType/Typed LetBang 05.fs.bsl create mode 100644 tests/service/data/SyntaxTree/SynType/Typed UseBang 03.fs create mode 100644 tests/service/data/SyntaxTree/SynType/Typed UseBang 03.fs.bsl diff --git a/tests/service/data/SyntaxTree/SynType/Typed LetBang 01.fs b/tests/service/data/SyntaxTree/SynType/Typed LetBang 01.fs index 4f51c602008..f191f7aee2b 100644 --- a/tests/service/data/SyntaxTree/SynType/Typed LetBang 01.fs +++ b/tests/service/data/SyntaxTree/SynType/Typed LetBang 01.fs @@ -1,6 +1,6 @@ module Module async { - let! res: Async = () - return () + let! res: int = async { return 1 } + return res } 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 ab0696fdb40..c27d957c755 100644 --- a/tests/service/data/SyntaxTree/SynType/Typed LetBang 01.fs.bsl +++ b/tests/service/data/SyntaxTree/SynType/Typed LetBang 01.fs.bsl @@ -10,22 +10,27 @@ ImplFile ComputationExpr (false, LetOrUseBang - (Yes (4,4--4,29), false, true, + (Yes (4,4--4,38), false, true, Typed (LongIdent (SynLongIdent ([res], [], [None]), None, None, Pats [], None, (4,9--4,12)), - App - (LongIdent (SynLongIdent ([Async], [], [None])), - Some (4,19--4,20), - [LongIdent (SynLongIdent ([int], [], [None]))], [], - Some (4,23--4,24), false, (4,14--4,24)), - (4,9--4,24)), Const (Unit, (4,27--4,29)), [], + 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)), [], YieldOrReturn - ((false, true), Const (Unit, (5,11--5,13)), (5,4--5,13), - { YieldOrReturnKeyword = (5,4--5,10) }), (4,4--5,13), + ((false, true), Ident res, (5,4--5,14), + { YieldOrReturnKeyword = (5,4--5,10) }), (4,4--5,14), { LetOrUseBangKeyword = (4,4--4,8) - EqualsRange = Some (4,25--4,26) }), (3,6--6,1)), + EqualsRange = Some (4,18--4,19) }), (3,6--6,1)), (3,0--6,1)), (3,0--6,1))], PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, (1,0--6,1), { LeadingKeyword = Module (1,0--1,6) })], (true, true), diff --git a/tests/service/data/SyntaxTree/SynType/Typed LetBang 02.fs b/tests/service/data/SyntaxTree/SynType/Typed LetBang 02.fs index f3d748b919b..4d58841b1d6 100644 --- a/tests/service/data/SyntaxTree/SynType/Typed LetBang 02.fs +++ b/tests/service/data/SyntaxTree/SynType/Typed LetBang 02.fs @@ -1,6 +1,6 @@ module Module async { - let! (res: Async) = () - return () + let! (res: int) = async { return 1 } + return res } 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 f79c8715624..189efbc20c6 100644 --- a/tests/service/data/SyntaxTree/SynType/Typed LetBang 02.fs.bsl +++ b/tests/service/data/SyntaxTree/SynType/Typed LetBang 02.fs.bsl @@ -10,23 +10,27 @@ ImplFile ComputationExpr (false, LetOrUseBang - (Yes (4,4--4,31), false, true, + (Yes (4,4--4,40), false, true, Paren (Typed (Named (SynIdent (res, None), false, None, (4,10--4,13)), - App - (LongIdent (SynLongIdent ([Async], [], [None])), - Some (4,20--4,21), - [LongIdent (SynLongIdent ([int], [], [None]))], - [], Some (4,24--4,25), false, (4,15--4,25)), - (4,10--4,25)), (4,9--4,26)), - Const (Unit, (4,29--4,31)), [], + 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)), [], YieldOrReturn - ((false, true), Const (Unit, (5,11--5,13)), (5,4--5,13), - { YieldOrReturnKeyword = (5,4--5,10) }), (4,4--5,13), + ((false, true), Ident res, (5,4--5,14), + { YieldOrReturnKeyword = (5,4--5,10) }), (4,4--5,14), { LetOrUseBangKeyword = (4,4--4,8) - EqualsRange = Some (4,27--4,28) }), (3,6--6,1)), + EqualsRange = Some (4,20--4,21) }), (3,6--6,1)), (3,0--6,1)), (3,0--6,1))], PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, (1,0--6,1), { LeadingKeyword = Module (1,0--1,6) })], (true, true), diff --git a/tests/service/data/SyntaxTree/SynType/Typed LetBang 03.fs b/tests/service/data/SyntaxTree/SynType/Typed LetBang 03.fs new file mode 100644 index 00000000000..5c5e72047cc --- /dev/null +++ b/tests/service/data/SyntaxTree/SynType/Typed LetBang 03.fs @@ -0,0 +1,7 @@ +module Module + +async { + let (a: int, b: int) = 1, 3 + let! (c: int, d: int) = async { return 1, 3 } + return a + b + c + d +} diff --git a/tests/service/data/SyntaxTree/SynType/Typed LetBang 03.fs.bsl b/tests/service/data/SyntaxTree/SynType/Typed LetBang 03.fs.bsl new file mode 100644 index 00000000000..ae8313afb7a --- /dev/null +++ b/tests/service/data/SyntaxTree/SynType/Typed LetBang 03.fs.bsl @@ -0,0 +1,125 @@ +ImplFile + (ParsedImplFileInput + ("/root/SynType/Typed LetBang 03.fs", false, QualifiedNameOfFile Module, [], + [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Expr + (App + (NonAtomic, false, Ident async, + ComputationExpr + (false, + LetOrUse + (false, false, + [SynBinding + (None, Normal, false, false, [], + PreXmlDoc ((4,4), FSharp.Compiler.Xml.XmlDocCollector), + SynValData + (None, + SynValInfo ([], SynArgInfo ([], false, None)), + None), + Paren + (Tuple + (false, + [Typed + (Named + (SynIdent (a, None), false, None, + (4,9--4,10)), + LongIdent + (SynLongIdent ([int], [], [None])), + (4,9--4,15)); + Typed + (Named + (SynIdent (b, None), false, None, + (4,17--4,18)), + LongIdent + (SynLongIdent ([int], [], [None])), + (4,17--4,23))], [(4,15--4,16)], (4,9--4,23)), + (4,8--4,24)), None, + Tuple + (false, + [Const (Int32 1, (4,27--4,28)); + Const (Int32 3, (4,30--4,31))], [(4,28--4,29)], + (4,27--4,31)), (4,8--4,24), Yes (4,4--4,31), + { 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)), [], + YieldOrReturn + ((false, true), + App + (NonAtomic, false, + App + (NonAtomic, true, + LongIdent + (false, + SynLongIdent + ([op_Addition], [], + [Some (OriginalNotation "+")]), None, + (6,21--6,22)), + App + (NonAtomic, false, + App + (NonAtomic, true, + LongIdent + (false, + SynLongIdent + ([op_Addition], [], + [Some (OriginalNotation "+")]), + None, (6,17--6,18)), + App + (NonAtomic, false, + App + (NonAtomic, true, + LongIdent + (false, + SynLongIdent + ([op_Addition], [], + [Some + (OriginalNotation "+")]), + None, (6,13--6,14)), Ident a, + (6,11--6,14)), Ident b, + (6,11--6,16)), (6,11--6,18)), + Ident c, (6,11--6,20)), (6,11--6,22)), + Ident d, (6,11--6,24)), (6,4--6,24), + { YieldOrReturnKeyword = (6,4--6,10) }), + (5,4--6,24), { LetOrUseBangKeyword = (5,4--5,8) + EqualsRange = Some (5,26--5,27) }), + (4,4--6,24), { LetOrUseKeyword = (4,4--4,7) + InKeyword = None }), (3,6--7,1)), + (3,0--7,1)), (3,0--7,1))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--7,1), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/SynType/Typed LetBang 04.fs b/tests/service/data/SyntaxTree/SynType/Typed LetBang 04.fs new file mode 100644 index 00000000000..2a1e0319849 --- /dev/null +++ b/tests/service/data/SyntaxTree/SynType/Typed LetBang 04.fs @@ -0,0 +1,7 @@ +module Module + +async { + let a: int, b: int = 1, 3 + let! c: int, d: int = async { return 1, 3 } + return a + b + c + d +} \ No newline at end of file diff --git a/tests/service/data/SyntaxTree/SynType/Typed LetBang 04.fs.bsl b/tests/service/data/SyntaxTree/SynType/Typed LetBang 04.fs.bsl new file mode 100644 index 00000000000..2c81842ee99 --- /dev/null +++ b/tests/service/data/SyntaxTree/SynType/Typed LetBang 04.fs.bsl @@ -0,0 +1,51 @@ +ImplFile + (ParsedImplFileInput + ("/root/SynType/Typed LetBang 04.fs", false, QualifiedNameOfFile Module, [], + [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Expr + (App + (NonAtomic, false, Ident async, + ComputationExpr + (false, + Tuple + (false, + [LetOrUse + (false, 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,8--4,9)), + Some + (SynBindingReturnInfo + (LongIdent + (SynLongIdent ([int], [], [None])), + (4,11--4,14), [], + { ColonRange = Some (4,9--4,10) })), + Typed + (ArbitraryAfterError + ("localBinding2", (4,14--4,14)), + LongIdent (SynLongIdent ([int], [], [None])), + (4,14--4,14)), (4,8--4,9), Yes (4,4--4,14), + { LeadingKeyword = Let (4,4--4,7) + InlineKeyword = None + EqualsRange = None })], + ArbitraryAfterError ("declExpr3", (5,15--5,16)), + (4,4--5,16), { LetOrUseKeyword = (4,4--4,7) + InKeyword = None }); Ident d], + [(5,15--5,16)], (4,4--5,18)), (3,6--5,47)), (3,0--5,47)), + (3,0--5,47))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--5,47), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + CodeComments = [] }, set [])) + +(4,14)-(4,15) parse error Unexpected symbol ',' in binding. Expected '=' or other token. +(5,15)-(5,16) parse error Unexpected symbol ',' in expression. Expected '=' or other token. +(6,4)-(6,10) parse error Incomplete structured construct at or before this point in implementation file diff --git a/tests/service/data/SyntaxTree/SynType/Typed LetBang 05.fs b/tests/service/data/SyntaxTree/SynType/Typed LetBang 05.fs new file mode 100644 index 00000000000..be48e42bb81 --- /dev/null +++ b/tests/service/data/SyntaxTree/SynType/Typed LetBang 05.fs @@ -0,0 +1,3 @@ +module Module +let! x:int = async { return 1 } +let! (y:int) = async { return 2 } \ No newline at end of file diff --git a/tests/service/data/SyntaxTree/SynType/Typed LetBang 05.fs.bsl b/tests/service/data/SyntaxTree/SynType/Typed LetBang 05.fs.bsl new file mode 100644 index 00000000000..9cf94952355 --- /dev/null +++ b/tests/service/data/SyntaxTree/SynType/Typed LetBang 05.fs.bsl @@ -0,0 +1,49 @@ +ImplFile + (ParsedImplFileInput + ("/root/SynType/Typed LetBang 05.fs", false, QualifiedNameOfFile Module, [], + [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Expr + (LetOrUseBang + (Yes (2,0--2,31), false, true, + Typed + (LongIdent + (SynLongIdent ([x], [], [None]), None, None, Pats [], 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)), [], + ImplicitZero (3,33--3,33), (3,0--3,33), + { LetOrUseBangKeyword = (3,0--3,4) + EqualsRange = Some (3,13--3,14) }), (2,0--3,33), + { LetOrUseBangKeyword = (2,0--2,4) + EqualsRange = Some (2,11--2,12) }), (2,0--3,33))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--3,33), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + CodeComments = [] }, set [])) + +(3,0)-(3,33) parse error Incomplete structured construct at or before this point in expression diff --git a/tests/service/data/SyntaxTree/SynType/Typed UseBang 01.fs b/tests/service/data/SyntaxTree/SynType/Typed UseBang 01.fs index f850febb981..840c1678319 100644 --- a/tests/service/data/SyntaxTree/SynType/Typed UseBang 01.fs +++ b/tests/service/data/SyntaxTree/SynType/Typed UseBang 01.fs @@ -1,6 +1,6 @@ module Module async { - use! res: Async = () - return () + use! res: int = async { return 1 } + return res } 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 7be703c7d14..756962e888c 100644 --- a/tests/service/data/SyntaxTree/SynType/Typed UseBang 01.fs.bsl +++ b/tests/service/data/SyntaxTree/SynType/Typed UseBang 01.fs.bsl @@ -10,22 +10,27 @@ ImplFile ComputationExpr (false, LetOrUseBang - (Yes (4,4--4,29), true, true, + (Yes (4,4--4,38), true, true, Typed (LongIdent (SynLongIdent ([res], [], [None]), None, None, Pats [], None, (4,9--4,12)), - App - (LongIdent (SynLongIdent ([Async], [], [None])), - Some (4,19--4,20), - [LongIdent (SynLongIdent ([int], [], [None]))], [], - Some (4,23--4,24), false, (4,14--4,24)), - (4,9--4,24)), Const (Unit, (4,27--4,29)), [], + 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)), [], YieldOrReturn - ((false, true), Const (Unit, (5,11--5,13)), (5,4--5,13), - { YieldOrReturnKeyword = (5,4--5,10) }), (4,4--5,13), + ((false, true), Ident res, (5,4--5,14), + { YieldOrReturnKeyword = (5,4--5,10) }), (4,4--5,14), { LetOrUseBangKeyword = (4,4--4,8) - EqualsRange = Some (4,25--4,26) }), (3,6--6,1)), + EqualsRange = Some (4,18--4,19) }), (3,6--6,1)), (3,0--6,1)), (3,0--6,1))], PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, (1,0--6,1), { LeadingKeyword = Module (1,0--1,6) })], (true, true), diff --git a/tests/service/data/SyntaxTree/SynType/Typed UseBang 02.fs b/tests/service/data/SyntaxTree/SynType/Typed UseBang 02.fs index 23a3532cbc8..cf1f75dc46c 100644 --- a/tests/service/data/SyntaxTree/SynType/Typed UseBang 02.fs +++ b/tests/service/data/SyntaxTree/SynType/Typed UseBang 02.fs @@ -1,6 +1,6 @@ module Module async { - use! (res: Async) = () - return () + use! (res: int) = async { return 1 } + return res } 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 f8114c0177d..a28de2ddb58 100644 --- a/tests/service/data/SyntaxTree/SynType/Typed UseBang 02.fs.bsl +++ b/tests/service/data/SyntaxTree/SynType/Typed UseBang 02.fs.bsl @@ -10,23 +10,27 @@ ImplFile ComputationExpr (false, LetOrUseBang - (Yes (4,4--4,31), true, true, + (Yes (4,4--4,40), true, true, Paren (Typed (Named (SynIdent (res, None), false, None, (4,10--4,13)), - App - (LongIdent (SynLongIdent ([Async], [], [None])), - Some (4,20--4,21), - [LongIdent (SynLongIdent ([int], [], [None]))], - [], Some (4,24--4,25), false, (4,15--4,25)), - (4,10--4,25)), (4,9--4,26)), - Const (Unit, (4,29--4,31)), [], + 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)), [], YieldOrReturn - ((false, true), Const (Unit, (5,11--5,13)), (5,4--5,13), - { YieldOrReturnKeyword = (5,4--5,10) }), (4,4--5,13), + ((false, true), Ident res, (5,4--5,14), + { YieldOrReturnKeyword = (5,4--5,10) }), (4,4--5,14), { LetOrUseBangKeyword = (4,4--4,8) - EqualsRange = Some (4,27--4,28) }), (3,6--6,1)), + EqualsRange = Some (4,20--4,21) }), (3,6--6,1)), (3,0--6,1)), (3,0--6,1))], PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, (1,0--6,1), { LeadingKeyword = Module (1,0--1,6) })], (true, true), diff --git a/tests/service/data/SyntaxTree/SynType/Typed UseBang 03.fs b/tests/service/data/SyntaxTree/SynType/Typed UseBang 03.fs new file mode 100644 index 00000000000..c0f2a3eb394 --- /dev/null +++ b/tests/service/data/SyntaxTree/SynType/Typed UseBang 03.fs @@ -0,0 +1,4 @@ +module Module + +use! x:int = async { return 1 } +use! (y:int) = async { return 2 } \ No newline at end of file diff --git a/tests/service/data/SyntaxTree/SynType/Typed UseBang 03.fs.bsl b/tests/service/data/SyntaxTree/SynType/Typed UseBang 03.fs.bsl new file mode 100644 index 00000000000..7b06005a232 --- /dev/null +++ b/tests/service/data/SyntaxTree/SynType/Typed UseBang 03.fs.bsl @@ -0,0 +1,49 @@ +ImplFile + (ParsedImplFileInput + ("/root/SynType/Typed UseBang 03.fs", false, QualifiedNameOfFile Module, [], + [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Expr + (LetOrUseBang + (Yes (3,0--3,31), true, true, + Typed + (LongIdent + (SynLongIdent ([x], [], [None]), None, None, Pats [], 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)), [], + ImplicitZero (4,33--4,33), (4,0--4,33), + { LetOrUseBangKeyword = (4,0--4,4) + EqualsRange = Some (4,13--4,14) }), (3,0--4,33), + { LetOrUseBangKeyword = (3,0--3,4) + EqualsRange = Some (3,11--3,12) }), (3,0--4,33))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--4,33), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + CodeComments = [] }, set [])) + +(4,0)-(4,33) parse error Incomplete structured construct at or before this point in expression From 99cc8d4c102898799a1d3cd500ab76351c0fdf46 Mon Sep 17 00:00:00 2001 From: edgargonzalez Date: Mon, 28 Apr 2025 18:51:53 +0100 Subject: [PATCH 13/26] reduce diff --- src/Compiler/pars.fsy | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/src/Compiler/pars.fsy b/src/Compiler/pars.fsy index 805e1f9dd17..f1f20815b7b 100644 --- a/src/Compiler/pars.fsy +++ b/src/Compiler/pars.fsy @@ -4453,9 +4453,17 @@ declExpr: let trivia: SynExprLetOrUseBangTrivia = { LetOrUseBangKeyword = rhs parseState 1 ; EqualsRange = Some mEquals } SynExpr.LetOrUseBang(spBind, ($1 = "use"), true, $2, $4, $7, $8, m, trivia) } + | OBINDER headBindingPattern EQUALS typedSequentialExprBlock hardwhiteDefnBindingsTerminator opt_OBLOCKSEP moreBinders typedSequentialExprBlock %prec expr_let + { let report, mIn, _ = $5 + report (if $1 = "use" then "use!" else "let!") (rhs parseState 1) // report unterminated error + let spBind = DebugPointAtBinding.Yes(unionRanges (rhs parseState 1) $4.Range) + let mEquals = rhs parseState 3 + let m = unionRanges (rhs parseState 1) $8.Range + let trivia: SynExprLetOrUseBangTrivia = { LetOrUseBangKeyword = rhs parseState 1 ; EqualsRange = Some mEquals } + SynExpr.LetOrUseBang(spBind, ($1 = "use"), true, $2, $4, $7, $8, m, trivia) } + | BINDER atomicPatternLongIdent COLON typeWithTypeConstraints EQUALS typedSequentialExprBlock IN opt_OBLOCKSEP moreBinders typedSequentialExprBlock %prec expr_let - { - // Handle type annotations on simple identifier patterns in let!/use! bindings + { // Handle type annotations on simple identifier patterns in let!/use! bindings let spBind = DebugPointAtBinding.Yes(rhs2 parseState 1 7) let vis, lidwd = $2 let pat = mkSynPatMaybeVar lidwd vis (rhs parseState 2) @@ -4465,18 +4473,8 @@ declExpr: let trivia: SynExprLetOrUseBangTrivia = { LetOrUseBangKeyword = rhs parseState 1 ; EqualsRange = Some mEquals } SynExpr.LetOrUseBang(spBind, ($1 = "use"), true, pat, $6, $9, $10, m, trivia) } - | OBINDER headBindingPattern EQUALS typedSequentialExprBlock hardwhiteDefnBindingsTerminator opt_OBLOCKSEP moreBinders typedSequentialExprBlock %prec expr_let - { let report, mIn, _ = $5 - report (if $1 = "use" then "use!" else "let!") (rhs parseState 1) // report unterminated error - let spBind = DebugPointAtBinding.Yes(unionRanges (rhs parseState 1) $4.Range) - let mEquals = rhs parseState 3 - let m = unionRanges (rhs parseState 1) $8.Range - let trivia: SynExprLetOrUseBangTrivia = { LetOrUseBangKeyword = rhs parseState 1 ; EqualsRange = Some mEquals } - SynExpr.LetOrUseBang(spBind, ($1 = "use"), true, $2, $4, $7, $8, m, trivia) } - | OBINDER atomicPatternLongIdent COLON typeWithTypeConstraints EQUALS typedSequentialExprBlock hardwhiteDefnBindingsTerminator opt_OBLOCKSEP moreBinders typedSequentialExprBlock %prec expr_let - { - // Handle type annotations on simple identifier patterns in let!/use! bindings (offside-sensitive version) + { // Handle type annotations on simple identifier patterns in let!/use! bindings (offside-sensitive version) let report, mIn, _ = $7 report (if $1 = "use" then "use!" else "let!") (rhs parseState 1) // report unterminated error let spBind = DebugPointAtBinding.Yes(unionRanges (rhs parseState 1) $6.Range) From dd416dce0114c8a8b328309590423fb009cf2a4a Mon Sep 17 00:00:00 2001 From: edgargonzalez Date: Mon, 28 Apr 2025 18:53:52 +0100 Subject: [PATCH 14/26] 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 7224d401d6e..4a00c06fdd2 100644 --- a/docs/release-notes/.FSharp.Compiler.Service/9.0.300.md +++ b/docs/release-notes/.FSharp.Compiler.Service/9.0.300.md @@ -26,6 +26,7 @@ * Fix confusing type inference error in task expression ([Issue #13789](https://github.com/dotnet/fsharp/issues/13789), [PR #18450](https://github.com/dotnet/fsharp/pull/18450)) * Fix missing `null` highlighting in tooltips ([PR #18457](https://github.com/dotnet/fsharp/pull/18457)) * Allow `_` in `use!` bindings values (lift FS1228 restriction) ([PR #18487](https://github.com/dotnet/fsharp/pull/18487)) +* Allow `let!` and `use!` binding with type annotation without parentheses. ([PR #18508](https://github.com/dotnet/fsharp/pull/18508)) * Make `[]` combination work([PR #18444](https://github.com/dotnet/fsharp/pull/18444/)) ### Added From e54cb12cd10778bbfacc1455056f6924ada93262 Mon Sep 17 00:00:00 2001 From: edgargonzalez Date: Wed, 30 Apr 2025 18:09:31 +0100 Subject: [PATCH 15/26] more tests --- .../UseBindings/UseBinding01.fs | 7 +++++ .../UseBindings/UseBinding02.fs | 26 +++++++++++++++++++ .../UseBindings/UseBindingDiscard03.fs | 26 +++++++++++++++++++ .../UseBindings/UseBindings.fs | 23 +++++++++++++++- .../Language/ComputationExpressionTests.fs | 15 ----------- 5 files changed, 81 insertions(+), 16 deletions(-) create mode 100644 tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/UseBindings/UseBinding01.fs create mode 100644 tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/UseBindings/UseBinding02.fs create mode 100644 tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/UseBindings/UseBindingDiscard03.fs diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/UseBindings/UseBinding01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/UseBindings/UseBinding01.fs new file mode 100644 index 00000000000..4fbe7575b3a --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/UseBindings/UseBinding01.fs @@ -0,0 +1,7 @@ +// #DeclarationElements #LetBindings +// +open System + +let answer = + use x:IDisposable = new System.IO.MemoryStream() + 42 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/UseBindings/UseBinding02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/UseBindings/UseBinding02.fs new file mode 100644 index 00000000000..be6cf7b8399 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/UseBindings/UseBinding02.fs @@ -0,0 +1,26 @@ +open System + +type private Disposable() = + [] static val mutable private disposedTimes: int + [] static val mutable private constructedTimes: int + + do Disposable.constructedTimes <- Disposable.constructedTimes + 1 + + static member DisposeCallCount() = Disposable.disposedTimes + static member ConstructorCallCount() = Disposable.constructedTimes + + interface System.IDisposable with + member _.Dispose() = + Disposable.disposedTimes <- Disposable.disposedTimes + 1 + +let _scope = + use x: IDisposable = new Disposable() + () + +let disposeCalls = Disposable.DisposeCallCount() +if disposeCalls <> 1 then + failwith "was not disposed or disposed too many times" + +let ctorCalls = Disposable.ConstructorCallCount() +if ctorCalls <> 1 then + failwithf "unexpected constructor call count: %i" ctorCalls diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/UseBindings/UseBindingDiscard03.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/UseBindings/UseBindingDiscard03.fs new file mode 100644 index 00000000000..840870377fe --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/UseBindings/UseBindingDiscard03.fs @@ -0,0 +1,26 @@ +open System + +type private Disposable() = + [] static val mutable private disposedTimes: int + [] static val mutable private constructedTimes: int + + do Disposable.constructedTimes <- Disposable.constructedTimes + 1 + + static member DisposeCallCount() = Disposable.disposedTimes + static member ConstructorCallCount() = Disposable.constructedTimes + + interface System.IDisposable with + member _.Dispose() = + Disposable.disposedTimes <- Disposable.disposedTimes + 1 + +let _scope = + use _:IDisposable = new Disposable() + () + +let disposeCalls = Disposable.DisposeCallCount() +if disposeCalls <> 1 then + failwith "was not disposed or disposed too many times" + +let ctorCalls = Disposable.ConstructorCallCount() +if ctorCalls <> 1 then + failwithf "unexpected constructor call count: %i" ctorCalls diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/UseBindings/UseBindings.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/UseBindings/UseBindings.fs index 74137286a8a..b1e08869312 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/UseBindings/UseBindings.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/UseBindings/UseBindings.fs @@ -33,4 +33,25 @@ module UseBindings = |> asExe |> withLangVersion60 |> compileAndRun - |> shouldSucceed \ No newline at end of file + |> shouldSucceed + + [] + let ``UseBindings - UseBindingDiscard03_fs - Current LangVersion`` compilation = + compilation + |> asExe + |> compileAndRun + |> shouldSucceed + + [] + let ``UseBindings - UseBinding01_fs - Current LangVersion`` compilation = + compilation + |> asFsx + |> compile + |> shouldSucceed + + [] + let ``UseBindings - UseBinding02_fs - Current LangVersion`` compilation = + compilation + |> asFsx + |> compile + |> shouldSucceed diff --git a/tests/FSharp.Compiler.ComponentTests/Language/ComputationExpressionTests.fs b/tests/FSharp.Compiler.ComponentTests/Language/ComputationExpressionTests.fs index ff364d6c18a..6b0a260a42f 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/ComputationExpressionTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/ComputationExpressionTests.fs @@ -22,21 +22,6 @@ let x = lb {1; 2;} |> compile |> shouldSucceed |> ignore - - [] - let ``Allow let! and use! binding with type annotation without parentheses.``() = - FSharp """ -module ComputationExpressionTests -let f = - async { - let! (a: int) = async { return 1 } - let! b: int = async { return 1 } - return a - } - """ - |> typecheck - |> shouldSucceed - |> ignore [] let ``A CE explicitly using Zero fails without a defined Zero``() = From e608ce6037d997d19a0885f619007bf67f2b2bc1 Mon Sep 17 00:00:00 2001 From: edgargonzalez Date: Thu, 1 May 2025 17:32:20 +0100 Subject: [PATCH 16/26] try headBindingPattern --- src/Compiler/pars.fsy | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/Compiler/pars.fsy b/src/Compiler/pars.fsy index f1f20815b7b..e961b7065d7 100644 --- a/src/Compiler/pars.fsy +++ b/src/Compiler/pars.fsy @@ -4462,25 +4462,24 @@ declExpr: let trivia: SynExprLetOrUseBangTrivia = { LetOrUseBangKeyword = rhs parseState 1 ; EqualsRange = Some mEquals } SynExpr.LetOrUseBang(spBind, ($1 = "use"), true, $2, $4, $7, $8, m, trivia) } - | BINDER atomicPatternLongIdent COLON typeWithTypeConstraints EQUALS typedSequentialExprBlock IN opt_OBLOCKSEP moreBinders typedSequentialExprBlock %prec expr_let - { // Handle type annotations on simple identifier patterns in let!/use! bindings + | BINDER headBindingPattern COLON typeWithTypeConstraints EQUALS typedSequentialExprBlock IN opt_OBLOCKSEP moreBinders typedSequentialExprBlock %prec expr_let + { // Handle type annotations on patterns in let!/use! bindings + // Examples: let! x: int = async { return 1 } + // use! _: IDisposable = async { return new MemoryStream() } let spBind = DebugPointAtBinding.Yes(rhs2 parseState 1 7) - let vis, lidwd = $2 - let pat = mkSynPatMaybeVar lidwd vis (rhs parseState 2) - let pat = SynPat.Typed(pat, $4, unionRanges pat.Range $4.Range) + let pat = SynPat.Typed($2, $4, unionRanges $2.Range $4.Range) let mEquals = rhs parseState 5 let m = unionRanges (rhs parseState 1) $10.Range let trivia: SynExprLetOrUseBangTrivia = { LetOrUseBangKeyword = rhs parseState 1 ; EqualsRange = Some mEquals } SynExpr.LetOrUseBang(spBind, ($1 = "use"), true, pat, $6, $9, $10, m, trivia) } - | OBINDER atomicPatternLongIdent COLON typeWithTypeConstraints EQUALS typedSequentialExprBlock hardwhiteDefnBindingsTerminator opt_OBLOCKSEP moreBinders typedSequentialExprBlock %prec expr_let - { // Handle type annotations on simple identifier patterns in let!/use! bindings (offside-sensitive version) + | OBINDER headBindingPattern COLON typeWithTypeConstraints EQUALS typedSequentialExprBlock hardwhiteDefnBindingsTerminator opt_OBLOCKSEP moreBinders typedSequentialExprBlock %prec expr_let + { // Handle type annotations on patterns in let!/use! bindings (offside-sensitive version) + // This rule maintains consistent handling of binding constructs across different syntactic contexts let report, mIn, _ = $7 report (if $1 = "use" then "use!" else "let!") (rhs parseState 1) // report unterminated error let spBind = DebugPointAtBinding.Yes(unionRanges (rhs parseState 1) $6.Range) - let vis, lidwd = $2 - let pat = mkSynPatMaybeVar lidwd vis (rhs parseState 2) - let pat = SynPat.Typed(pat, $4, unionRanges pat.Range $4.Range) + let pat = SynPat.Typed($2, $4, unionRanges $2.Range $4.Range) let mEquals = rhs parseState 5 let m = unionRanges (rhs parseState 1) $10.Range let trivia: SynExprLetOrUseBangTrivia = { LetOrUseBangKeyword = rhs parseState 1 ; EqualsRange = Some mEquals } From 50114d18871dc43c6e45b8f5dc0b7dac40f10c5f Mon Sep 17 00:00:00 2001 From: edgargonzalez Date: Thu, 1 May 2025 17:34:01 +0100 Subject: [PATCH 17/26] Update tests --- .../SynType/Typed LetBang 01.fs.bsl | 4 +- .../SynType/Typed LetBang 05.fs.bsl | 6 +-- .../SyntaxTree/SynType/Typed LetBang 06.fs | 3 ++ .../SynType/Typed LetBang 06.fs.bsl | 47 +++++++++++++++++++ .../SynType/Typed UseBang 01.fs.bsl | 4 +- .../SynType/Typed UseBang 03.fs.bsl | 6 +-- .../SyntaxTree/SynType/Typed UseBang 04.fs | 4 ++ .../SynType/Typed UseBang 04.fs.bsl | 47 +++++++++++++++++++ 8 files changed, 107 insertions(+), 14 deletions(-) create mode 100644 tests/service/data/SyntaxTree/SynType/Typed LetBang 06.fs create mode 100644 tests/service/data/SyntaxTree/SynType/Typed LetBang 06.fs.bsl create mode 100644 tests/service/data/SyntaxTree/SynType/Typed UseBang 04.fs create mode 100644 tests/service/data/SyntaxTree/SynType/Typed UseBang 04.fs.bsl 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 c27d957c755..25dcb64b68f 100644 --- a/tests/service/data/SyntaxTree/SynType/Typed LetBang 01.fs.bsl +++ b/tests/service/data/SyntaxTree/SynType/Typed LetBang 01.fs.bsl @@ -12,9 +12,7 @@ ImplFile LetOrUseBang (Yes (4,4--4,38), false, true, Typed - (LongIdent - (SynLongIdent ([res], [], [None]), None, None, - Pats [], None, (4,9--4,12)), + (Named (SynIdent (res, None), false, None, (4,9--4,12)), LongIdent (SynLongIdent ([int], [], [None])), (4,9--4,17)), App 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 9cf94952355..e158175c57f 100644 --- a/tests/service/data/SyntaxTree/SynType/Typed LetBang 05.fs.bsl +++ b/tests/service/data/SyntaxTree/SynType/Typed LetBang 05.fs.bsl @@ -8,10 +8,8 @@ ImplFile (LetOrUseBang (Yes (2,0--2,31), false, true, Typed - (LongIdent - (SynLongIdent ([x], [], [None]), None, None, Pats [], None, - (2,5--2,6)), LongIdent (SynLongIdent ([int], [], [None])), - (2,5--2,10)), + (Named (SynIdent (x, None), false, None, (2,5--2,6)), + LongIdent (SynLongIdent ([int], [], [None])), (2,5--2,10)), App (NonAtomic, false, Ident async, ComputationExpr diff --git a/tests/service/data/SyntaxTree/SynType/Typed LetBang 06.fs b/tests/service/data/SyntaxTree/SynType/Typed LetBang 06.fs new file mode 100644 index 00000000000..4dfb5dcf98a --- /dev/null +++ b/tests/service/data/SyntaxTree/SynType/Typed LetBang 06.fs @@ -0,0 +1,3 @@ +module Module +let! _:int = async { return 1 } +let! (_:int) = async { return 2 } \ No newline at end of file diff --git a/tests/service/data/SyntaxTree/SynType/Typed LetBang 06.fs.bsl b/tests/service/data/SyntaxTree/SynType/Typed LetBang 06.fs.bsl new file mode 100644 index 00000000000..0bfa21aa1cd --- /dev/null +++ b/tests/service/data/SyntaxTree/SynType/Typed LetBang 06.fs.bsl @@ -0,0 +1,47 @@ +ImplFile + (ParsedImplFileInput + ("/root/SynType/Typed LetBang 06.fs", false, QualifiedNameOfFile Module, [], + [], + [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)), [], + ImplicitZero (3,33--3,33), (3,0--3,33), + { LetOrUseBangKeyword = (3,0--3,4) + EqualsRange = Some (3,13--3,14) }), (2,0--3,33), + { LetOrUseBangKeyword = (2,0--2,4) + EqualsRange = Some (2,11--2,12) }), (2,0--3,33))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--3,33), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + CodeComments = [] }, set [])) + +(3,0)-(3,33) parse error Incomplete structured construct at or before this point in expression 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 756962e888c..c85105e4884 100644 --- a/tests/service/data/SyntaxTree/SynType/Typed UseBang 01.fs.bsl +++ b/tests/service/data/SyntaxTree/SynType/Typed UseBang 01.fs.bsl @@ -12,9 +12,7 @@ ImplFile LetOrUseBang (Yes (4,4--4,38), true, true, Typed - (LongIdent - (SynLongIdent ([res], [], [None]), None, None, - Pats [], None, (4,9--4,12)), + (Named (SynIdent (res, None), false, None, (4,9--4,12)), LongIdent (SynLongIdent ([int], [], [None])), (4,9--4,17)), App 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 7b06005a232..618f22920c4 100644 --- a/tests/service/data/SyntaxTree/SynType/Typed UseBang 03.fs.bsl +++ b/tests/service/data/SyntaxTree/SynType/Typed UseBang 03.fs.bsl @@ -8,10 +8,8 @@ ImplFile (LetOrUseBang (Yes (3,0--3,31), true, true, Typed - (LongIdent - (SynLongIdent ([x], [], [None]), None, None, Pats [], None, - (3,5--3,6)), LongIdent (SynLongIdent ([int], [], [None])), - (3,5--3,10)), + (Named (SynIdent (x, None), false, None, (3,5--3,6)), + LongIdent (SynLongIdent ([int], [], [None])), (3,5--3,10)), App (NonAtomic, false, Ident async, ComputationExpr diff --git a/tests/service/data/SyntaxTree/SynType/Typed UseBang 04.fs b/tests/service/data/SyntaxTree/SynType/Typed UseBang 04.fs new file mode 100644 index 00000000000..9ef3a6a3665 --- /dev/null +++ b/tests/service/data/SyntaxTree/SynType/Typed UseBang 04.fs @@ -0,0 +1,4 @@ +module Module + +use! _:int = async { return 1 } +use! (_:int) = async { return 2 } \ No newline at end of file diff --git a/tests/service/data/SyntaxTree/SynType/Typed UseBang 04.fs.bsl b/tests/service/data/SyntaxTree/SynType/Typed UseBang 04.fs.bsl new file mode 100644 index 00000000000..6e406fbf91d --- /dev/null +++ b/tests/service/data/SyntaxTree/SynType/Typed UseBang 04.fs.bsl @@ -0,0 +1,47 @@ +ImplFile + (ParsedImplFileInput + ("/root/SynType/Typed UseBang 04.fs", false, QualifiedNameOfFile Module, [], + [], + [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)), [], + ImplicitZero (4,33--4,33), (4,0--4,33), + { LetOrUseBangKeyword = (4,0--4,4) + EqualsRange = Some (4,13--4,14) }), (3,0--4,33), + { LetOrUseBangKeyword = (3,0--3,4) + EqualsRange = Some (3,11--3,12) }), (3,0--4,33))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--4,33), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + CodeComments = [] }, set [])) + +(4,0)-(4,33) parse error Incomplete structured construct at or before this point in expression From b16bbb58615214ebd40915750d89c744ee0488a7 Mon Sep 17 00:00:00 2001 From: edgargonzalez Date: Thu, 1 May 2025 19:10:24 +0100 Subject: [PATCH 18/26] more tests --- .../CheckComputationExpressions.fs | 1 + .../UseBindings/UseBang05.fs | 58 +++++++++++++++++++ .../UseBindings/UseBangBindings.fs | 20 +++++++ 3 files changed, 79 insertions(+) create mode 100644 tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/UseBindings/UseBang05.fs diff --git a/src/Compiler/Checking/Expressions/CheckComputationExpressions.fs b/src/Compiler/Checking/Expressions/CheckComputationExpressions.fs index f861665a5fc..5569b9d3328 100644 --- a/src/Compiler/Checking/Expressions/CheckComputationExpressions.fs +++ b/src/Compiler/Checking/Expressions/CheckComputationExpressions.fs @@ -1802,6 +1802,7 @@ let rec TryTranslateComputationExpression match pat with | SynPat.Named(ident = SynIdent(id, _); isThisVal = false) -> id, pat | SynPat.LongIdent(longDotId = SynLongIdent(id = [ id ])) -> id, pat + | SynPat.Typed(pat = pat) -> extractIdentifierFromPattern pat | SynPat.Wild(m) when supportsUseBangBindingValueDiscard -> // To properly call the Using(disposable) CE member, we need to convert the wildcard to a SynPat.Named let tmpIdent = mkSynId m "_" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/UseBindings/UseBang05.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/UseBindings/UseBang05.fs new file mode 100644 index 00000000000..7bd2b4cd827 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/UseBindings/UseBang05.fs @@ -0,0 +1,58 @@ +open System + +open System + +type Disposable(id: int) = + static let mutable disposedIds = Set.empty + static let mutable constructedIds = Set.empty + + do constructedIds <- constructedIds.Add(id) + + member _.Id = id + + static member GetDisposed() = disposedIds + static member GetConstructed() = constructedIds + static member Reset() = + disposedIds <- Set.empty + constructedIds <- Set.empty + + interface IDisposable with + member this.Dispose() = disposedIds <- disposedIds.Add(this.Id) + +type DisposableBuilder() = + member _.Using(resource: #IDisposable, f) = + async { + use res = resource + return! f res + } + + member _.Bind(disposable: Disposable, f) = async.Bind(async.Return(disposable), f) + member _.Return(x) = async.Return x + member _.ReturnFrom(x) = x + member _.Bind(task, f) = async.Bind(task, f) + +let counterDisposable = DisposableBuilder() + +let testBindingPatterns() = + Disposable.Reset() + + counterDisposable { + use! res:IDisposable = new Disposable(1) + use! __:IDisposable = new Disposable(2) + use! (res1: IDisposable) = new Disposable(3) + use! _: IDisposable = new Disposable(4) + use! (_: IDisposable) = new Disposable(5) + return () + } |> Async.RunSynchronously + + let constructed = Disposable.GetConstructed() + let disposed = Disposable.GetDisposed() + let undisposed = constructed - disposed + + if not undisposed.IsEmpty then + printfn $"Undisposed instances: %A{undisposed}" + failwithf "Not all disposables were properly disposed" + else + printfn $"Success! All %d{constructed.Count} disposables were properly disposed" + +testBindingPatterns() \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/UseBindings/UseBangBindings.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/UseBindings/UseBangBindings.fs index ba0f31bd885..0028acc8a90 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/UseBindings/UseBangBindings.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/UseBindings/UseBangBindings.fs @@ -50,6 +50,17 @@ module UseBangBindingsVersion9 = |> withDiagnostics [ (Error 1228, Line 47, Col 14, Line 47, Col 15, "'use!' bindings must be of the form 'use! = '") ] + + [] + let ``UseBangBindings - UseBang05_fs - Current LangVersion`` compilation = + compilation + |> asFsx + |> withLangVersion90 + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Error 1228, Line 43, Col 14, Line 43, Col 15, "'use!' bindings must be of the form 'use! = '") + ] module UseBangBindingsPreview = [] @@ -83,4 +94,13 @@ module UseBangBindingsPreview = |> withLangVersionPreview |> compileAndRun |> shouldSucceed + + [] + let ``UseBangBindings - UseBang05_fs - Preview LangVersion`` compilation = + compilation + |> asExe + |> withLangVersionPreview + |> compileAndRun + |> shouldSucceed + From 84ea9baf02b23e4be5a28ed702756de2853b6872 Mon Sep 17 00:00:00 2001 From: edgargonzalez Date: Fri, 2 May 2025 18:33:05 +0100 Subject: [PATCH 19/26] opt_topReturnTypeWithTypeConstraints --- src/Compiler/pars.fsy | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/src/Compiler/pars.fsy b/src/Compiler/pars.fsy index e961b7065d7..f1ea5b0cff7 100644 --- a/src/Compiler/pars.fsy +++ b/src/Compiler/pars.fsy @@ -4462,28 +4462,36 @@ declExpr: let trivia: SynExprLetOrUseBangTrivia = { LetOrUseBangKeyword = rhs parseState 1 ; EqualsRange = Some mEquals } SynExpr.LetOrUseBang(spBind, ($1 = "use"), true, $2, $4, $7, $8, m, trivia) } - | BINDER headBindingPattern COLON typeWithTypeConstraints EQUALS typedSequentialExprBlock IN opt_OBLOCKSEP moreBinders typedSequentialExprBlock %prec expr_let - { // Handle type annotations on patterns in let!/use! bindings + | BINDER headBindingPattern opt_topReturnTypeWithTypeConstraints EQUALS typedSequentialExprBlock IN opt_OBLOCKSEP moreBinders typedSequentialExprBlock %prec expr_let + { // Handle type annotations on patterns in let!/use! bindings // Examples: let! x: int = async { return 1 } // use! _: IDisposable = async { return new MemoryStream() } let spBind = DebugPointAtBinding.Yes(rhs2 parseState 1 7) - let pat = SynPat.Typed($2, $4, unionRanges $2.Range $4.Range) - let mEquals = rhs parseState 5 - let m = unionRanges (rhs parseState 1) $10.Range + let pat = + match $3 with + | None -> $2 + | Some (_, SynReturnInfo((ty, _), _)) -> + SynPat.Typed($2, ty, unionRanges $2.Range ty.Range) + let mEquals = rhs parseState 4 + let m = unionRanges (rhs parseState 1) $9.Range let trivia: SynExprLetOrUseBangTrivia = { LetOrUseBangKeyword = rhs parseState 1 ; EqualsRange = Some mEquals } - SynExpr.LetOrUseBang(spBind, ($1 = "use"), true, pat, $6, $9, $10, m, trivia) } + SynExpr.LetOrUseBang(spBind, ($1 = "use"), true, pat, $5, $8, $9, m, trivia) } - | OBINDER headBindingPattern COLON typeWithTypeConstraints EQUALS typedSequentialExprBlock hardwhiteDefnBindingsTerminator opt_OBLOCKSEP moreBinders typedSequentialExprBlock %prec expr_let + | OBINDER headBindingPattern opt_topReturnTypeWithTypeConstraints EQUALS typedSequentialExprBlock hardwhiteDefnBindingsTerminator opt_OBLOCKSEP moreBinders typedSequentialExprBlock %prec expr_let { // Handle type annotations on patterns in let!/use! bindings (offside-sensitive version) // This rule maintains consistent handling of binding constructs across different syntactic contexts - let report, mIn, _ = $7 + let report, mIn, _ = $6 report (if $1 = "use" then "use!" else "let!") (rhs parseState 1) // report unterminated error - let spBind = DebugPointAtBinding.Yes(unionRanges (rhs parseState 1) $6.Range) - let pat = SynPat.Typed($2, $4, unionRanges $2.Range $4.Range) - let mEquals = rhs parseState 5 - let m = unionRanges (rhs parseState 1) $10.Range + let spBind = DebugPointAtBinding.Yes(unionRanges (rhs parseState 1) $5.Range) + let pat = + match $3 with + | None -> $2 + | Some (_, SynReturnInfo((ty, _), _)) -> + SynPat.Typed($2, ty, unionRanges $2.Range ty.Range) + let mEquals = rhs parseState 4 + let m = unionRanges (rhs parseState 1) $9.Range let trivia: SynExprLetOrUseBangTrivia = { LetOrUseBangKeyword = rhs parseState 1 ; EqualsRange = Some mEquals } - SynExpr.LetOrUseBang(spBind, ($1 = "use"), true, pat, $6, $9, $10, m, trivia) } + SynExpr.LetOrUseBang(spBind, ($1 = "use"), true, pat, $5, $8, $9, m, trivia) } | OBINDER headBindingPattern EQUALS typedSequentialExprBlock hardwhiteDefnBindingsTerminator opt_OBLOCKSEP error %prec expr_let { // error recovery that allows intellisense when writing incomplete computation expressions From 6b6e86f534532da17628ef4c54603a8f3534d987 Mon Sep 17 00:00:00 2001 From: edgargonzalez Date: Wed, 14 May 2025 17:00:09 +0100 Subject: [PATCH 20/26] Update SyntaxTree tests to include WarnDirectives --- tests/service/data/SyntaxTree/SynType/Typed LetBang 01.fs.bsl | 2 +- tests/service/data/SyntaxTree/SynType/Typed LetBang 02.fs.bsl | 2 +- tests/service/data/SyntaxTree/SynType/Typed LetBang 03.fs.bsl | 2 +- tests/service/data/SyntaxTree/SynType/Typed LetBang 04.fs.bsl | 2 +- tests/service/data/SyntaxTree/SynType/Typed LetBang 05.fs.bsl | 2 +- tests/service/data/SyntaxTree/SynType/Typed LetBang 06.fs.bsl | 2 +- tests/service/data/SyntaxTree/SynType/Typed UseBang 01.fs.bsl | 2 +- tests/service/data/SyntaxTree/SynType/Typed UseBang 02.fs.bsl | 2 +- tests/service/data/SyntaxTree/SynType/Typed UseBang 03.fs.bsl | 2 +- tests/service/data/SyntaxTree/SynType/Typed UseBang 04.fs.bsl | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) 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 25dcb64b68f..1aa552d5f05 100644 --- a/tests/service/data/SyntaxTree/SynType/Typed LetBang 01.fs.bsl +++ b/tests/service/data/SyntaxTree/SynType/Typed LetBang 01.fs.bsl @@ -1,7 +1,6 @@ ImplFile (ParsedImplFileInput ("/root/SynType/Typed LetBang 01.fs", false, QualifiedNameOfFile Module, [], - [], [SynModuleOrNamespace ([Module], false, NamedModule, [Expr @@ -33,4 +32,5 @@ ImplFile PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, (1,0--6,1), { LeadingKeyword = Module (1,0--1,6) })], (true, true), { ConditionalDirectives = [] + WarnDirectives = [] CodeComments = [] }, set [])) 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 189efbc20c6..6046708ca7f 100644 --- a/tests/service/data/SyntaxTree/SynType/Typed LetBang 02.fs.bsl +++ b/tests/service/data/SyntaxTree/SynType/Typed LetBang 02.fs.bsl @@ -1,7 +1,6 @@ ImplFile (ParsedImplFileInput ("/root/SynType/Typed LetBang 02.fs", false, QualifiedNameOfFile Module, [], - [], [SynModuleOrNamespace ([Module], false, NamedModule, [Expr @@ -35,4 +34,5 @@ ImplFile PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, (1,0--6,1), { LeadingKeyword = Module (1,0--1,6) })], (true, true), { ConditionalDirectives = [] + WarnDirectives = [] CodeComments = [] }, set [])) 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 ae8313afb7a..c065ea59e32 100644 --- a/tests/service/data/SyntaxTree/SynType/Typed LetBang 03.fs.bsl +++ b/tests/service/data/SyntaxTree/SynType/Typed LetBang 03.fs.bsl @@ -1,7 +1,6 @@ ImplFile (ParsedImplFileInput ("/root/SynType/Typed LetBang 03.fs", false, QualifiedNameOfFile Module, [], - [], [SynModuleOrNamespace ([Module], false, NamedModule, [Expr @@ -122,4 +121,5 @@ ImplFile PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, (1,0--7,1), { LeadingKeyword = Module (1,0--1,6) })], (true, true), { ConditionalDirectives = [] + WarnDirectives = [] CodeComments = [] }, set [])) 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 2c81842ee99..fc39d00e0a5 100644 --- a/tests/service/data/SyntaxTree/SynType/Typed LetBang 04.fs.bsl +++ b/tests/service/data/SyntaxTree/SynType/Typed LetBang 04.fs.bsl @@ -1,7 +1,6 @@ ImplFile (ParsedImplFileInput ("/root/SynType/Typed LetBang 04.fs", false, QualifiedNameOfFile Module, [], - [], [SynModuleOrNamespace ([Module], false, NamedModule, [Expr @@ -44,6 +43,7 @@ ImplFile PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, (1,0--5,47), { LeadingKeyword = Module (1,0--1,6) })], (true, true), { ConditionalDirectives = [] + WarnDirectives = [] CodeComments = [] }, set [])) (4,14)-(4,15) parse error Unexpected symbol ',' in binding. Expected '=' or other token. 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 e158175c57f..08008766b4d 100644 --- a/tests/service/data/SyntaxTree/SynType/Typed LetBang 05.fs.bsl +++ b/tests/service/data/SyntaxTree/SynType/Typed LetBang 05.fs.bsl @@ -1,7 +1,6 @@ ImplFile (ParsedImplFileInput ("/root/SynType/Typed LetBang 05.fs", false, QualifiedNameOfFile Module, [], - [], [SynModuleOrNamespace ([Module], false, NamedModule, [Expr @@ -42,6 +41,7 @@ ImplFile PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, (1,0--3,33), { LeadingKeyword = Module (1,0--1,6) })], (true, true), { ConditionalDirectives = [] + WarnDirectives = [] CodeComments = [] }, set [])) (3,0)-(3,33) parse error Incomplete structured construct at or before this point in expression 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 0bfa21aa1cd..591ef048599 100644 --- a/tests/service/data/SyntaxTree/SynType/Typed LetBang 06.fs.bsl +++ b/tests/service/data/SyntaxTree/SynType/Typed LetBang 06.fs.bsl @@ -1,7 +1,6 @@ ImplFile (ParsedImplFileInput ("/root/SynType/Typed LetBang 06.fs", false, QualifiedNameOfFile Module, [], - [], [SynModuleOrNamespace ([Module], false, NamedModule, [Expr @@ -42,6 +41,7 @@ ImplFile PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, (1,0--3,33), { LeadingKeyword = Module (1,0--1,6) })], (true, true), { ConditionalDirectives = [] + WarnDirectives = [] CodeComments = [] }, set [])) (3,0)-(3,33) parse error Incomplete structured construct at or before this point in expression 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 c85105e4884..a49e9a4abf3 100644 --- a/tests/service/data/SyntaxTree/SynType/Typed UseBang 01.fs.bsl +++ b/tests/service/data/SyntaxTree/SynType/Typed UseBang 01.fs.bsl @@ -1,7 +1,6 @@ ImplFile (ParsedImplFileInput ("/root/SynType/Typed UseBang 01.fs", false, QualifiedNameOfFile Module, [], - [], [SynModuleOrNamespace ([Module], false, NamedModule, [Expr @@ -33,4 +32,5 @@ ImplFile PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, (1,0--6,1), { LeadingKeyword = Module (1,0--1,6) })], (true, true), { ConditionalDirectives = [] + WarnDirectives = [] CodeComments = [] }, set [])) 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 a28de2ddb58..d402cdf754d 100644 --- a/tests/service/data/SyntaxTree/SynType/Typed UseBang 02.fs.bsl +++ b/tests/service/data/SyntaxTree/SynType/Typed UseBang 02.fs.bsl @@ -1,7 +1,6 @@ ImplFile (ParsedImplFileInput ("/root/SynType/Typed UseBang 02.fs", false, QualifiedNameOfFile Module, [], - [], [SynModuleOrNamespace ([Module], false, NamedModule, [Expr @@ -35,4 +34,5 @@ ImplFile PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, (1,0--6,1), { LeadingKeyword = Module (1,0--1,6) })], (true, true), { ConditionalDirectives = [] + WarnDirectives = [] CodeComments = [] }, set [])) 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 618f22920c4..a3eda56c6e0 100644 --- a/tests/service/data/SyntaxTree/SynType/Typed UseBang 03.fs.bsl +++ b/tests/service/data/SyntaxTree/SynType/Typed UseBang 03.fs.bsl @@ -1,7 +1,6 @@ ImplFile (ParsedImplFileInput ("/root/SynType/Typed UseBang 03.fs", false, QualifiedNameOfFile Module, [], - [], [SynModuleOrNamespace ([Module], false, NamedModule, [Expr @@ -42,6 +41,7 @@ ImplFile PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, (1,0--4,33), { LeadingKeyword = Module (1,0--1,6) })], (true, true), { ConditionalDirectives = [] + WarnDirectives = [] CodeComments = [] }, set [])) (4,0)-(4,33) parse error Incomplete structured construct at or before this point in expression 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 6e406fbf91d..3bf8a0ce44c 100644 --- a/tests/service/data/SyntaxTree/SynType/Typed UseBang 04.fs.bsl +++ b/tests/service/data/SyntaxTree/SynType/Typed UseBang 04.fs.bsl @@ -1,7 +1,6 @@ ImplFile (ParsedImplFileInput ("/root/SynType/Typed UseBang 04.fs", false, QualifiedNameOfFile Module, [], - [], [SynModuleOrNamespace ([Module], false, NamedModule, [Expr @@ -42,6 +41,7 @@ ImplFile PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, (1,0--4,33), { LeadingKeyword = Module (1,0--1,6) })], (true, true), { ConditionalDirectives = [] + WarnDirectives = [] CodeComments = [] }, set [])) (4,0)-(4,33) parse error Incomplete structured construct at or before this point in expression From 85a34015bc89f11ccbfc0fbe9ef5aed3326e71d3 Mon Sep 17 00:00:00 2001 From: edgargonzalez Date: Wed, 14 May 2025 17:40:00 +0100 Subject: [PATCH 21/26] Add LanguageFeature --- .../Checking/Expressions/CheckComputationExpressions.fs | 5 ++++- src/Compiler/FSComp.txt | 1 + src/Compiler/Facilities/LanguageFeatures.fs | 3 +++ src/Compiler/Facilities/LanguageFeatures.fsi | 1 + src/Compiler/xlf/FSComp.txt.cs.xlf | 5 +++++ src/Compiler/xlf/FSComp.txt.de.xlf | 5 +++++ src/Compiler/xlf/FSComp.txt.es.xlf | 5 +++++ src/Compiler/xlf/FSComp.txt.fr.xlf | 5 +++++ src/Compiler/xlf/FSComp.txt.it.xlf | 5 +++++ src/Compiler/xlf/FSComp.txt.ja.xlf | 5 +++++ src/Compiler/xlf/FSComp.txt.ko.xlf | 5 +++++ src/Compiler/xlf/FSComp.txt.pl.xlf | 5 +++++ src/Compiler/xlf/FSComp.txt.pt-BR.xlf | 5 +++++ src/Compiler/xlf/FSComp.txt.ru.xlf | 5 +++++ src/Compiler/xlf/FSComp.txt.tr.xlf | 5 +++++ src/Compiler/xlf/FSComp.txt.zh-Hans.xlf | 5 +++++ src/Compiler/xlf/FSComp.txt.zh-Hant.xlf | 5 +++++ .../BasicGrammarElements/UseBindings/UseBangBindings.fs | 2 +- 18 files changed, 75 insertions(+), 2 deletions(-) diff --git a/src/Compiler/Checking/Expressions/CheckComputationExpressions.fs b/src/Compiler/Checking/Expressions/CheckComputationExpressions.fs index 5569b9d3328..f5e1ee80db2 100644 --- a/src/Compiler/Checking/Expressions/CheckComputationExpressions.fs +++ b/src/Compiler/Checking/Expressions/CheckComputationExpressions.fs @@ -1793,6 +1793,9 @@ let rec TryTranslateComputationExpression let supportsUseBangBindingValueDiscard = ceenv.cenv.g.langVersion.SupportsFeature LanguageFeature.UseBangBindingValueDiscard + let supportsTypedLetOrUseBang = + ceenv.cenv.g.langVersion.SupportsFeature LanguageFeature.UseBangBindingValueDiscard + // use! x = ... // use! (x) = ... // use! (__) = ... @@ -1802,7 +1805,7 @@ let rec TryTranslateComputationExpression match pat with | SynPat.Named(ident = SynIdent(id, _); isThisVal = false) -> id, pat | SynPat.LongIdent(longDotId = SynLongIdent(id = [ id ])) -> id, pat - | SynPat.Typed(pat = pat) -> extractIdentifierFromPattern pat + | SynPat.Typed(pat = pat) when supportsTypedLetOrUseBang -> extractIdentifierFromPattern pat | SynPat.Wild(m) when supportsUseBangBindingValueDiscard -> // To properly call the Using(disposable) CE member, we need to convert the wildcard to a SynPat.Named let tmpIdent = mkSynId m "_" diff --git a/src/Compiler/FSComp.txt b/src/Compiler/FSComp.txt index 010088e958e..94b814bc0d3 100644 --- a/src/Compiler/FSComp.txt +++ b/src/Compiler/FSComp.txt @@ -1800,6 +1800,7 @@ featureSupportValueOptionsAsOptionalParameters,"Support ValueOption as valid typ featureSupportWarnWhenUnitPassedToObjArg,"Warn when unit is passed to a member accepting `obj` argument, e.g. `Method(o:obj)` will warn if called via `Method()`." featureUseBangBindingValueDiscard,"Allows use! _ = ... in computation expressions" featureScopedNowarn,"Support for scoped enabling / disabling of warnings by #warn and #nowarn directives, also inside modules" +featureAllowTypedLetOrUseBang,"Allow typed let! and use! bindings in computation expressions" 3874,lexWarnDirectiveMustBeFirst,"#nowarn/#warnon directives must appear as the first non-whitespace characters on a line" 3875,lexWarnDirectiveMustHaveArgs,"Warn directives must have warning number(s) as argument(s)" 3876,lexWarnDirectivesMustMatch,"There is another %s for this warning already in line %d." diff --git a/src/Compiler/Facilities/LanguageFeatures.fs b/src/Compiler/Facilities/LanguageFeatures.fs index 763452592a4..aebb6e845cc 100644 --- a/src/Compiler/Facilities/LanguageFeatures.fs +++ b/src/Compiler/Facilities/LanguageFeatures.fs @@ -101,6 +101,7 @@ type LanguageFeature = | WarnWhenUnitPassedToObjArg | UseBangBindingValueDiscard | ScopedNowarn + | AllowTypedLetOrUseBang /// LanguageVersion management type LanguageVersion(versionText) = @@ -233,6 +234,7 @@ type LanguageVersion(versionText) = LanguageFeature.WarnWhenUnitPassedToObjArg, previewVersion LanguageFeature.UseBangBindingValueDiscard, previewVersion LanguageFeature.ScopedNowarn, previewVersion + LanguageFeature.AllowTypedLetOrUseBang, previewVersion ] static let defaultLanguageVersion = LanguageVersion("default") @@ -397,6 +399,7 @@ type LanguageVersion(versionText) = | LanguageFeature.WarnWhenUnitPassedToObjArg -> FSComp.SR.featureSupportWarnWhenUnitPassedToObjArg () | LanguageFeature.UseBangBindingValueDiscard -> FSComp.SR.featureUseBangBindingValueDiscard () | LanguageFeature.ScopedNowarn -> FSComp.SR.featureScopedNowarn () + | LanguageFeature.AllowTypedLetOrUseBang -> FSComp.SR.featureAllowTypedLetOrUseBang () /// Get a version string associated with the given feature. static member GetFeatureVersionString feature = diff --git a/src/Compiler/Facilities/LanguageFeatures.fsi b/src/Compiler/Facilities/LanguageFeatures.fsi index a452205765e..95bd956e0b7 100644 --- a/src/Compiler/Facilities/LanguageFeatures.fsi +++ b/src/Compiler/Facilities/LanguageFeatures.fsi @@ -92,6 +92,7 @@ type LanguageFeature = | WarnWhenUnitPassedToObjArg | UseBangBindingValueDiscard | ScopedNowarn + | AllowTypedLetOrUseBang /// LanguageVersion management type LanguageVersion = diff --git a/src/Compiler/xlf/FSComp.txt.cs.xlf b/src/Compiler/xlf/FSComp.txt.cs.xlf index de5b2815fdc..0d4487541d2 100644 --- a/src/Compiler/xlf/FSComp.txt.cs.xlf +++ b/src/Compiler/xlf/FSComp.txt.cs.xlf @@ -292,6 +292,11 @@ Allow object expressions without overrides + + Allow typed let! and use! bindings in computation expressions + Allow typed let! and use! bindings in computation expressions + + applicative computation expressions aplikativní výpočetní výrazy diff --git a/src/Compiler/xlf/FSComp.txt.de.xlf b/src/Compiler/xlf/FSComp.txt.de.xlf index 53bf24ff3e9..8200e99292b 100644 --- a/src/Compiler/xlf/FSComp.txt.de.xlf +++ b/src/Compiler/xlf/FSComp.txt.de.xlf @@ -292,6 +292,11 @@ Allow object expressions without overrides + + Allow typed let! and use! bindings in computation expressions + Allow typed let! and use! bindings in computation expressions + + applicative computation expressions applikative Berechnungsausdrücke diff --git a/src/Compiler/xlf/FSComp.txt.es.xlf b/src/Compiler/xlf/FSComp.txt.es.xlf index 483e820ed5c..00e41c618cd 100644 --- a/src/Compiler/xlf/FSComp.txt.es.xlf +++ b/src/Compiler/xlf/FSComp.txt.es.xlf @@ -292,6 +292,11 @@ Allow object expressions without overrides + + Allow typed let! and use! bindings in computation expressions + Allow typed let! and use! bindings in computation expressions + + applicative computation expressions expresiones de cálculo aplicativas diff --git a/src/Compiler/xlf/FSComp.txt.fr.xlf b/src/Compiler/xlf/FSComp.txt.fr.xlf index f003166db2d..5595f660d69 100644 --- a/src/Compiler/xlf/FSComp.txt.fr.xlf +++ b/src/Compiler/xlf/FSComp.txt.fr.xlf @@ -292,6 +292,11 @@ Allow object expressions without overrides + + Allow typed let! and use! bindings in computation expressions + Allow typed let! and use! bindings in computation expressions + + applicative computation expressions expressions de calcul applicatives diff --git a/src/Compiler/xlf/FSComp.txt.it.xlf b/src/Compiler/xlf/FSComp.txt.it.xlf index e4c08f83cb2..1a4ce1be2c3 100644 --- a/src/Compiler/xlf/FSComp.txt.it.xlf +++ b/src/Compiler/xlf/FSComp.txt.it.xlf @@ -292,6 +292,11 @@ Allow object expressions without overrides + + Allow typed let! and use! bindings in computation expressions + Allow typed let! and use! bindings in computation expressions + + applicative computation expressions espressioni di calcolo applicativo diff --git a/src/Compiler/xlf/FSComp.txt.ja.xlf b/src/Compiler/xlf/FSComp.txt.ja.xlf index 7d56499a955..4ad58864eb1 100644 --- a/src/Compiler/xlf/FSComp.txt.ja.xlf +++ b/src/Compiler/xlf/FSComp.txt.ja.xlf @@ -292,6 +292,11 @@ Allow object expressions without overrides + + Allow typed let! and use! bindings in computation expressions + Allow typed let! and use! bindings in computation expressions + + applicative computation expressions 適用できる計算式 diff --git a/src/Compiler/xlf/FSComp.txt.ko.xlf b/src/Compiler/xlf/FSComp.txt.ko.xlf index 887f0f199f1..5c29dea105c 100644 --- a/src/Compiler/xlf/FSComp.txt.ko.xlf +++ b/src/Compiler/xlf/FSComp.txt.ko.xlf @@ -292,6 +292,11 @@ Allow object expressions without overrides + + Allow typed let! and use! bindings in computation expressions + Allow typed let! and use! bindings in computation expressions + + applicative computation expressions 적용 가능한 계산 식 diff --git a/src/Compiler/xlf/FSComp.txt.pl.xlf b/src/Compiler/xlf/FSComp.txt.pl.xlf index 589e0f8535e..0a2fd1c760e 100644 --- a/src/Compiler/xlf/FSComp.txt.pl.xlf +++ b/src/Compiler/xlf/FSComp.txt.pl.xlf @@ -292,6 +292,11 @@ Allow object expressions without overrides + + Allow typed let! and use! bindings in computation expressions + Allow typed let! and use! bindings in computation expressions + + applicative computation expressions praktyczne wyrażenia obliczeniowe diff --git a/src/Compiler/xlf/FSComp.txt.pt-BR.xlf b/src/Compiler/xlf/FSComp.txt.pt-BR.xlf index 5af5b7fcd34..7cd2d76858b 100644 --- a/src/Compiler/xlf/FSComp.txt.pt-BR.xlf +++ b/src/Compiler/xlf/FSComp.txt.pt-BR.xlf @@ -292,6 +292,11 @@ Allow object expressions without overrides + + Allow typed let! and use! bindings in computation expressions + Allow typed let! and use! bindings in computation expressions + + applicative computation expressions expressões de computação aplicáveis diff --git a/src/Compiler/xlf/FSComp.txt.ru.xlf b/src/Compiler/xlf/FSComp.txt.ru.xlf index e8747be3f5c..a039c8a962e 100644 --- a/src/Compiler/xlf/FSComp.txt.ru.xlf +++ b/src/Compiler/xlf/FSComp.txt.ru.xlf @@ -292,6 +292,11 @@ Allow object expressions without overrides + + Allow typed let! and use! bindings in computation expressions + Allow typed let! and use! bindings in computation expressions + + applicative computation expressions применимые вычислительные выражения diff --git a/src/Compiler/xlf/FSComp.txt.tr.xlf b/src/Compiler/xlf/FSComp.txt.tr.xlf index a2d6e89305c..e3f02f39bcd 100644 --- a/src/Compiler/xlf/FSComp.txt.tr.xlf +++ b/src/Compiler/xlf/FSComp.txt.tr.xlf @@ -292,6 +292,11 @@ Allow object expressions without overrides + + Allow typed let! and use! bindings in computation expressions + Allow typed let! and use! bindings in computation expressions + + applicative computation expressions uygulama hesaplama ifadeleri diff --git a/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf b/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf index fce23f29c9a..7a7c8fa1b28 100644 --- a/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf +++ b/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf @@ -292,6 +292,11 @@ Allow object expressions without overrides + + Allow typed let! and use! bindings in computation expressions + Allow typed let! and use! bindings in computation expressions + + applicative computation expressions 适用的计算表达式 diff --git a/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf b/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf index d2563922fc3..93d7e40fc54 100644 --- a/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf +++ b/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf @@ -292,6 +292,11 @@ Allow object expressions without overrides + + Allow typed let! and use! bindings in computation expressions + Allow typed let! and use! bindings in computation expressions + + applicative computation expressions 適用的計算運算式 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/UseBindings/UseBangBindings.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/UseBindings/UseBangBindings.fs index 0028acc8a90..adc22063d17 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/UseBindings/UseBangBindings.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/UseBindings/UseBangBindings.fs @@ -59,7 +59,7 @@ module UseBangBindingsVersion9 = |> typecheck |> shouldFail |> withDiagnostics [ - (Error 1228, Line 43, Col 14, Line 43, Col 15, "'use!' bindings must be of the form 'use! = '") + (Error 1228, Line 40, Col 14, Line 40, Col 29, "'use!' bindings must be of the form 'use! = '") ] module UseBangBindingsPreview = From fda8a387b6b365a6c2a4c788e2d3f7df075344de Mon Sep 17 00:00:00 2001 From: edgargonzalez Date: Wed, 14 May 2025 17:50:45 +0100 Subject: [PATCH 22/26] Language release notes --- docs/release-notes/.Language/preview.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/release-notes/.Language/preview.md b/docs/release-notes/.Language/preview.md index 4a420016a14..43d372adc79 100644 --- a/docs/release-notes/.Language/preview.md +++ b/docs/release-notes/.Language/preview.md @@ -7,6 +7,7 @@ * Allow `_` in `use!` bindings values (lift FS1228 restriction) ([PR #18487](https://github.com/dotnet/fsharp/pull/18487)) * Warn when `unit` is passed to an `obj`-typed argument ([PR #18330](https://github.com/dotnet/fsharp/pull/18330)) * Scoped Nowarn: added the #warnon compiler directive ([Language suggestion #278](https://github.com/fsharp/fslang-suggestions/issues/278), [RFC FS-1146 PR](https://github.com/fsharp/fslang-design/pull/782), [PR #18049](https://github.com/dotnet/fsharp/pull/18049)) +* Allow `let!` and `use!` binding with type annotation without parentheses. ([PR #18508](https://github.com/dotnet/fsharp/pull/18508)) ### Fixed From e404fa108d2c9fc869ef1f8f4dbe1285380d7faf Mon Sep 17 00:00:00 2001 From: edgargonzalez Date: Wed, 14 May 2025 18:07:47 +0100 Subject: [PATCH 23/26] Update CheckLanguageFeatureAndRecover in pars.fsy --- src/Compiler/pars.fsy | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Compiler/pars.fsy b/src/Compiler/pars.fsy index 3e29ac4ee6f..61f8e2fef86 100644 --- a/src/Compiler/pars.fsy +++ b/src/Compiler/pars.fsy @@ -4476,6 +4476,7 @@ declExpr: | None -> $2 | Some (_, SynReturnInfo((ty, _), _)) -> SynPat.Typed($2, ty, unionRanges $2.Range ty.Range) + parseState.LexBuffer.CheckLanguageFeatureAndRecover LanguageFeature.AllowTypedLetOrUseBang pat.Range let mEquals = rhs parseState 4 let m = unionRanges (rhs parseState 1) $9.Range let trivia: SynExprLetOrUseBangTrivia = { LetOrUseBangKeyword = rhs parseState 1 ; EqualsRange = Some mEquals } @@ -4492,6 +4493,7 @@ declExpr: | None -> $2 | Some (_, SynReturnInfo((ty, _), _)) -> SynPat.Typed($2, ty, unionRanges $2.Range ty.Range) + parseState.LexBuffer.CheckLanguageFeatureAndRecover LanguageFeature.AllowTypedLetOrUseBang pat.Range let mEquals = rhs parseState 4 let m = unionRanges (rhs parseState 1) $9.Range let trivia: SynExprLetOrUseBangTrivia = { LetOrUseBangKeyword = rhs parseState 1 ; EqualsRange = Some mEquals } From 05d11d8167c9d158d2769fab841ec67f650c5afc Mon Sep 17 00:00:00 2001 From: edgargonzalez Date: Wed, 14 May 2025 18:17:57 +0100 Subject: [PATCH 24/26] update tests --- .../Checking/Expressions/CheckComputationExpressions.fs | 2 +- .../BasicGrammarElements/UseBindings/UseBangBindings.fs | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Compiler/Checking/Expressions/CheckComputationExpressions.fs b/src/Compiler/Checking/Expressions/CheckComputationExpressions.fs index f5e1ee80db2..0d2404c5b1a 100644 --- a/src/Compiler/Checking/Expressions/CheckComputationExpressions.fs +++ b/src/Compiler/Checking/Expressions/CheckComputationExpressions.fs @@ -1794,7 +1794,7 @@ let rec TryTranslateComputationExpression ceenv.cenv.g.langVersion.SupportsFeature LanguageFeature.UseBangBindingValueDiscard let supportsTypedLetOrUseBang = - ceenv.cenv.g.langVersion.SupportsFeature LanguageFeature.UseBangBindingValueDiscard + ceenv.cenv.g.langVersion.SupportsFeature LanguageFeature.AllowTypedLetOrUseBang // use! x = ... // use! (x) = ... diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/UseBindings/UseBangBindings.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/UseBindings/UseBangBindings.fs index adc22063d17..ea74bed944b 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/UseBindings/UseBangBindings.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/UseBindings/UseBangBindings.fs @@ -59,7 +59,9 @@ module UseBangBindingsVersion9 = |> typecheck |> shouldFail |> withDiagnostics [ - (Error 1228, Line 40, Col 14, Line 40, Col 29, "'use!' bindings must be of the form 'use! = '") + (Error 3350, Line 43, Col 14, Line 43, Col 28, "Feature 'Allow typed let! and use! bindings in computation expressions' is not available in F# 9.0. Please use language version 'PREVIEW' or greater."); + (Error 3350, Line 41, Col 14, Line 41, Col 28, "Feature 'Allow typed let! and use! bindings in computation expressions' is not available in F# 9.0. Please use language version 'PREVIEW' or greater."); + (Error 3350, Line 40, Col 14, Line 40, Col 29, "Feature 'Allow typed let! and use! bindings in computation expressions' is not available in F# 9.0. Please use language version 'PREVIEW' or greater.") ] module UseBangBindingsPreview = From 03f1ced8e193d7fe8c4d1fcce92a8f7e18eb269f Mon Sep 17 00:00:00 2001 From: edgargonzalez Date: Thu, 15 May 2025 19:32:18 +0100 Subject: [PATCH 25/26] update release notes --- docs/release-notes/.FSharp.Compiler.Service/10.0.100.md | 3 +++ docs/release-notes/.FSharp.Compiler.Service/9.0.300.md | 1 - 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 docs/release-notes/.FSharp.Compiler.Service/10.0.100.md diff --git a/docs/release-notes/.FSharp.Compiler.Service/10.0.100.md b/docs/release-notes/.FSharp.Compiler.Service/10.0.100.md new file mode 100644 index 00000000000..6e0ac865ec7 --- /dev/null +++ b/docs/release-notes/.FSharp.Compiler.Service/10.0.100.md @@ -0,0 +1,3 @@ +### Fixed + +* Allow `let!` and `use!` binding with type annotation without parentheses. ([PR #18508](https://github.com/dotnet/fsharp/pull/18508)) 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 bee0710cc49..a3bda7c0c9c 100644 --- a/docs/release-notes/.FSharp.Compiler.Service/9.0.300.md +++ b/docs/release-notes/.FSharp.Compiler.Service/9.0.300.md @@ -27,7 +27,6 @@ * Fix missing `null` highlighting in tooltips ([PR #18457](https://github.com/dotnet/fsharp/pull/18457)) * Fix range of SynPat.Named doesn't include accessibility ([PR #18526](https://github.com/dotnet/fsharp/pull/18526)) * Allow `_` in `use!` bindings values (lift FS1228 restriction) ([PR #18487](https://github.com/dotnet/fsharp/pull/18487)) -* Allow `let!` and `use!` binding with type annotation without parentheses. ([PR #18508](https://github.com/dotnet/fsharp/pull/18508)) * Make `[]` combination work([PR #18444](https://github.com/dotnet/fsharp/pull/18444/)) * Fix code completion considers types from own namespace non-imported ([PR #18518](https://github.com/dotnet/fsharp/issues/18518)) * Code completion: fix getting qualifier expression in do statements in type decls ([PR #18524](https://github.com/dotnet/fsharp/pull/18524)) From 64d72d8d610a4f25cdfc9414ef63efecfbddf124 Mon Sep 17 00:00:00 2001 From: edgargonzalez Date: Fri, 16 May 2025 10:44:49 +0100 Subject: [PATCH 26/26] Better naming --- .../release-notes/.FSharp.Compiler.Service/10.0.100.md | 2 +- docs/release-notes/.Language/preview.md | 2 +- src/Compiler/FSComp.txt | 2 +- src/Compiler/Facilities/LanguageFeatures.fs | 2 +- src/Compiler/xlf/FSComp.txt.cs.xlf | 10 +++++----- src/Compiler/xlf/FSComp.txt.de.xlf | 10 +++++----- src/Compiler/xlf/FSComp.txt.es.xlf | 10 +++++----- src/Compiler/xlf/FSComp.txt.fr.xlf | 10 +++++----- src/Compiler/xlf/FSComp.txt.it.xlf | 10 +++++----- src/Compiler/xlf/FSComp.txt.ja.xlf | 10 +++++----- src/Compiler/xlf/FSComp.txt.ko.xlf | 10 +++++----- src/Compiler/xlf/FSComp.txt.pl.xlf | 10 +++++----- src/Compiler/xlf/FSComp.txt.pt-BR.xlf | 10 +++++----- src/Compiler/xlf/FSComp.txt.ru.xlf | 10 +++++----- src/Compiler/xlf/FSComp.txt.tr.xlf | 10 +++++----- src/Compiler/xlf/FSComp.txt.zh-Hans.xlf | 10 +++++----- src/Compiler/xlf/FSComp.txt.zh-Hant.xlf | 10 +++++----- .../UseBindings/UseBangBindings.fs | 6 +++--- 18 files changed, 72 insertions(+), 72 deletions(-) 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 6e0ac865ec7..52228f33b09 100644 --- a/docs/release-notes/.FSharp.Compiler.Service/10.0.100.md +++ b/docs/release-notes/.FSharp.Compiler.Service/10.0.100.md @@ -1,3 +1,3 @@ ### Fixed -* Allow `let!` and `use!` binding with type annotation without parentheses. ([PR #18508](https://github.com/dotnet/fsharp/pull/18508)) +* Allow `let!` and `use!` type annotations without requiring parentheses ([PR #18508](https://github.com/dotnet/fsharp/pull/18508)) diff --git a/docs/release-notes/.Language/preview.md b/docs/release-notes/.Language/preview.md index 43d372adc79..40775e8dfa6 100644 --- a/docs/release-notes/.Language/preview.md +++ b/docs/release-notes/.Language/preview.md @@ -7,7 +7,7 @@ * Allow `_` in `use!` bindings values (lift FS1228 restriction) ([PR #18487](https://github.com/dotnet/fsharp/pull/18487)) * Warn when `unit` is passed to an `obj`-typed argument ([PR #18330](https://github.com/dotnet/fsharp/pull/18330)) * Scoped Nowarn: added the #warnon compiler directive ([Language suggestion #278](https://github.com/fsharp/fslang-suggestions/issues/278), [RFC FS-1146 PR](https://github.com/fsharp/fslang-design/pull/782), [PR #18049](https://github.com/dotnet/fsharp/pull/18049)) -* Allow `let!` and `use!` binding with type annotation without parentheses. ([PR #18508](https://github.com/dotnet/fsharp/pull/18508)) +* Allow `let!` and `use!` type annotations without requiring parentheses. ([PR #18508](https://github.com/dotnet/fsharp/pull/18508)) ### Fixed diff --git a/src/Compiler/FSComp.txt b/src/Compiler/FSComp.txt index 94b814bc0d3..1d7e9d6499a 100644 --- a/src/Compiler/FSComp.txt +++ b/src/Compiler/FSComp.txt @@ -1800,7 +1800,7 @@ featureSupportValueOptionsAsOptionalParameters,"Support ValueOption as valid typ featureSupportWarnWhenUnitPassedToObjArg,"Warn when unit is passed to a member accepting `obj` argument, e.g. `Method(o:obj)` will warn if called via `Method()`." featureUseBangBindingValueDiscard,"Allows use! _ = ... in computation expressions" featureScopedNowarn,"Support for scoped enabling / disabling of warnings by #warn and #nowarn directives, also inside modules" -featureAllowTypedLetOrUseBang,"Allow typed let! and use! bindings in computation expressions" +featureAllowLetOrUseBangTypeAnnotationWithoutParens,"Allow let! and use! type annotations without requiring parentheses" 3874,lexWarnDirectiveMustBeFirst,"#nowarn/#warnon directives must appear as the first non-whitespace characters on a line" 3875,lexWarnDirectiveMustHaveArgs,"Warn directives must have warning number(s) as argument(s)" 3876,lexWarnDirectivesMustMatch,"There is another %s for this warning already in line %d." diff --git a/src/Compiler/Facilities/LanguageFeatures.fs b/src/Compiler/Facilities/LanguageFeatures.fs index aebb6e845cc..fd0f646531b 100644 --- a/src/Compiler/Facilities/LanguageFeatures.fs +++ b/src/Compiler/Facilities/LanguageFeatures.fs @@ -399,7 +399,7 @@ type LanguageVersion(versionText) = | LanguageFeature.WarnWhenUnitPassedToObjArg -> FSComp.SR.featureSupportWarnWhenUnitPassedToObjArg () | LanguageFeature.UseBangBindingValueDiscard -> FSComp.SR.featureUseBangBindingValueDiscard () | LanguageFeature.ScopedNowarn -> FSComp.SR.featureScopedNowarn () - | LanguageFeature.AllowTypedLetOrUseBang -> FSComp.SR.featureAllowTypedLetOrUseBang () + | LanguageFeature.AllowTypedLetOrUseBang -> FSComp.SR.featureAllowLetOrUseBangTypeAnnotationWithoutParens () /// Get a version string associated with the given feature. static member GetFeatureVersionString feature = diff --git a/src/Compiler/xlf/FSComp.txt.cs.xlf b/src/Compiler/xlf/FSComp.txt.cs.xlf index 0d4487541d2..caa825a8245 100644 --- a/src/Compiler/xlf/FSComp.txt.cs.xlf +++ b/src/Compiler/xlf/FSComp.txt.cs.xlf @@ -287,16 +287,16 @@ Allow access modifiers to auto properties getters and setters + + Allow let! and use! type annotations without requiring parentheses + Allow let! and use! type annotations without requiring parentheses + + Allow object expressions without overrides Allow object expressions without overrides - - Allow typed let! and use! bindings in computation expressions - Allow typed let! and use! bindings in computation expressions - - applicative computation expressions aplikativní výpočetní výrazy diff --git a/src/Compiler/xlf/FSComp.txt.de.xlf b/src/Compiler/xlf/FSComp.txt.de.xlf index 8200e99292b..2d193f09a0e 100644 --- a/src/Compiler/xlf/FSComp.txt.de.xlf +++ b/src/Compiler/xlf/FSComp.txt.de.xlf @@ -287,16 +287,16 @@ Allow access modifiers to auto properties getters and setters + + Allow let! and use! type annotations without requiring parentheses + Allow let! and use! type annotations without requiring parentheses + + Allow object expressions without overrides Allow object expressions without overrides - - Allow typed let! and use! bindings in computation expressions - Allow typed let! and use! bindings in computation expressions - - applicative computation expressions applikative Berechnungsausdrücke diff --git a/src/Compiler/xlf/FSComp.txt.es.xlf b/src/Compiler/xlf/FSComp.txt.es.xlf index 00e41c618cd..1e0f79d0124 100644 --- a/src/Compiler/xlf/FSComp.txt.es.xlf +++ b/src/Compiler/xlf/FSComp.txt.es.xlf @@ -287,16 +287,16 @@ Allow access modifiers to auto properties getters and setters + + Allow let! and use! type annotations without requiring parentheses + Allow let! and use! type annotations without requiring parentheses + + Allow object expressions without overrides Allow object expressions without overrides - - Allow typed let! and use! bindings in computation expressions - Allow typed let! and use! bindings in computation expressions - - applicative computation expressions expresiones de cálculo aplicativas diff --git a/src/Compiler/xlf/FSComp.txt.fr.xlf b/src/Compiler/xlf/FSComp.txt.fr.xlf index 5595f660d69..71a14ff33f0 100644 --- a/src/Compiler/xlf/FSComp.txt.fr.xlf +++ b/src/Compiler/xlf/FSComp.txt.fr.xlf @@ -287,16 +287,16 @@ Allow access modifiers to auto properties getters and setters + + Allow let! and use! type annotations without requiring parentheses + Allow let! and use! type annotations without requiring parentheses + + Allow object expressions without overrides Allow object expressions without overrides - - Allow typed let! and use! bindings in computation expressions - Allow typed let! and use! bindings in computation expressions - - applicative computation expressions expressions de calcul applicatives diff --git a/src/Compiler/xlf/FSComp.txt.it.xlf b/src/Compiler/xlf/FSComp.txt.it.xlf index 1a4ce1be2c3..12f56c30e93 100644 --- a/src/Compiler/xlf/FSComp.txt.it.xlf +++ b/src/Compiler/xlf/FSComp.txt.it.xlf @@ -287,16 +287,16 @@ Allow access modifiers to auto properties getters and setters + + Allow let! and use! type annotations without requiring parentheses + Allow let! and use! type annotations without requiring parentheses + + Allow object expressions without overrides Allow object expressions without overrides - - Allow typed let! and use! bindings in computation expressions - Allow typed let! and use! bindings in computation expressions - - applicative computation expressions espressioni di calcolo applicativo diff --git a/src/Compiler/xlf/FSComp.txt.ja.xlf b/src/Compiler/xlf/FSComp.txt.ja.xlf index 4ad58864eb1..d84ecad7170 100644 --- a/src/Compiler/xlf/FSComp.txt.ja.xlf +++ b/src/Compiler/xlf/FSComp.txt.ja.xlf @@ -287,16 +287,16 @@ Allow access modifiers to auto properties getters and setters + + Allow let! and use! type annotations without requiring parentheses + Allow let! and use! type annotations without requiring parentheses + + Allow object expressions without overrides Allow object expressions without overrides - - Allow typed let! and use! bindings in computation expressions - Allow typed let! and use! bindings in computation expressions - - applicative computation expressions 適用できる計算式 diff --git a/src/Compiler/xlf/FSComp.txt.ko.xlf b/src/Compiler/xlf/FSComp.txt.ko.xlf index 5c29dea105c..39c3a728b37 100644 --- a/src/Compiler/xlf/FSComp.txt.ko.xlf +++ b/src/Compiler/xlf/FSComp.txt.ko.xlf @@ -287,16 +287,16 @@ Allow access modifiers to auto properties getters and setters + + Allow let! and use! type annotations without requiring parentheses + Allow let! and use! type annotations without requiring parentheses + + Allow object expressions without overrides Allow object expressions without overrides - - Allow typed let! and use! bindings in computation expressions - Allow typed let! and use! bindings in computation expressions - - applicative computation expressions 적용 가능한 계산 식 diff --git a/src/Compiler/xlf/FSComp.txt.pl.xlf b/src/Compiler/xlf/FSComp.txt.pl.xlf index 0a2fd1c760e..e5f2bda5529 100644 --- a/src/Compiler/xlf/FSComp.txt.pl.xlf +++ b/src/Compiler/xlf/FSComp.txt.pl.xlf @@ -287,16 +287,16 @@ Allow access modifiers to auto properties getters and setters + + Allow let! and use! type annotations without requiring parentheses + Allow let! and use! type annotations without requiring parentheses + + Allow object expressions without overrides Allow object expressions without overrides - - Allow typed let! and use! bindings in computation expressions - Allow typed let! and use! bindings in computation expressions - - applicative computation expressions praktyczne wyrażenia obliczeniowe diff --git a/src/Compiler/xlf/FSComp.txt.pt-BR.xlf b/src/Compiler/xlf/FSComp.txt.pt-BR.xlf index 7cd2d76858b..c69f534b10e 100644 --- a/src/Compiler/xlf/FSComp.txt.pt-BR.xlf +++ b/src/Compiler/xlf/FSComp.txt.pt-BR.xlf @@ -287,16 +287,16 @@ Allow access modifiers to auto properties getters and setters + + Allow let! and use! type annotations without requiring parentheses + Allow let! and use! type annotations without requiring parentheses + + Allow object expressions without overrides Allow object expressions without overrides - - Allow typed let! and use! bindings in computation expressions - Allow typed let! and use! bindings in computation expressions - - applicative computation expressions expressões de computação aplicáveis diff --git a/src/Compiler/xlf/FSComp.txt.ru.xlf b/src/Compiler/xlf/FSComp.txt.ru.xlf index a039c8a962e..ca41d4affcc 100644 --- a/src/Compiler/xlf/FSComp.txt.ru.xlf +++ b/src/Compiler/xlf/FSComp.txt.ru.xlf @@ -287,16 +287,16 @@ Allow access modifiers to auto properties getters and setters + + Allow let! and use! type annotations without requiring parentheses + Allow let! and use! type annotations without requiring parentheses + + Allow object expressions without overrides Allow object expressions without overrides - - Allow typed let! and use! bindings in computation expressions - Allow typed let! and use! bindings in computation expressions - - applicative computation expressions применимые вычислительные выражения diff --git a/src/Compiler/xlf/FSComp.txt.tr.xlf b/src/Compiler/xlf/FSComp.txt.tr.xlf index e3f02f39bcd..17a75ffa27c 100644 --- a/src/Compiler/xlf/FSComp.txt.tr.xlf +++ b/src/Compiler/xlf/FSComp.txt.tr.xlf @@ -287,16 +287,16 @@ Allow access modifiers to auto properties getters and setters + + Allow let! and use! type annotations without requiring parentheses + Allow let! and use! type annotations without requiring parentheses + + Allow object expressions without overrides Allow object expressions without overrides - - Allow typed let! and use! bindings in computation expressions - Allow typed let! and use! bindings in computation expressions - - applicative computation expressions uygulama hesaplama ifadeleri diff --git a/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf b/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf index 7a7c8fa1b28..155480c6314 100644 --- a/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf +++ b/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf @@ -287,16 +287,16 @@ Allow access modifiers to auto properties getters and setters + + Allow let! and use! type annotations without requiring parentheses + Allow let! and use! type annotations without requiring parentheses + + Allow object expressions without overrides Allow object expressions without overrides - - Allow typed let! and use! bindings in computation expressions - Allow typed let! and use! bindings in computation expressions - - applicative computation expressions 适用的计算表达式 diff --git a/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf b/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf index 93d7e40fc54..3c96310c8a7 100644 --- a/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf +++ b/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf @@ -287,16 +287,16 @@ Allow access modifiers to auto properties getters and setters + + Allow let! and use! type annotations without requiring parentheses + Allow let! and use! type annotations without requiring parentheses + + Allow object expressions without overrides Allow object expressions without overrides - - Allow typed let! and use! bindings in computation expressions - Allow typed let! and use! bindings in computation expressions - - applicative computation expressions 適用的計算運算式 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/UseBindings/UseBangBindings.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/UseBindings/UseBangBindings.fs index ea74bed944b..37c1447e89e 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/UseBindings/UseBangBindings.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/UseBindings/UseBangBindings.fs @@ -59,9 +59,9 @@ module UseBangBindingsVersion9 = |> typecheck |> shouldFail |> withDiagnostics [ - (Error 3350, Line 43, Col 14, Line 43, Col 28, "Feature 'Allow typed let! and use! bindings in computation expressions' is not available in F# 9.0. Please use language version 'PREVIEW' or greater."); - (Error 3350, Line 41, Col 14, Line 41, Col 28, "Feature 'Allow typed let! and use! bindings in computation expressions' is not available in F# 9.0. Please use language version 'PREVIEW' or greater."); - (Error 3350, Line 40, Col 14, Line 40, Col 29, "Feature 'Allow typed let! and use! bindings in computation expressions' is not available in F# 9.0. Please use language version 'PREVIEW' or greater.") + (Error 3350, Line 43, Col 14, Line 43, Col 28, "Feature 'Allow let! and use! type annotations without requiring parentheses' is not available in F# 9.0. Please use language version 'PREVIEW' or greater.") + (Error 3350, Line 41, Col 14, Line 41, Col 28, "Feature 'Allow let! and use! type annotations without requiring parentheses' is not available in F# 9.0. Please use language version 'PREVIEW' or greater.") + (Error 3350, Line 40, Col 14, Line 40, Col 29, "Feature 'Allow let! and use! type annotations without requiring parentheses' is not available in F# 9.0. Please use language version 'PREVIEW' or greater.") ] module UseBangBindingsPreview =