From df67332695b044aee58c79a28061b03b28b08baf Mon Sep 17 00:00:00 2001 From: Eugene Auduchinok Date: Wed, 29 Nov 2023 16:59:27 +0100 Subject: [PATCH 01/11] Parser: recover on unfinished record decls, fix field ranges --- src/Compiler/Checking/CheckDeclarations.fs | 29 ++++--- src/Compiler/FSComp.txt | 3 +- src/Compiler/SyntaxTree/ParseHelpers.fs | 48 ++++++++--- src/Compiler/SyntaxTree/ParseHelpers.fsi | 19 ++--- src/Compiler/SyntaxTree/SyntaxTree.fs | 4 + src/Compiler/SyntaxTree/SyntaxTree.fsi | 2 + src/Compiler/pars.fsy | 83 +++++++++---------- 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 ++ .../data/SyntaxTree/Member/Field 01.fs.bsl | 2 +- .../data/SyntaxTree/Member/Field 02.fs.bsl | 4 +- .../data/SyntaxTree/Member/Field 03.fs.bsl | 9 +- .../data/SyntaxTree/Member/Field 04.fs.bsl | 12 +-- .../data/SyntaxTree/Member/Field 05.fs.bsl | 2 +- .../data/SyntaxTree/Member/Field 06.fs.bsl | 8 +- .../data/SyntaxTree/Member/Field 07.fs.bsl | 8 +- .../data/SyntaxTree/Member/Field 08.fs.bsl | 6 +- .../data/SyntaxTree/Member/Field 09.fs.bsl | 8 +- .../data/SyntaxTree/Member/Field 10.fs | 6 ++ .../data/SyntaxTree/Member/Field 10.fs.bsl | 31 +++++++ .../data/SyntaxTree/Member/Field 11.fs | 6 ++ .../data/SyntaxTree/Member/Field 11.fs.bsl | 31 +++++++ .../data/SyntaxTree/Member/Field 12.fs | 6 ++ .../data/SyntaxTree/Member/Field 12.fs.bsl | 31 +++++++ .../data/SyntaxTree/Member/Field 13.fs | 6 ++ .../data/SyntaxTree/Member/Field 13.fs.bsl | 31 +++++++ .../data/SyntaxTree/Member/Field 14.fs | 6 ++ .../data/SyntaxTree/Member/Field 14.fs.bsl | 30 +++++++ .../SyntaxTree/Type/Record - Access 01.fs | 8 ++ .../SyntaxTree/Type/Record - Access 01.fs.bsl | 31 +++++++ .../SyntaxTree/Type/Record - Access 02.fs | 8 ++ .../SyntaxTree/Type/Record - Access 02.fs.bsl | 31 +++++++ .../SyntaxTree/Type/Record - Access 03.fs | 8 ++ .../SyntaxTree/Type/Record - Access 03.fs.bsl | 31 +++++++ .../SyntaxTree/Type/Record - Access 04.fs | 8 ++ .../SyntaxTree/Type/Record - Access 04.fs.bsl | 31 +++++++ .../SyntaxTree/Type/Record - Mutable 01.fs | 8 ++ .../Type/Record - Mutable 01.fs.bsl | 30 +++++++ .../SyntaxTree/Type/Record - Mutable 02.fs | 9 ++ .../Type/Record - Mutable 02.fs.bsl | 35 ++++++++ .../SyntaxTree/Type/Record - Mutable 03.fs | 9 ++ .../Type/Record - Mutable 03.fs.bsl | 35 ++++++++ .../SyntaxTree/Type/Record - Mutable 04.fs | 10 +++ .../Type/Record - Mutable 04.fs.bsl | 40 +++++++++ .../SyntaxTree/Type/Record - Mutable 05.fs | 10 +++ .../Type/Record - Mutable 05.fs.bsl | 39 +++++++++ .../data/SyntaxTree/Type/Record 01.fs.bsl | 2 +- .../data/SyntaxTree/Type/Record 02.fs.bsl | 2 +- .../service/data/SyntaxTree/Type/Record 03.fs | 6 ++ .../data/SyntaxTree/Type/Record 03.fs.bsl | 22 +++++ .../service/data/SyntaxTree/Type/Record 04.fs | 8 ++ .../data/SyntaxTree/Type/Record 04.fs.bsl | 29 +++++++ .../service/data/SyntaxTree/Type/Record 05.fs | 8 ++ .../data/SyntaxTree/Type/Record 05.fs.bsl | 39 +++++++++ .../data/SyntaxTree/Type/Struct 02.fs.bsl | 2 +- 66 files changed, 888 insertions(+), 107 deletions(-) create mode 100644 tests/service/data/SyntaxTree/Member/Field 10.fs create mode 100644 tests/service/data/SyntaxTree/Member/Field 10.fs.bsl create mode 100644 tests/service/data/SyntaxTree/Member/Field 11.fs create mode 100644 tests/service/data/SyntaxTree/Member/Field 11.fs.bsl create mode 100644 tests/service/data/SyntaxTree/Member/Field 12.fs create mode 100644 tests/service/data/SyntaxTree/Member/Field 12.fs.bsl create mode 100644 tests/service/data/SyntaxTree/Member/Field 13.fs create mode 100644 tests/service/data/SyntaxTree/Member/Field 13.fs.bsl create mode 100644 tests/service/data/SyntaxTree/Member/Field 14.fs create mode 100644 tests/service/data/SyntaxTree/Member/Field 14.fs.bsl create mode 100644 tests/service/data/SyntaxTree/Type/Record - Access 01.fs create mode 100644 tests/service/data/SyntaxTree/Type/Record - Access 01.fs.bsl create mode 100644 tests/service/data/SyntaxTree/Type/Record - Access 02.fs create mode 100644 tests/service/data/SyntaxTree/Type/Record - Access 02.fs.bsl create mode 100644 tests/service/data/SyntaxTree/Type/Record - Access 03.fs create mode 100644 tests/service/data/SyntaxTree/Type/Record - Access 03.fs.bsl create mode 100644 tests/service/data/SyntaxTree/Type/Record - Access 04.fs create mode 100644 tests/service/data/SyntaxTree/Type/Record - Access 04.fs.bsl create mode 100644 tests/service/data/SyntaxTree/Type/Record - Mutable 01.fs create mode 100644 tests/service/data/SyntaxTree/Type/Record - Mutable 01.fs.bsl create mode 100644 tests/service/data/SyntaxTree/Type/Record - Mutable 02.fs create mode 100644 tests/service/data/SyntaxTree/Type/Record - Mutable 02.fs.bsl create mode 100644 tests/service/data/SyntaxTree/Type/Record - Mutable 03.fs create mode 100644 tests/service/data/SyntaxTree/Type/Record - Mutable 03.fs.bsl create mode 100644 tests/service/data/SyntaxTree/Type/Record - Mutable 04.fs create mode 100644 tests/service/data/SyntaxTree/Type/Record - Mutable 04.fs.bsl create mode 100644 tests/service/data/SyntaxTree/Type/Record - Mutable 05.fs create mode 100644 tests/service/data/SyntaxTree/Type/Record - Mutable 05.fs.bsl create mode 100644 tests/service/data/SyntaxTree/Type/Record 03.fs create mode 100644 tests/service/data/SyntaxTree/Type/Record 03.fs.bsl create mode 100644 tests/service/data/SyntaxTree/Type/Record 04.fs create mode 100644 tests/service/data/SyntaxTree/Type/Record 04.fs.bsl create mode 100644 tests/service/data/SyntaxTree/Type/Record 05.fs create mode 100644 tests/service/data/SyntaxTree/Type/Record 05.fs.bsl diff --git a/src/Compiler/Checking/CheckDeclarations.fs b/src/Compiler/Checking/CheckDeclarations.fs index 5d87cbc7fe..0163ddb1e9 100644 --- a/src/Compiler/Checking/CheckDeclarations.fs +++ b/src/Compiler/Checking/CheckDeclarations.fs @@ -462,14 +462,16 @@ module TcRecdUnionAndEnumDeclarations = let TcNamedFieldDecl cenv env parent isIncrClass tpenv (SynField(Attributes attribs, isStatic, id, ty, isMutable, xmldoc, vis, m, _)) = match id with - | None -> error (Error(FSComp.SR.tcFieldRequiresName(), m)) + | None -> + errorR (Error(FSComp.SR.tcFieldRequiresName(), m)) + None | Some id -> let checkXmlDocs = cenv.diagnosticOptions.CheckXmlDocs let xmlDoc = xmldoc.ToXmlDoc(checkXmlDocs, Some []) - TcFieldDecl cenv env parent isIncrClass tpenv (isStatic, attribs, id, false, ty, isMutable, xmlDoc, vis, m) + Some(TcFieldDecl cenv env parent isIncrClass tpenv (isStatic, attribs, id, false, ty, isMutable, xmlDoc, vis, m)) let TcNamedFieldDecls cenv env parent isIncrClass tpenv fields = - fields |> List.map (TcNamedFieldDecl cenv env parent isIncrClass tpenv) + fields |> List.choose (TcNamedFieldDecl cenv env parent isIncrClass tpenv) //------------------------------------------------------------------------- // Bind other elements of type definitions (constructors etc.) @@ -518,14 +520,19 @@ module TcRecdUnionAndEnumDeclarations = match args with | SynUnionCaseKind.Fields flds -> let nFields = flds.Length - let rfields = flds |> List.mapi (fun i (SynField (idOpt = idOpt) as fld) -> - match idOpt, parent with - | Some fieldId, Parent tcref -> - let item = Item.UnionCaseField (UnionCaseInfo (thisTyInst, UnionCaseRef (tcref, id.idText)), i) - CallNameResolutionSink cenv.tcSink (fieldId.idRange, env.NameEnv, item, emptyTyparInst, ItemOccurence.Binding, env.AccessRights) - TcNamedFieldDecl cenv env parent false tpenv fld - | _ -> - TcAnonFieldDecl cenv env parent tpenv (mkUnionCaseFieldName nFields i) fld) + let rfields = + flds + |> List.mapi (fun i (SynField (idOpt = idOpt) as fld) -> + match idOpt, parent with + | Some fieldId, Parent tcref -> + let item = Item.UnionCaseField (UnionCaseInfo (thisTyInst, UnionCaseRef (tcref, id.idText)), i) + CallNameResolutionSink cenv.tcSink (fieldId.idRange, env.NameEnv, item, emptyTyparInst, ItemOccurence.Binding, env.AccessRights) + TcNamedFieldDecl cenv env parent false tpenv fld + | _ -> + Some(TcAnonFieldDecl cenv env parent tpenv (mkUnionCaseFieldName nFields i) fld) + ) + |> List.choose (fun x -> x) + ValidateFieldNames(flds, rfields) rfields, thisTy diff --git a/src/Compiler/FSComp.txt b/src/Compiler/FSComp.txt index e2aaa935a9..fd3b780aac 100644 --- a/src/Compiler/FSComp.txt +++ b/src/Compiler/FSComp.txt @@ -1736,4 +1736,5 @@ featureReuseSameFieldsInStructUnions,"Share underlying fields in a [] di 3859,tcNoStaticPropertyFoundForOverride,"No static abstract property was found that corresponds to this override" 3860,chkStaticMembersOnObjectExpressions,"Object expressions cannot implement interfaces with static abstract members or declare static members." 3861,chkTailCallAttrOnNonRec,"The TailCall attribute should only be applied to recursive functions." -3862,parsStaticMemberImcompleteSyntax,"Incomplete declaration of a static construct. Use 'static let','static do','static member' or 'static val' for declaration." \ No newline at end of file +3862,parsStaticMemberImcompleteSyntax,"Incomplete declaration of a static construct. Use 'static let','static do','static member' or 'static val' for declaration." +3863,parsExpectingField,"Expecting record field" \ No newline at end of file diff --git a/src/Compiler/SyntaxTree/ParseHelpers.fs b/src/Compiler/SyntaxTree/ParseHelpers.fs index fed1e4c924..a41646e01c 100644 --- a/src/Compiler/SyntaxTree/ParseHelpers.fs +++ b/src/Compiler/SyntaxTree/ParseHelpers.fs @@ -1140,20 +1140,46 @@ let mkAutoPropDefn mVal access ident typ mEquals (expr: SynExpr) accessors xmlDo trivia ) -let mkValField mVal mRhs mut access ident (typ: SynType) xmlDoc rangeStart attribs mStaticOpt = - let isStatic = Option.isSome mStaticOpt - let mValDecl = unionRanges rangeStart typ.Range |> unionRangeWithXmlDoc xmlDoc +let mkSynField parseState (idOpt: Ident option) (t: SynType option) (isMutable: range option) (vis: SynAccess option) (attributes: SynAttributes) (mStatic: range option) (rangeStart: range) (leadingKeyword: SynLeadingKeyword option) = + let t, mStart = + match t with + | Some value -> value, rangeStart + | None -> + let mType, mStart = + match idOpt with + | Some id -> id.idRange, rangeStart + | _ -> + + match vis with + | Some vis -> vis.Range, rangeStart + | _ -> + + match isMutable with + | Some m -> m, rangeStart + | _ -> + + match leadingKeyword with + | Some keyword -> keyword.Range, rangeStart + | None -> + + attributes + |> Seq.tryLast + |> Option.map (fun l -> l.Range, rangeStart) + |> Option.defaultWith (fun _ -> rangeStart.StartRange, rangeStart.StartRange) + + SynType.FromParseError(mType.EndRange), mStart + let mWhole = unionRanges mStart t.Range + let xmlDoc = grabXmlDocAtRangeStart (parseState, attributes, mWhole) + let mWhole = unionRangeWithXmlDoc xmlDoc mWhole + + SynField(attributes, Option.isSome mStatic, idOpt, t, Option.isSome isMutable, xmlDoc, vis, mWhole, { LeadingKeyword = leadingKeyword }) + +let mkValField parseState mVal (isMutable: range option) access (idOpt: Ident option) (typ: SynType option) (rangeStart: range) attribs mStaticOpt = let leadingKeyword = match mStaticOpt with | None -> SynLeadingKeyword.Val mVal | Some mStatic -> SynLeadingKeyword.StaticVal(mStatic, mVal) - let fld = - SynField(attribs, isStatic, Some ident, typ, mut, xmlDoc, access, mRhs, { LeadingKeyword = Some leadingKeyword }) - - SynMemberDefn.ValField(fld, mValDecl) - -let mkSynField parseState idOpt t isMutable vis attributes isStatic mWhole leadingKeyword = - let xmlDoc = grabXmlDocAtRangeStart (parseState, attributes, mWhole) - SynField(attributes, isStatic, idOpt, t, isMutable, xmlDoc, vis, mWhole, { LeadingKeyword = leadingKeyword }) + let field = mkSynField parseState idOpt typ isMutable access attribs mStaticOpt rangeStart (Some leadingKeyword) + SynMemberDefn.ValField(field, field.Range) diff --git a/src/Compiler/SyntaxTree/ParseHelpers.fsi b/src/Compiler/SyntaxTree/ParseHelpers.fsi index 02b844894c..9add16af68 100644 --- a/src/Compiler/SyntaxTree/ParseHelpers.fsi +++ b/src/Compiler/SyntaxTree/ParseHelpers.fsi @@ -280,14 +280,13 @@ val mkAutoPropDefn: SynMemberDefn val mkValField: + parseState: IParseState -> mVal: range -> - mRhs: range -> - mut: bool -> + isMutable: range option -> access: SynAccess option -> - ident: Ident -> - typ: SynType -> - xmlDoc: PreXmlDoc -> - range -> + idOpt: Ident option -> + typ: SynType option -> + rangeStart: range -> SynAttributes -> range option -> SynMemberDefn @@ -295,11 +294,11 @@ val mkValField: val mkSynField: parseState: IParseState -> idOpt: Ident option -> - t: SynType -> - isMutable: bool -> + t: SynType option -> + isMutable: range option -> vis: SynAccess option -> attributes: SynAttributeList list -> - isStatic: bool -> - mWhole: range -> + mStatic: range option -> + rangeStart: range -> leadingKeyword: SynLeadingKeyword option -> SynField diff --git a/src/Compiler/SyntaxTree/SyntaxTree.fs b/src/Compiler/SyntaxTree/SyntaxTree.fs index e05377af0b..97f40bee62 100644 --- a/src/Compiler/SyntaxTree/SyntaxTree.fs +++ b/src/Compiler/SyntaxTree/SyntaxTree.fs @@ -1288,6 +1288,10 @@ type SynField = range: range * trivia: SynFieldTrivia + member this.Range = + match this with + | SynField(range = range) -> range + [] type SynComponentInfo = | SynComponentInfo of diff --git a/src/Compiler/SyntaxTree/SyntaxTree.fsi b/src/Compiler/SyntaxTree/SyntaxTree.fsi index 6f8a86d14b..e2fd2053aa 100644 --- a/src/Compiler/SyntaxTree/SyntaxTree.fsi +++ b/src/Compiler/SyntaxTree/SyntaxTree.fsi @@ -1453,6 +1453,8 @@ type SynField = range: range * trivia: SynFieldTrivia + member Range: range + /// Represents the syntax tree associated with the name of a type definition or module /// in signature or implementation. /// diff --git a/src/Compiler/pars.fsy b/src/Compiler/pars.fsy index a4a77de3bf..c40a2fe380 100644 --- a/src/Compiler/pars.fsy +++ b/src/Compiler/pars.fsy @@ -728,7 +728,7 @@ moduleSpfn: valSpfn: | opt_attributes opt_access VAL opt_attributes opt_inline opt_mutable opt_access nameop opt_explicitValTyparDecls COLON topTypeWithTypeConstraints optLiteralValueSpfn { if Option.isSome $2 then errorR(Error(FSComp.SR.parsVisibilityDeclarationsShouldComePriorToIdentifier(), rhs parseState 2)) - let attr1, attr2, isInline, isMutable, vis2, id, doc, explicitValTyparDecls, (ty, arity), (mEquals, konst: SynExpr option) = ($1), ($4), (Option.isSome $5), ($6), ($7), ($8), grabXmlDoc(parseState, $1, 1), ($9), ($11), ($12) + let attr1, attr2, isInline, isMutable, vis2, id, doc, explicitValTyparDecls, (ty, arity), (mEquals, konst: SynExpr option) = ($1), ($4), (Option.isSome $5), (Option.isSome $6), ($7), ($8), grabXmlDoc(parseState, $1, 1), ($9), ($11), ($12) if not (isNil attr2) then errorR(Deprecated(FSComp.SR.parsAttributesMustComeBeforeVal(), rhs parseState 4)) let m = rhs2 parseState 1 11 @@ -985,21 +985,23 @@ classMemberSpfn: SynMemberSig.Inherit(ty, unionRanges (rhs parseState 1) mInherit) } | opt_attributes opt_access VAL fieldDecl - { let mWhole = rhs2 parseState 1 4 - if Option.isSome $2 then errorR (Error (FSComp.SR.parsVisibilityDeclarationsShouldComePriorToIdentifier (), rhs parseState 2)) + { if Option.isSome $2 then + errorR (Error (FSComp.SR.parsVisibilityDeclarationsShouldComePriorToIdentifier (), rhs parseState 2)) + let mStart = rhs parseState 1 let mVal = rhs parseState 3 - let (SynField(xmlDoc = xmlDoc)) as field = $4 $1 false mWhole (Some(SynLeadingKeyword.Val mVal)) - let mWhole = unionRangeWithXmlDoc xmlDoc mWhole - SynMemberSig.ValField(field, mWhole) } + let leadingKeyword = Some(SynLeadingKeyword.Val mVal) + let (SynField(xmlDoc = xmlDoc; range = range)) as field = $4 $1 None mStart leadingKeyword + SynMemberSig.ValField(field, range) } | opt_attributes opt_access STATIC VAL fieldDecl - { let mWhole = rhs2 parseState 1 5 - if Option.isSome $2 then errorR (Error (FSComp.SR.parsVisibilityDeclarationsShouldComePriorToIdentifier (), rhs parseState 2)) + { if Option.isSome $2 then + errorR (Error (FSComp.SR.parsVisibilityDeclarationsShouldComePriorToIdentifier (), rhs parseState 2)) + let mStart = rhs parseState 1 let mStatic = rhs parseState 3 let mVal = rhs parseState 4 - let (SynField(xmlDoc = xmlDoc)) as field = $5 $1 true mWhole (Some(SynLeadingKeyword.StaticVal(mStatic, mVal))) - let mWhole = unionRangeWithXmlDoc xmlDoc mWhole - SynMemberSig.ValField(field, mWhole) } + let leadingKeyword = Some(SynLeadingKeyword.StaticVal(mStatic, mVal)) + let (SynField(xmlDoc = xmlDoc; range = range)) as field = $5 $1 (Some mStatic) mStart leadingKeyword + SynMemberSig.ValField(field, range) } | opt_attributes opt_access STATIC typeKeyword tyconSpfn { let leadingKeyword = SynTypeDefnLeadingKeyword.StaticType(rhs parseState 3, rhs parseState 4) @@ -2135,38 +2137,26 @@ classDefnMember: valDefnDecl: | VAL opt_mutable opt_access ident COLON typ { let mVal = rhs parseState 1 - let mRhs = rhs2 parseState 4 6 fun rangeStart attribs mStaticOpt -> - let xmlDoc = grabXmlDocAtRangeStart (parseState, attribs, rangeStart) - [ mkValField mVal mRhs $2 $3 $4 $6 xmlDoc rangeStart attribs mStaticOpt ] } + [ mkValField parseState mVal $2 $3 (Some $4) (Some $6) rangeStart attribs mStaticOpt ] } | VAL opt_mutable opt_access ident COLON recover { let mVal = rhs parseState 1 - let mRhs = rhs2 parseState 4 6 let mColon = rhs parseState 5 let ty = SynType.FromParseError(mColon.EndRange) fun rangeStart attribs mStaticOpt -> - let xmlDoc = grabXmlDocAtRangeStart (parseState, attribs, rangeStart) - [ mkValField mVal mRhs $2 $3 $4 ty xmlDoc rangeStart attribs mStaticOpt ] } + [ mkValField parseState mVal $2 $3 (Some $4) (Some ty) rangeStart attribs mStaticOpt ] } | VAL opt_mutable opt_access ident recover { let mVal = rhs parseState 1 - let mRhs = rhs2 parseState 4 6 - let mColon = rhs parseState 5 - let ty = SynType.FromParseError(mColon.EndRange) + let ty = SynType.FromParseError($4.idRange.EndRange) fun rangeStart attribs mStaticOpt -> - let xmlDoc = grabXmlDocAtRangeStart (parseState, attribs, rangeStart) - [ mkValField mVal mRhs $2 $3 $4 ty xmlDoc rangeStart attribs mStaticOpt ] } + [ mkValField parseState mVal $2 $3 (Some $4) (Some ty) rangeStart attribs mStaticOpt ] } | VAL opt_mutable opt_access recover { let mVal = rhs parseState 1 - let mRhs = rhs2 parseState 4 6 - let id = mkSynId mVal.EndRange "" - let mColon = rhs parseState 5 - let ty = SynType.FromParseError(mColon.EndRange) fun rangeStart attribs mStaticOpt -> - let xmlDoc = grabXmlDocAtRangeStart (parseState, attribs, rangeStart) - [ mkValField mVal mRhs $2 $3 id ty xmlDoc rangeStart attribs mStaticOpt ] } + [ mkValField parseState mVal $2 $3 None None rangeStart attribs mStaticOpt ] } /* An auto-property definition in an object type definition */ @@ -2174,7 +2164,7 @@ autoPropsDefnDecl: | VAL opt_mutable opt_access ident opt_typ EQUALS typedSequentialExprBlock classMemberSpfnGetSet { let mVal = rhs parseState 1 let mEquals = rhs parseState 6 - if $2 then + if Option.isSome $2 then errorR (Error(FSComp.SR.parsMutableOnAutoPropertyShouldBeGetSet (), rhs parseState 2)) fun attribs flags rangeStart -> let xmlDoc = grabXmlDocAtRangeStart (parseState, attribs, rangeStart) @@ -2187,7 +2177,7 @@ autoPropsDefnDecl: | Some t -> t.Range | _ -> $4.idRange let expr = arbExpr ("autoProp1", mEnd.EndRange) - if $2 then + if Option.isSome $2 then errorR (Error(FSComp.SR.parsMutableOnAutoPropertyShouldBeGetSet (), rhs parseState 2)) fun attribs flags rangeStart -> let xmlDoc = grabXmlDocAtRangeStart (parseState, attribs, rangeStart) @@ -2200,7 +2190,7 @@ autoPropsDefnDecl: | Some t -> t.Range | _ -> $4.idRange let expr = arbExpr ("autoProp2", mEnd.EndRange) - if $2 then + if Option.isSome $2 then errorR (Error(FSComp.SR.parsMutableOnAutoPropertyShouldBeGetSet (), rhs parseState 2)) fun attribs flags rangeStart -> let xmlDoc = grabXmlDocAtRangeStart (parseState, attribs, rangeStart) @@ -2210,7 +2200,7 @@ autoPropsDefnDecl: { let mVal = rhs parseState 1 let id = mkSynId mVal.EndRange "" let expr = arbExpr ("autoProp3", mVal.EndRange) - if $2 then + if Option.isSome $2 then errorR (Error(FSComp.SR.parsMutableOnAutoPropertyShouldBeGetSet (), rhs parseState 2)) fun attribs flags rangeStart -> let xmlDoc = grabXmlDocAtRangeStart(parseState, attribs, rangeStart) @@ -2464,6 +2454,10 @@ braceFieldDeclList: | LBRACE error rbrace { [] } + | LBRACE rbrace + { errorR (Error(FSComp.SR.parsExpectingField(), rhs parseState 2)) + [] } + anonRecdType: | STRUCT braceBarFieldDeclListCore { $2, true } @@ -2836,8 +2830,8 @@ recdFieldDeclList: /* A field declaration in a record type */ recdFieldDecl: | opt_attributes fieldDecl - { let mWhole = rhs2 parseState 1 2 - let fld = $2 $1 false mWhole None + { let rangeStart = rhs parseState 1 + let fld = $2 $1 None rangeStart None let (SynField (a, b, c, d, e, xmlDoc, vis, mWhole, trivia)) = fld if Option.isSome vis then errorR (Error (FSComp.SR.parsRecordFieldsCannotHaveVisibilityDeclarations (), rhs parseState 2)) let mWhole = unionRangeWithXmlDoc xmlDoc mWhole @@ -2846,14 +2840,19 @@ recdFieldDecl: /* Part of a field or val declaration in a record type or object type */ fieldDecl: | opt_mutable opt_access ident COLON typ - { mkSynField parseState (Some $3) $5 $1 $2 } + { mkSynField parseState (Some $3) (Some $5) $1 $2 } + | opt_mutable opt_access ident COLON recover { let mColon = rhs parseState 4 let t = SynType.FromParseError(mColon.EndRange) - mkSynField parseState (Some $3) t $1 $2 } + mkSynField parseState (Some $3) (Some t) $1 $2 } + | opt_mutable opt_access ident recover { let t = SynType.FromParseError($3.idRange.EndRange) - mkSynField parseState (Some $3) t $1 $2 } + mkSynField parseState (Some $3) (Some t) $1 $2 } + + | opt_mutable opt_access recover + { mkSynField parseState None None $1 $2 } /* An exception definition */ exconDefn: @@ -3195,7 +3194,7 @@ localBinding: let spBind = if IsDebugPointBinding bindingPat expr then DebugPointAtBinding.Yes mWhole else DebugPointAtBinding.NoneAtLet let mWholeBindLhs = (mBindLhs, attrs) ||> unionRangeWithListBy (fun (a: SynAttributeList) -> a.Range) let trivia: SynBindingTrivia = { LeadingKeyword = leadingKeyword; InlineKeyword = $1; EqualsRange = Some mEquals } - mkSynBinding (xmlDoc, bindingPat) (vis, Option.isSome $1, $2, mWholeBindLhs, spBind, optReturnType, expr, mRhs, opts, attrs, None, trivia)) + mkSynBinding (xmlDoc, bindingPat) (vis, Option.isSome $1, Option.isSome $2, mWholeBindLhs, spBind, optReturnType, expr, mRhs, opts, attrs, None, trivia)) localBindingRange, localBindingBuilder } | opt_inline opt_mutable bindingPattern opt_topReturnTypeWithTypeConstraints EQUALS error @@ -3210,7 +3209,7 @@ localBinding: let rhsExpr = arbExpr ("localBinding1", zeroWidthAtEnd) let spBind = if IsDebugPointBinding bindingPat rhsExpr then DebugPointAtBinding.Yes mWhole else DebugPointAtBinding.NoneAtLet let trivia: SynBindingTrivia = { LeadingKeyword = leadingKeyword; InlineKeyword = $1; EqualsRange = Some mEquals } - mkSynBinding (xmlDoc, bindingPat) (vis, Option.isSome $1, $2, mBindLhs, spBind, optReturnType, rhsExpr, mRhs, [], attrs, None, trivia)) + mkSynBinding (xmlDoc, bindingPat) (vis, Option.isSome $1, Option.isSome $2, mBindLhs, spBind, optReturnType, rhsExpr, mRhs, [], attrs, None, trivia)) mWhole, localBindingBuilder } | opt_inline opt_mutable bindingPattern opt_topReturnTypeWithTypeConstraints recover @@ -3224,7 +3223,7 @@ localBinding: let spBind = DebugPointAtBinding.Yes(unionRanges leadingKeyword.Range mRhs) let trivia = { LeadingKeyword = leadingKeyword; InlineKeyword = $1; EqualsRange = None } let rhsExpr = arbExpr ("localBinding2", mRhs) - mkSynBinding (xmlDoc, bindingPat) (vis, Option.isSome $1, $2, mBindLhs, spBind, optReturnType, rhsExpr, mRhs, [], attrs, None, trivia)) + mkSynBinding (xmlDoc, bindingPat) (vis, Option.isSome $1, Option.isSome $2, mBindLhs, spBind, optReturnType, rhsExpr, mRhs, [], attrs, None, trivia)) mWhole, localBindingBuilder } /* A single expression with an optional type annotation, and an optional static optimization block */ @@ -6717,8 +6716,8 @@ opt_inline: | /* EMPTY */ { None } opt_mutable: - | MUTABLE { true } - | /* EMPTY */ { false } + | MUTABLE { Some(rhs parseState 1) } + | /* EMPTY */ { None } /* A 'do' token in either #light or non-#light */ doToken: diff --git a/src/Compiler/xlf/FSComp.txt.cs.xlf b/src/Compiler/xlf/FSComp.txt.cs.xlf index a55e3597c8..d9d890c710 100644 --- a/src/Compiler/xlf/FSComp.txt.cs.xlf +++ b/src/Compiler/xlf/FSComp.txt.cs.xlf @@ -907,6 +907,11 @@ Byl očekáván výraz. + + Expecting record field + Expecting record field + + Expecting pattern Očekává se vzorek. diff --git a/src/Compiler/xlf/FSComp.txt.de.xlf b/src/Compiler/xlf/FSComp.txt.de.xlf index 61ba65dcc1..34027132ed 100644 --- a/src/Compiler/xlf/FSComp.txt.de.xlf +++ b/src/Compiler/xlf/FSComp.txt.de.xlf @@ -907,6 +907,11 @@ Ausdruck wird erwartet + + Expecting record field + Expecting record field + + Expecting pattern Muster wird erwartet diff --git a/src/Compiler/xlf/FSComp.txt.es.xlf b/src/Compiler/xlf/FSComp.txt.es.xlf index 3b2dd6ee6a..4c591f6f13 100644 --- a/src/Compiler/xlf/FSComp.txt.es.xlf +++ b/src/Compiler/xlf/FSComp.txt.es.xlf @@ -907,6 +907,11 @@ Se espera una expresión + + Expecting record field + Expecting record field + + Expecting pattern Se espera un patrón diff --git a/src/Compiler/xlf/FSComp.txt.fr.xlf b/src/Compiler/xlf/FSComp.txt.fr.xlf index 7857228abf..14001fbd9e 100644 --- a/src/Compiler/xlf/FSComp.txt.fr.xlf +++ b/src/Compiler/xlf/FSComp.txt.fr.xlf @@ -907,6 +907,11 @@ Expression attendue + + Expecting record field + Expecting record field + + Expecting pattern Modèle attendu diff --git a/src/Compiler/xlf/FSComp.txt.it.xlf b/src/Compiler/xlf/FSComp.txt.it.xlf index 134e094dff..a0edd202be 100644 --- a/src/Compiler/xlf/FSComp.txt.it.xlf +++ b/src/Compiler/xlf/FSComp.txt.it.xlf @@ -907,6 +907,11 @@ Prevista espressione. + + Expecting record field + Expecting record field + + Expecting pattern Criterio previsto diff --git a/src/Compiler/xlf/FSComp.txt.ja.xlf b/src/Compiler/xlf/FSComp.txt.ja.xlf index f5a0d7e057..9181e17a42 100644 --- a/src/Compiler/xlf/FSComp.txt.ja.xlf +++ b/src/Compiler/xlf/FSComp.txt.ja.xlf @@ -907,6 +907,11 @@ 式を指定してください + + Expecting record field + Expecting record field + + Expecting pattern 必要なパターン diff --git a/src/Compiler/xlf/FSComp.txt.ko.xlf b/src/Compiler/xlf/FSComp.txt.ko.xlf index 7d68a8d3b7..0f11ea8327 100644 --- a/src/Compiler/xlf/FSComp.txt.ko.xlf +++ b/src/Compiler/xlf/FSComp.txt.ko.xlf @@ -907,6 +907,11 @@ 식이 필요함 + + Expecting record field + Expecting record field + + Expecting pattern 예상되는 패턴 diff --git a/src/Compiler/xlf/FSComp.txt.pl.xlf b/src/Compiler/xlf/FSComp.txt.pl.xlf index 4a768bb43a..cd5ef76a63 100644 --- a/src/Compiler/xlf/FSComp.txt.pl.xlf +++ b/src/Compiler/xlf/FSComp.txt.pl.xlf @@ -907,6 +907,11 @@ Oczekiwanie na wyrażenie + + Expecting record field + Expecting record field + + Expecting pattern Oczekiwano wzorca diff --git a/src/Compiler/xlf/FSComp.txt.pt-BR.xlf b/src/Compiler/xlf/FSComp.txt.pt-BR.xlf index b44ad46613..35d75d2ccf 100644 --- a/src/Compiler/xlf/FSComp.txt.pt-BR.xlf +++ b/src/Compiler/xlf/FSComp.txt.pt-BR.xlf @@ -907,6 +907,11 @@ Esperando uma expressão + + Expecting record field + Expecting record field + + Expecting pattern Padrão esperado diff --git a/src/Compiler/xlf/FSComp.txt.ru.xlf b/src/Compiler/xlf/FSComp.txt.ru.xlf index 55a7fa70ad..89ce0d6951 100644 --- a/src/Compiler/xlf/FSComp.txt.ru.xlf +++ b/src/Compiler/xlf/FSComp.txt.ru.xlf @@ -907,6 +907,11 @@ Ожидается выражение + + Expecting record field + Expecting record field + + Expecting pattern Ожидается шаблон diff --git a/src/Compiler/xlf/FSComp.txt.tr.xlf b/src/Compiler/xlf/FSComp.txt.tr.xlf index b1f1ba766f..1607a64406 100644 --- a/src/Compiler/xlf/FSComp.txt.tr.xlf +++ b/src/Compiler/xlf/FSComp.txt.tr.xlf @@ -907,6 +907,11 @@ İfade bekleniyor + + Expecting record field + Expecting record field + + Expecting pattern Desen bekleniyor diff --git a/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf b/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf index 7b87a73343..f116c2f1a7 100644 --- a/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf +++ b/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf @@ -907,6 +907,11 @@ 应为表达式 + + Expecting record field + Expecting record field + + Expecting pattern 预期模式 diff --git a/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf b/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf index cc69cca870..8decd4ee8f 100644 --- a/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf +++ b/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf @@ -907,6 +907,11 @@ 必須是運算式 + + Expecting record field + Expecting record field + + Expecting pattern 必須是模式 diff --git a/tests/service/data/SyntaxTree/Member/Field 01.fs.bsl b/tests/service/data/SyntaxTree/Member/Field 01.fs.bsl index 19453574e0..4b60596ef6 100644 --- a/tests/service/data/SyntaxTree/Member/Field 01.fs.bsl +++ b/tests/service/data/SyntaxTree/Member/Field 01.fs.bsl @@ -16,7 +16,7 @@ ImplFile ([], false, Some F1, LongIdent (SynLongIdent ([int], [], [None])), false, PreXmlDoc ((4,4), FSharp.Compiler.Xml.XmlDocCollector), - None, (4,8--4,15), + None, (4,4--4,15), { LeadingKeyword = Some (Val (4,4--4,7)) }), (4,4--4,15))], (4,4--4,15)), [], None, (3,5--4,15), { LeadingKeyword = Type (3,0--3,4) diff --git a/tests/service/data/SyntaxTree/Member/Field 02.fs.bsl b/tests/service/data/SyntaxTree/Member/Field 02.fs.bsl index fff1abdc07..3bcc4264a2 100644 --- a/tests/service/data/SyntaxTree/Member/Field 02.fs.bsl +++ b/tests/service/data/SyntaxTree/Member/Field 02.fs.bsl @@ -16,7 +16,7 @@ ImplFile ([], false, Some F1, FromParseError (4,11--4,11), false, PreXmlDoc ((4,4), FSharp.Compiler.Xml.XmlDocCollector), - None, (4,8--5,4), + None, (4,4--4,11), { LeadingKeyword = Some (Val (4,4--4,7)) }), (4,4--4,11)); ValField @@ -24,7 +24,7 @@ ImplFile ([], false, Some F2, LongIdent (SynLongIdent ([int], [], [None])), false, PreXmlDoc ((5,4), FSharp.Compiler.Xml.XmlDocCollector), - None, (5,8--5,15), + None, (5,4--5,15), { LeadingKeyword = Some (Val (5,4--5,7)) }), (5,4--5,15))], (4,4--5,15)), [], None, (3,5--5,15), { LeadingKeyword = Type (3,0--3,4) diff --git a/tests/service/data/SyntaxTree/Member/Field 03.fs.bsl b/tests/service/data/SyntaxTree/Member/Field 03.fs.bsl index de49a40d0a..9ea124eee3 100644 --- a/tests/service/data/SyntaxTree/Member/Field 03.fs.bsl +++ b/tests/service/data/SyntaxTree/Member/Field 03.fs.bsl @@ -13,17 +13,18 @@ ImplFile (Unspecified, [ValField (SynField - ([], false, Some F1, FromParseError (5,4--5,4), false, + ([], false, Some F1, FromParseError (4,10--4,10), + false, PreXmlDoc ((4,4), FSharp.Compiler.Xml.XmlDocCollector), - None, (4,8--134217728,0), + None, (4,4--4,10), { LeadingKeyword = Some (Val (4,4--4,7)) }), - (4,4--5,4)); + (4,4--4,10)); ValField (SynField ([], false, Some F2, LongIdent (SynLongIdent ([int], [], [None])), false, PreXmlDoc ((5,4), FSharp.Compiler.Xml.XmlDocCollector), - None, (5,8--5,15), + None, (5,4--5,15), { LeadingKeyword = Some (Val (5,4--5,7)) }), (5,4--5,15))], (4,4--5,15)), [], None, (3,5--5,15), { LeadingKeyword = Type (3,0--3,4) diff --git a/tests/service/data/SyntaxTree/Member/Field 04.fs.bsl b/tests/service/data/SyntaxTree/Member/Field 04.fs.bsl index 17a1c25006..1074b8e362 100644 --- a/tests/service/data/SyntaxTree/Member/Field 04.fs.bsl +++ b/tests/service/data/SyntaxTree/Member/Field 04.fs.bsl @@ -13,22 +13,22 @@ ImplFile (Unspecified, [ValField (SynField - ([], false, Some , FromParseError (1,13--1,13), false, + ([], false, None, FromParseError (4,7--4,7), false, PreXmlDoc ((4,4), FSharp.Compiler.Xml.XmlDocCollector), - None, (4,8--134217728,0), + None, (4,4--4,7), { LeadingKeyword = Some (Val (4,4--4,7)) }), - (1,13--4,7)); + (4,4--4,7)); ValField (SynField ([], false, Some F2, LongIdent (SynLongIdent ([int], [], [None])), false, PreXmlDoc ((5,4), FSharp.Compiler.Xml.XmlDocCollector), - None, (5,8--5,15), + None, (5,4--5,15), { LeadingKeyword = Some (Val (5,4--5,7)) }), - (5,4--5,15))], (1,13--5,15)), [], None, (1,13--5,15), + (5,4--5,15))], (4,4--5,15)), [], None, (3,5--5,15), { LeadingKeyword = Type (3,0--3,4) EqualsRange = Some (3,7--3,8) - WithKeyword = None })], (1,13--5,15)); + WithKeyword = None })], (3,0--5,15)); Expr (Const (Unit, (7,0--7,2)), (7,0--7,2))], PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, (1,0--7,2), { LeadingKeyword = Module (1,0--1,6) })], (true, true), diff --git a/tests/service/data/SyntaxTree/Member/Field 05.fs.bsl b/tests/service/data/SyntaxTree/Member/Field 05.fs.bsl index e5485cf278..27fe2dbef8 100644 --- a/tests/service/data/SyntaxTree/Member/Field 05.fs.bsl +++ b/tests/service/data/SyntaxTree/Member/Field 05.fs.bsl @@ -16,7 +16,7 @@ ImplFile ([], false, Some F, FromParseError (4,10--4,10), false, PreXmlDoc ((4,4), FSharp.Compiler.Xml.XmlDocCollector), - None, (4,8--6,1), + None, (4,4--4,10), { LeadingKeyword = Some (Val (4,4--4,7)) }), (4,4--4,10))], (4,4--4,10)), [], None, (3,5--4,10), { LeadingKeyword = Type (3,0--3,4) diff --git a/tests/service/data/SyntaxTree/Member/Field 06.fs.bsl b/tests/service/data/SyntaxTree/Member/Field 06.fs.bsl index 066a055a8d..930233ae6f 100644 --- a/tests/service/data/SyntaxTree/Member/Field 06.fs.bsl +++ b/tests/service/data/SyntaxTree/Member/Field 06.fs.bsl @@ -13,14 +13,14 @@ ImplFile (Unspecified, [ValField (SynField - ([], false, Some F, FromParseError (6,1--6,1), false, + ([], false, Some F, FromParseError (4,9--4,9), false, PreXmlDoc ((4,4), FSharp.Compiler.Xml.XmlDocCollector), - None, (4,8--134217728,0), + None, (4,4--4,9), { LeadingKeyword = Some (Val (4,4--4,7)) }), - (4,4--6,1))], (4,4--6,1)), [], None, (3,5--6,1), + (4,4--4,9))], (4,4--4,9)), [], None, (3,5--4,9), { LeadingKeyword = Type (3,0--3,4) EqualsRange = Some (3,7--3,8) - WithKeyword = None })], (3,0--6,1)); + WithKeyword = None })], (3,0--4,9)); Expr (Const (Unit, (6,0--6,2)), (6,0--6,2))], PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, (1,0--6,2), { LeadingKeyword = Module (1,0--1,6) })], (true, true), diff --git a/tests/service/data/SyntaxTree/Member/Field 07.fs.bsl b/tests/service/data/SyntaxTree/Member/Field 07.fs.bsl index f86322e7ed..2e6dfc6906 100644 --- a/tests/service/data/SyntaxTree/Member/Field 07.fs.bsl +++ b/tests/service/data/SyntaxTree/Member/Field 07.fs.bsl @@ -13,14 +13,14 @@ ImplFile (Unspecified, [ValField (SynField - ([], false, Some , FromParseError (1,13--1,13), false, + ([], false, None, FromParseError (4,7--4,7), false, PreXmlDoc ((4,4), FSharp.Compiler.Xml.XmlDocCollector), - None, (6,0--134217728,0), + None, (4,4--4,7), { LeadingKeyword = Some (Val (4,4--4,7)) }), - (1,13--4,7))], (1,13--4,7)), [], None, (1,13--4,7), + (4,4--4,7))], (4,4--4,7)), [], None, (3,5--4,7), { LeadingKeyword = Type (3,0--3,4) EqualsRange = Some (3,7--3,8) - WithKeyword = None })], (1,13--4,7)); + WithKeyword = None })], (3,0--4,7)); Expr (Const (Unit, (6,0--6,2)), (6,0--6,2))], PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, (1,0--6,2), { LeadingKeyword = Module (1,0--1,6) })], (true, true), diff --git a/tests/service/data/SyntaxTree/Member/Field 08.fs.bsl b/tests/service/data/SyntaxTree/Member/Field 08.fs.bsl index 000f2c6312..47cc099ef4 100644 --- a/tests/service/data/SyntaxTree/Member/Field 08.fs.bsl +++ b/tests/service/data/SyntaxTree/Member/Field 08.fs.bsl @@ -13,11 +13,11 @@ ImplFile (Struct, [ValField (SynField - ([], false, Some , FromParseError (1,13--1,13), false, + ([], false, None, FromParseError (5,11--5,11), false, PreXmlDoc ((5,8), FSharp.Compiler.Xml.XmlDocCollector), - None, (6,4--134217728,0), + None, (5,8--5,11), { LeadingKeyword = Some (Val (5,8--5,11)) }), - (1,13--5,11))], (4,4--6,7)), [], None, (3,5--6,7), + (5,8--5,11))], (4,4--6,7)), [], None, (3,5--6,7), { LeadingKeyword = Type (3,0--3,4) EqualsRange = Some (3,7--3,8) WithKeyword = None })], (3,0--6,7)); diff --git a/tests/service/data/SyntaxTree/Member/Field 09.fs.bsl b/tests/service/data/SyntaxTree/Member/Field 09.fs.bsl index 22f89b8786..cf52b55505 100644 --- a/tests/service/data/SyntaxTree/Member/Field 09.fs.bsl +++ b/tests/service/data/SyntaxTree/Member/Field 09.fs.bsl @@ -13,15 +13,15 @@ ImplFile (Unspecified, [ValField (SynField - ([], true, Some , FromParseError (1,13--1,13), false, + ([], true, None, FromParseError (4,14--4,14), false, PreXmlDoc ((4,4), FSharp.Compiler.Xml.XmlDocCollector), - None, (6,0--134217728,0), + None, (4,4--4,14), { LeadingKeyword = Some (StaticVal ((4,4--4,10), (4,11--4,14))) }), - (1,13--4,10))], (1,13--4,10)), [], None, (1,13--4,10), + (4,4--4,14))], (4,4--4,14)), [], None, (3,5--4,14), { LeadingKeyword = Type (3,0--3,4) EqualsRange = Some (3,7--3,8) - WithKeyword = None })], (1,13--4,10)); + WithKeyword = None })], (3,0--4,14)); Expr (Const (Unit, (6,0--6,2)), (6,0--6,2))], PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, (1,0--6,2), { LeadingKeyword = Module (1,0--1,6) })], (true, true), diff --git a/tests/service/data/SyntaxTree/Member/Field 10.fs b/tests/service/data/SyntaxTree/Member/Field 10.fs new file mode 100644 index 0000000000..4e4f23d285 --- /dev/null +++ b/tests/service/data/SyntaxTree/Member/Field 10.fs @@ -0,0 +1,6 @@ +module Module + +type T = + static val mutable + +() diff --git a/tests/service/data/SyntaxTree/Member/Field 10.fs.bsl b/tests/service/data/SyntaxTree/Member/Field 10.fs.bsl new file mode 100644 index 0000000000..d60916014f --- /dev/null +++ b/tests/service/data/SyntaxTree/Member/Field 10.fs.bsl @@ -0,0 +1,31 @@ +ImplFile + (ParsedImplFileInput + ("/root/Member/Field 10.fs", false, QualifiedNameOfFile Module, [], [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Types + ([SynTypeDefn + (SynComponentInfo + ([], None, [], [T], + PreXmlDoc ((3,0), FSharp.Compiler.Xml.XmlDocCollector), + false, None, (3,5--3,6)), + ObjectModel + (Unspecified, + [ValField + (SynField + ([], true, None, FromParseError (4,22--4,22), true, + PreXmlDoc ((4,4), FSharp.Compiler.Xml.XmlDocCollector), + None, (4,4--4,22), + { LeadingKeyword = + Some (StaticVal ((4,4--4,10), (4,11--4,14))) }), + (4,4--4,22))], (4,4--4,22)), [], None, (3,5--4,22), + { LeadingKeyword = Type (3,0--3,4) + EqualsRange = Some (3,7--3,8) + WithKeyword = None })], (3,0--4,22)); + Expr (Const (Unit, (6,0--6,2)), (6,0--6,2))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--6,2), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + CodeComments = [] }, set [])) + +(6,0)-(6,1) parse error Incomplete structured construct at or before this point in type definition. Expected identifier or other token. diff --git a/tests/service/data/SyntaxTree/Member/Field 11.fs b/tests/service/data/SyntaxTree/Member/Field 11.fs new file mode 100644 index 0000000000..5599e7906a --- /dev/null +++ b/tests/service/data/SyntaxTree/Member/Field 11.fs @@ -0,0 +1,6 @@ +module Module + +type T = + static val mutable private + +() diff --git a/tests/service/data/SyntaxTree/Member/Field 11.fs.bsl b/tests/service/data/SyntaxTree/Member/Field 11.fs.bsl new file mode 100644 index 0000000000..c0415e5509 --- /dev/null +++ b/tests/service/data/SyntaxTree/Member/Field 11.fs.bsl @@ -0,0 +1,31 @@ +ImplFile + (ParsedImplFileInput + ("/root/Member/Field 11.fs", false, QualifiedNameOfFile Module, [], [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Types + ([SynTypeDefn + (SynComponentInfo + ([], None, [], [T], + PreXmlDoc ((3,0), FSharp.Compiler.Xml.XmlDocCollector), + false, None, (3,5--3,6)), + ObjectModel + (Unspecified, + [ValField + (SynField + ([], true, None, FromParseError (4,30--4,30), true, + PreXmlDoc ((4,4), FSharp.Compiler.Xml.XmlDocCollector), + Some (Private (4,23--4,30)), (4,4--4,30), + { LeadingKeyword = + Some (StaticVal ((4,4--4,10), (4,11--4,14))) }), + (4,4--4,30))], (4,4--4,30)), [], None, (3,5--4,30), + { LeadingKeyword = Type (3,0--3,4) + EqualsRange = Some (3,7--3,8) + WithKeyword = None })], (3,0--4,30)); + Expr (Const (Unit, (6,0--6,2)), (6,0--6,2))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--6,2), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + CodeComments = [] }, set [])) + +(6,0)-(6,1) parse error Incomplete structured construct at or before this point in type definition. Expected identifier or other token. diff --git a/tests/service/data/SyntaxTree/Member/Field 12.fs b/tests/service/data/SyntaxTree/Member/Field 12.fs new file mode 100644 index 0000000000..0f62041753 --- /dev/null +++ b/tests/service/data/SyntaxTree/Member/Field 12.fs @@ -0,0 +1,6 @@ +module Module + +type T = + static val mutable private F + +() diff --git a/tests/service/data/SyntaxTree/Member/Field 12.fs.bsl b/tests/service/data/SyntaxTree/Member/Field 12.fs.bsl new file mode 100644 index 0000000000..e9f7949564 --- /dev/null +++ b/tests/service/data/SyntaxTree/Member/Field 12.fs.bsl @@ -0,0 +1,31 @@ +ImplFile + (ParsedImplFileInput + ("/root/Member/Field 12.fs", false, QualifiedNameOfFile Module, [], [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Types + ([SynTypeDefn + (SynComponentInfo + ([], None, [], [T], + PreXmlDoc ((3,0), FSharp.Compiler.Xml.XmlDocCollector), + false, None, (3,5--3,6)), + ObjectModel + (Unspecified, + [ValField + (SynField + ([], true, Some F, FromParseError (4,32--4,32), true, + PreXmlDoc ((4,4), FSharp.Compiler.Xml.XmlDocCollector), + Some (Private (4,23--4,30)), (4,4--4,32), + { LeadingKeyword = + Some (StaticVal ((4,4--4,10), (4,11--4,14))) }), + (4,4--4,32))], (4,4--4,32)), [], None, (3,5--4,32), + { LeadingKeyword = Type (3,0--3,4) + EqualsRange = Some (3,7--3,8) + WithKeyword = None })], (3,0--4,32)); + Expr (Const (Unit, (6,0--6,2)), (6,0--6,2))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--6,2), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + CodeComments = [] }, set [])) + +(6,0)-(6,1) parse error Incomplete structured construct at or before this point in type definition. Expected ':' or other token. diff --git a/tests/service/data/SyntaxTree/Member/Field 13.fs b/tests/service/data/SyntaxTree/Member/Field 13.fs new file mode 100644 index 0000000000..6656f609f9 --- /dev/null +++ b/tests/service/data/SyntaxTree/Member/Field 13.fs @@ -0,0 +1,6 @@ +module Module + +type T = + static val mutable private F: + +() diff --git a/tests/service/data/SyntaxTree/Member/Field 13.fs.bsl b/tests/service/data/SyntaxTree/Member/Field 13.fs.bsl new file mode 100644 index 0000000000..7d8c762c5d --- /dev/null +++ b/tests/service/data/SyntaxTree/Member/Field 13.fs.bsl @@ -0,0 +1,31 @@ +ImplFile + (ParsedImplFileInput + ("/root/Member/Field 13.fs", false, QualifiedNameOfFile Module, [], [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Types + ([SynTypeDefn + (SynComponentInfo + ([], None, [], [T], + PreXmlDoc ((3,0), FSharp.Compiler.Xml.XmlDocCollector), + false, None, (3,5--3,6)), + ObjectModel + (Unspecified, + [ValField + (SynField + ([], true, Some F, FromParseError (4,33--4,33), true, + PreXmlDoc ((4,4), FSharp.Compiler.Xml.XmlDocCollector), + Some (Private (4,23--4,30)), (4,4--4,33), + { LeadingKeyword = + Some (StaticVal ((4,4--4,10), (4,11--4,14))) }), + (4,4--4,33))], (4,4--4,33)), [], None, (3,5--4,33), + { LeadingKeyword = Type (3,0--3,4) + EqualsRange = Some (3,7--3,8) + WithKeyword = None })], (3,0--4,33)); + Expr (Const (Unit, (6,0--6,2)), (6,0--6,2))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--6,2), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + CodeComments = [] }, set [])) + +(6,0)-(6,1) parse error Incomplete structured construct at or before this point in type definition diff --git a/tests/service/data/SyntaxTree/Member/Field 14.fs b/tests/service/data/SyntaxTree/Member/Field 14.fs new file mode 100644 index 0000000000..fa2e792304 --- /dev/null +++ b/tests/service/data/SyntaxTree/Member/Field 14.fs @@ -0,0 +1,6 @@ +module Module + +type T = + static val mutable private F: int + +() diff --git a/tests/service/data/SyntaxTree/Member/Field 14.fs.bsl b/tests/service/data/SyntaxTree/Member/Field 14.fs.bsl new file mode 100644 index 0000000000..919a08217d --- /dev/null +++ b/tests/service/data/SyntaxTree/Member/Field 14.fs.bsl @@ -0,0 +1,30 @@ +ImplFile + (ParsedImplFileInput + ("/root/Member/Field 14.fs", false, QualifiedNameOfFile Module, [], [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Types + ([SynTypeDefn + (SynComponentInfo + ([], None, [], [T], + PreXmlDoc ((3,0), FSharp.Compiler.Xml.XmlDocCollector), + false, None, (3,5--3,6)), + ObjectModel + (Unspecified, + [ValField + (SynField + ([], true, Some F, + LongIdent (SynLongIdent ([int], [], [None])), true, + PreXmlDoc ((4,4), FSharp.Compiler.Xml.XmlDocCollector), + Some (Private (4,23--4,30)), (4,4--4,37), + { LeadingKeyword = + Some (StaticVal ((4,4--4,10), (4,11--4,14))) }), + (4,4--4,37))], (4,4--4,37)), [], None, (3,5--4,37), + { LeadingKeyword = Type (3,0--3,4) + EqualsRange = Some (3,7--3,8) + WithKeyword = None })], (3,0--4,37)); + Expr (Const (Unit, (6,0--6,2)), (6,0--6,2))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--6,2), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/Type/Record - Access 01.fs b/tests/service/data/SyntaxTree/Type/Record - Access 01.fs new file mode 100644 index 0000000000..5aa6084b5f --- /dev/null +++ b/tests/service/data/SyntaxTree/Type/Record - Access 01.fs @@ -0,0 +1,8 @@ +module Module + +type R = + { + internal + } + +() diff --git a/tests/service/data/SyntaxTree/Type/Record - Access 01.fs.bsl b/tests/service/data/SyntaxTree/Type/Record - Access 01.fs.bsl new file mode 100644 index 0000000000..9421a92c55 --- /dev/null +++ b/tests/service/data/SyntaxTree/Type/Record - Access 01.fs.bsl @@ -0,0 +1,31 @@ +ImplFile + (ParsedImplFileInput + ("/root/Type/Record - Access 01.fs", false, QualifiedNameOfFile Module, [], + [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Types + ([SynTypeDefn + (SynComponentInfo + ([], None, [], [R], + PreXmlDoc ((3,0), FSharp.Compiler.Xml.XmlDocCollector), + false, None, (3,5--3,6)), + Simple + (Record + (None, + [SynField + ([], false, None, FromParseError (5,16--5,16), false, + PreXmlDoc ((5,8), FSharp.Compiler.Xml.XmlDocCollector), + None, (5,8--5,16), { LeadingKeyword = None })], + (4,4--6,5)), (4,4--6,5)), [], None, (3,5--6,5), + { LeadingKeyword = Type (3,0--3,4) + EqualsRange = Some (3,7--3,8) + WithKeyword = None })], (3,0--6,5)); + Expr (Const (Unit, (8,0--8,2)), (8,0--8,2))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--8,2), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + CodeComments = [] }, set [])) + +(6,4)-(6,5) parse error Unexpected symbol '}' in field declaration. Expected identifier or other token. +(5,8)-(6,5) parse error Accessibility modifiers are not permitted on record fields. Use 'type R = internal ...' or 'type R = private ...' to give an accessibility to the whole representation. diff --git a/tests/service/data/SyntaxTree/Type/Record - Access 02.fs b/tests/service/data/SyntaxTree/Type/Record - Access 02.fs new file mode 100644 index 0000000000..0763672605 --- /dev/null +++ b/tests/service/data/SyntaxTree/Type/Record - Access 02.fs @@ -0,0 +1,8 @@ +module Module + +type R = + { + mutable internal + } + +() diff --git a/tests/service/data/SyntaxTree/Type/Record - Access 02.fs.bsl b/tests/service/data/SyntaxTree/Type/Record - Access 02.fs.bsl new file mode 100644 index 0000000000..bd47ffadd8 --- /dev/null +++ b/tests/service/data/SyntaxTree/Type/Record - Access 02.fs.bsl @@ -0,0 +1,31 @@ +ImplFile + (ParsedImplFileInput + ("/root/Type/Record - Access 02.fs", false, QualifiedNameOfFile Module, [], + [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Types + ([SynTypeDefn + (SynComponentInfo + ([], None, [], [R], + PreXmlDoc ((3,0), FSharp.Compiler.Xml.XmlDocCollector), + false, None, (3,5--3,6)), + Simple + (Record + (None, + [SynField + ([], false, None, FromParseError (5,24--5,24), true, + PreXmlDoc ((5,8), FSharp.Compiler.Xml.XmlDocCollector), + None, (5,8--5,24), { LeadingKeyword = None })], + (4,4--6,5)), (4,4--6,5)), [], None, (3,5--6,5), + { LeadingKeyword = Type (3,0--3,4) + EqualsRange = Some (3,7--3,8) + WithKeyword = None })], (3,0--6,5)); + Expr (Const (Unit, (8,0--8,2)), (8,0--8,2))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--8,2), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + CodeComments = [] }, set [])) + +(6,4)-(6,5) parse error Unexpected symbol '}' in field declaration. Expected identifier or other token. +(5,8)-(6,5) parse error Accessibility modifiers are not permitted on record fields. Use 'type R = internal ...' or 'type R = private ...' to give an accessibility to the whole representation. diff --git a/tests/service/data/SyntaxTree/Type/Record - Access 03.fs b/tests/service/data/SyntaxTree/Type/Record - Access 03.fs new file mode 100644 index 0000000000..f2aeb291f6 --- /dev/null +++ b/tests/service/data/SyntaxTree/Type/Record - Access 03.fs @@ -0,0 +1,8 @@ +module Module + +type R = + { + mutable internal F: int + } + +() diff --git a/tests/service/data/SyntaxTree/Type/Record - Access 03.fs.bsl b/tests/service/data/SyntaxTree/Type/Record - Access 03.fs.bsl new file mode 100644 index 0000000000..67dac77750 --- /dev/null +++ b/tests/service/data/SyntaxTree/Type/Record - Access 03.fs.bsl @@ -0,0 +1,31 @@ +ImplFile + (ParsedImplFileInput + ("/root/Type/Record - Access 03.fs", false, QualifiedNameOfFile Module, [], + [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Types + ([SynTypeDefn + (SynComponentInfo + ([], None, [], [R], + PreXmlDoc ((3,0), FSharp.Compiler.Xml.XmlDocCollector), + false, None, (3,5--3,6)), + Simple + (Record + (None, + [SynField + ([], false, Some F, + LongIdent (SynLongIdent ([int], [], [None])), true, + PreXmlDoc ((5,8), FSharp.Compiler.Xml.XmlDocCollector), + None, (5,8--5,31), { LeadingKeyword = None })], + (4,4--6,5)), (4,4--6,5)), [], None, (3,5--6,5), + { LeadingKeyword = Type (3,0--3,4) + EqualsRange = Some (3,7--3,8) + WithKeyword = None })], (3,0--6,5)); + Expr (Const (Unit, (8,0--8,2)), (8,0--8,2))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--8,2), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + CodeComments = [] }, set [])) + +(5,8)-(5,31) parse error Accessibility modifiers are not permitted on record fields. Use 'type R = internal ...' or 'type R = private ...' to give an accessibility to the whole representation. diff --git a/tests/service/data/SyntaxTree/Type/Record - Access 04.fs b/tests/service/data/SyntaxTree/Type/Record - Access 04.fs new file mode 100644 index 0000000000..da377bf20b --- /dev/null +++ b/tests/service/data/SyntaxTree/Type/Record - Access 04.fs @@ -0,0 +1,8 @@ +module Module + +type R = + { + internal F: int + } + +() diff --git a/tests/service/data/SyntaxTree/Type/Record - Access 04.fs.bsl b/tests/service/data/SyntaxTree/Type/Record - Access 04.fs.bsl new file mode 100644 index 0000000000..d9b3583bdf --- /dev/null +++ b/tests/service/data/SyntaxTree/Type/Record - Access 04.fs.bsl @@ -0,0 +1,31 @@ +ImplFile + (ParsedImplFileInput + ("/root/Type/Record - Access 04.fs", false, QualifiedNameOfFile Module, [], + [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Types + ([SynTypeDefn + (SynComponentInfo + ([], None, [], [R], + PreXmlDoc ((3,0), FSharp.Compiler.Xml.XmlDocCollector), + false, None, (3,5--3,6)), + Simple + (Record + (None, + [SynField + ([], false, Some F, + LongIdent (SynLongIdent ([int], [], [None])), false, + PreXmlDoc ((5,8), FSharp.Compiler.Xml.XmlDocCollector), + None, (5,8--5,23), { LeadingKeyword = None })], + (4,4--6,5)), (4,4--6,5)), [], None, (3,5--6,5), + { LeadingKeyword = Type (3,0--3,4) + EqualsRange = Some (3,7--3,8) + WithKeyword = None })], (3,0--6,5)); + Expr (Const (Unit, (8,0--8,2)), (8,0--8,2))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--8,2), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + CodeComments = [] }, set [])) + +(5,8)-(5,23) parse error Accessibility modifiers are not permitted on record fields. Use 'type R = internal ...' or 'type R = private ...' to give an accessibility to the whole representation. diff --git a/tests/service/data/SyntaxTree/Type/Record - Mutable 01.fs b/tests/service/data/SyntaxTree/Type/Record - Mutable 01.fs new file mode 100644 index 0000000000..0aff5f6999 --- /dev/null +++ b/tests/service/data/SyntaxTree/Type/Record - Mutable 01.fs @@ -0,0 +1,8 @@ +module Module + +type R = + { + mutable + } + +() diff --git a/tests/service/data/SyntaxTree/Type/Record - Mutable 01.fs.bsl b/tests/service/data/SyntaxTree/Type/Record - Mutable 01.fs.bsl new file mode 100644 index 0000000000..5a44e8b076 --- /dev/null +++ b/tests/service/data/SyntaxTree/Type/Record - Mutable 01.fs.bsl @@ -0,0 +1,30 @@ +ImplFile + (ParsedImplFileInput + ("/root/Type/Record - Mutable 01.fs", false, QualifiedNameOfFile Module, [], + [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Types + ([SynTypeDefn + (SynComponentInfo + ([], None, [], [R], + PreXmlDoc ((3,0), FSharp.Compiler.Xml.XmlDocCollector), + false, None, (3,5--3,6)), + Simple + (Record + (None, + [SynField + ([], false, None, FromParseError (5,15--5,15), true, + PreXmlDoc ((5,8), FSharp.Compiler.Xml.XmlDocCollector), + None, (5,8--5,15), { LeadingKeyword = None })], + (4,4--6,5)), (4,4--6,5)), [], None, (3,5--6,5), + { LeadingKeyword = Type (3,0--3,4) + EqualsRange = Some (3,7--3,8) + WithKeyword = None })], (3,0--6,5)); + Expr (Const (Unit, (8,0--8,2)), (8,0--8,2))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--8,2), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + CodeComments = [] }, set [])) + +(6,4)-(6,5) parse error Unexpected symbol '}' in field declaration. Expected identifier or other token. diff --git a/tests/service/data/SyntaxTree/Type/Record - Mutable 02.fs b/tests/service/data/SyntaxTree/Type/Record - Mutable 02.fs new file mode 100644 index 0000000000..db2a7fa0f0 --- /dev/null +++ b/tests/service/data/SyntaxTree/Type/Record - Mutable 02.fs @@ -0,0 +1,9 @@ +module Module + +type R = + { + F1: int + mutable + } + +() diff --git a/tests/service/data/SyntaxTree/Type/Record - Mutable 02.fs.bsl b/tests/service/data/SyntaxTree/Type/Record - Mutable 02.fs.bsl new file mode 100644 index 0000000000..2cedf23416 --- /dev/null +++ b/tests/service/data/SyntaxTree/Type/Record - Mutable 02.fs.bsl @@ -0,0 +1,35 @@ +ImplFile + (ParsedImplFileInput + ("/root/Type/Record - Mutable 02.fs", false, QualifiedNameOfFile Module, [], + [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Types + ([SynTypeDefn + (SynComponentInfo + ([], None, [], [R], + PreXmlDoc ((3,0), FSharp.Compiler.Xml.XmlDocCollector), + false, None, (3,5--3,6)), + Simple + (Record + (None, + [SynField + ([], false, Some F1, + LongIdent (SynLongIdent ([int], [], [None])), false, + PreXmlDoc ((5,8), FSharp.Compiler.Xml.XmlDocCollector), + None, (5,8--5,15), { LeadingKeyword = None }); + SynField + ([], false, None, FromParseError (6,15--6,15), true, + PreXmlDoc ((6,8), FSharp.Compiler.Xml.XmlDocCollector), + None, (6,8--6,15), { LeadingKeyword = None })], + (4,4--7,5)), (4,4--7,5)), [], None, (3,5--7,5), + { LeadingKeyword = Type (3,0--3,4) + EqualsRange = Some (3,7--3,8) + WithKeyword = None })], (3,0--7,5)); + Expr (Const (Unit, (9,0--9,2)), (9,0--9,2))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--9,2), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + CodeComments = [] }, set [])) + +(7,4)-(7,5) parse error Unexpected symbol '}' in field declaration. Expected identifier or other token. diff --git a/tests/service/data/SyntaxTree/Type/Record - Mutable 03.fs b/tests/service/data/SyntaxTree/Type/Record - Mutable 03.fs new file mode 100644 index 0000000000..1f1c5dcbf4 --- /dev/null +++ b/tests/service/data/SyntaxTree/Type/Record - Mutable 03.fs @@ -0,0 +1,9 @@ +module Module + +type R = + { + mutable + F2: int + } + +() diff --git a/tests/service/data/SyntaxTree/Type/Record - Mutable 03.fs.bsl b/tests/service/data/SyntaxTree/Type/Record - Mutable 03.fs.bsl new file mode 100644 index 0000000000..1ab133c1cb --- /dev/null +++ b/tests/service/data/SyntaxTree/Type/Record - Mutable 03.fs.bsl @@ -0,0 +1,35 @@ +ImplFile + (ParsedImplFileInput + ("/root/Type/Record - Mutable 03.fs", false, QualifiedNameOfFile Module, [], + [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Types + ([SynTypeDefn + (SynComponentInfo + ([], None, [], [R], + PreXmlDoc ((3,0), FSharp.Compiler.Xml.XmlDocCollector), + false, None, (3,5--3,6)), + Simple + (Record + (None, + [SynField + ([], false, None, FromParseError (5,15--5,15), true, + PreXmlDoc ((5,8), FSharp.Compiler.Xml.XmlDocCollector), + None, (5,8--5,15), { LeadingKeyword = None }); + SynField + ([], false, Some F2, + LongIdent (SynLongIdent ([int], [], [None])), false, + PreXmlDoc ((6,8), FSharp.Compiler.Xml.XmlDocCollector), + None, (6,8--6,15), { LeadingKeyword = None })], + (4,4--7,5)), (4,4--7,5)), [], None, (3,5--7,5), + { LeadingKeyword = Type (3,0--3,4) + EqualsRange = Some (3,7--3,8) + WithKeyword = None })], (3,0--7,5)); + Expr (Const (Unit, (9,0--9,2)), (9,0--9,2))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--9,2), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + CodeComments = [] }, set [])) + +(5,16)-(6,8) parse error Incomplete structured construct at or before this point in field declaration. Expected identifier or other token. diff --git a/tests/service/data/SyntaxTree/Type/Record - Mutable 04.fs b/tests/service/data/SyntaxTree/Type/Record - Mutable 04.fs new file mode 100644 index 0000000000..f61e93105a --- /dev/null +++ b/tests/service/data/SyntaxTree/Type/Record - Mutable 04.fs @@ -0,0 +1,10 @@ +module Module + +type R = + { + F1: int + mutable + F3: int + } + +() diff --git a/tests/service/data/SyntaxTree/Type/Record - Mutable 04.fs.bsl b/tests/service/data/SyntaxTree/Type/Record - Mutable 04.fs.bsl new file mode 100644 index 0000000000..9b3ad61203 --- /dev/null +++ b/tests/service/data/SyntaxTree/Type/Record - Mutable 04.fs.bsl @@ -0,0 +1,40 @@ +ImplFile + (ParsedImplFileInput + ("/root/Type/Record - Mutable 04.fs", false, QualifiedNameOfFile Module, [], + [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Types + ([SynTypeDefn + (SynComponentInfo + ([], None, [], [R], + PreXmlDoc ((3,0), FSharp.Compiler.Xml.XmlDocCollector), + false, None, (3,5--3,6)), + Simple + (Record + (None, + [SynField + ([], false, Some F1, + LongIdent (SynLongIdent ([int], [], [None])), false, + PreXmlDoc ((5,8), FSharp.Compiler.Xml.XmlDocCollector), + None, (5,8--5,15), { LeadingKeyword = None }); + SynField + ([], false, None, FromParseError (6,15--6,15), true, + PreXmlDoc ((6,8), FSharp.Compiler.Xml.XmlDocCollector), + None, (6,8--6,15), { LeadingKeyword = None }); + SynField + ([], false, Some F3, + LongIdent (SynLongIdent ([int], [], [None])), false, + PreXmlDoc ((7,8), FSharp.Compiler.Xml.XmlDocCollector), + None, (7,8--7,15), { LeadingKeyword = None })], + (4,4--8,5)), (4,4--8,5)), [], None, (3,5--8,5), + { LeadingKeyword = Type (3,0--3,4) + EqualsRange = Some (3,7--3,8) + WithKeyword = None })], (3,0--8,5)); + Expr (Const (Unit, (10,0--10,2)), (10,0--10,2))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--10,2), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + CodeComments = [] }, set [])) + +(6,16)-(7,8) parse error Incomplete structured construct at or before this point in field declaration. Expected identifier or other token. diff --git a/tests/service/data/SyntaxTree/Type/Record - Mutable 05.fs b/tests/service/data/SyntaxTree/Type/Record - Mutable 05.fs new file mode 100644 index 0000000000..81e33d6c9a --- /dev/null +++ b/tests/service/data/SyntaxTree/Type/Record - Mutable 05.fs @@ -0,0 +1,10 @@ +module Module + +type R = + { + F1: int + mutable F2: int + F3: int + } + +() diff --git a/tests/service/data/SyntaxTree/Type/Record - Mutable 05.fs.bsl b/tests/service/data/SyntaxTree/Type/Record - Mutable 05.fs.bsl new file mode 100644 index 0000000000..567858760a --- /dev/null +++ b/tests/service/data/SyntaxTree/Type/Record - Mutable 05.fs.bsl @@ -0,0 +1,39 @@ +ImplFile + (ParsedImplFileInput + ("/root/Type/Record - Mutable 05.fs", false, QualifiedNameOfFile Module, [], + [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Types + ([SynTypeDefn + (SynComponentInfo + ([], None, [], [R], + PreXmlDoc ((3,0), FSharp.Compiler.Xml.XmlDocCollector), + false, None, (3,5--3,6)), + Simple + (Record + (None, + [SynField + ([], false, Some F1, + LongIdent (SynLongIdent ([int], [], [None])), false, + PreXmlDoc ((5,8), FSharp.Compiler.Xml.XmlDocCollector), + None, (5,8--5,15), { LeadingKeyword = None }); + SynField + ([], false, Some F2, + LongIdent (SynLongIdent ([int], [], [None])), true, + PreXmlDoc ((6,8), FSharp.Compiler.Xml.XmlDocCollector), + None, (6,8--6,23), { LeadingKeyword = None }); + SynField + ([], false, Some F3, + LongIdent (SynLongIdent ([int], [], [None])), false, + PreXmlDoc ((7,8), FSharp.Compiler.Xml.XmlDocCollector), + None, (7,8--7,15), { LeadingKeyword = None })], + (4,4--8,5)), (4,4--8,5)), [], None, (3,5--8,5), + { LeadingKeyword = Type (3,0--3,4) + EqualsRange = Some (3,7--3,8) + WithKeyword = None })], (3,0--8,5)); + Expr (Const (Unit, (10,0--10,2)), (10,0--10,2))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--10,2), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/Type/Record 01.fs.bsl b/tests/service/data/SyntaxTree/Type/Record 01.fs.bsl index 91d5f58ca5..109206f10c 100644 --- a/tests/service/data/SyntaxTree/Type/Record 01.fs.bsl +++ b/tests/service/data/SyntaxTree/Type/Record 01.fs.bsl @@ -20,7 +20,7 @@ ImplFile SynField ([], false, Some T, FromParseError (6,9--6,9), false, PreXmlDoc ((6,8), FSharp.Compiler.Xml.XmlDocCollector), - None, (6,8--7,5), { LeadingKeyword = None })], + None, (6,8--6,9), { LeadingKeyword = None })], (4,4--7,5)), (4,4--7,5)), [], None, (3,5--7,5), { LeadingKeyword = Type (3,0--3,4) EqualsRange = Some (3,8--3,9) diff --git a/tests/service/data/SyntaxTree/Type/Record 02.fs.bsl b/tests/service/data/SyntaxTree/Type/Record 02.fs.bsl index 3ebdfe18ae..b218789c91 100644 --- a/tests/service/data/SyntaxTree/Type/Record 02.fs.bsl +++ b/tests/service/data/SyntaxTree/Type/Record 02.fs.bsl @@ -21,7 +21,7 @@ ImplFile ([], false, Some T, FromParseError (6,11--6,11), false, PreXmlDoc ((6,8), FSharp.Compiler.Xml.XmlDocCollector), - None, (6,8--7,5), { LeadingKeyword = None })], + None, (6,8--6,11), { LeadingKeyword = None })], (4,4--7,5)), (4,4--7,5)), [], None, (3,5--7,5), { LeadingKeyword = Type (3,0--3,4) EqualsRange = Some (3,8--3,9) diff --git a/tests/service/data/SyntaxTree/Type/Record 03.fs b/tests/service/data/SyntaxTree/Type/Record 03.fs new file mode 100644 index 0000000000..3bd731d5d6 --- /dev/null +++ b/tests/service/data/SyntaxTree/Type/Record 03.fs @@ -0,0 +1,6 @@ +module Module + +type R = + { } + +() diff --git a/tests/service/data/SyntaxTree/Type/Record 03.fs.bsl b/tests/service/data/SyntaxTree/Type/Record 03.fs.bsl new file mode 100644 index 0000000000..8777aa1b20 --- /dev/null +++ b/tests/service/data/SyntaxTree/Type/Record 03.fs.bsl @@ -0,0 +1,22 @@ +ImplFile + (ParsedImplFileInput + ("/root/Type/Record 03.fs", false, QualifiedNameOfFile Module, [], [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Types + ([SynTypeDefn + (SynComponentInfo + ([], None, [], [R], + PreXmlDoc ((3,0), FSharp.Compiler.Xml.XmlDocCollector), + false, None, (3,5--3,6)), + Simple (Record (None, [], (4,4--4,7)), (4,4--4,7)), [], None, + (3,5--4,7), { LeadingKeyword = Type (3,0--3,4) + EqualsRange = Some (3,7--3,8) + WithKeyword = None })], (3,0--4,7)); + Expr (Const (Unit, (6,0--6,2)), (6,0--6,2))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--6,2), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + CodeComments = [] }, set [])) + +(4,6)-(4,7) parse error Expecting record field diff --git a/tests/service/data/SyntaxTree/Type/Record 04.fs b/tests/service/data/SyntaxTree/Type/Record 04.fs new file mode 100644 index 0000000000..f3437a9125 --- /dev/null +++ b/tests/service/data/SyntaxTree/Type/Record 04.fs @@ -0,0 +1,8 @@ +module Module + +type R = + { + ; + } + +() diff --git a/tests/service/data/SyntaxTree/Type/Record 04.fs.bsl b/tests/service/data/SyntaxTree/Type/Record 04.fs.bsl new file mode 100644 index 0000000000..659b756b71 --- /dev/null +++ b/tests/service/data/SyntaxTree/Type/Record 04.fs.bsl @@ -0,0 +1,29 @@ +ImplFile + (ParsedImplFileInput + ("/root/Type/Record 04.fs", false, QualifiedNameOfFile Module, [], [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Types + ([SynTypeDefn + (SynComponentInfo + ([], None, [], [R], + PreXmlDoc ((3,0), FSharp.Compiler.Xml.XmlDocCollector), + false, None, (3,5--3,6)), + Simple + (Record + (None, + [SynField + ([], false, None, FromParseError (5,6--5,6), false, + PreXmlDoc ((5,6), FSharp.Compiler.Xml.XmlDocCollector), + None, (5,6--5,6), { LeadingKeyword = None })], + (4,4--6,5)), (4,4--6,5)), [], None, (3,5--6,5), + { LeadingKeyword = Type (3,0--3,4) + EqualsRange = Some (3,7--3,8) + WithKeyword = None })], (3,0--6,5)); + Expr (Const (Unit, (8,0--8,2)), (8,0--8,2))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--8,2), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + CodeComments = [] }, set [])) + +(5,6)-(5,7) parse error Unexpected symbol ';' in field declaration. Expected identifier or other token. diff --git a/tests/service/data/SyntaxTree/Type/Record 05.fs b/tests/service/data/SyntaxTree/Type/Record 05.fs new file mode 100644 index 0000000000..c74857840e --- /dev/null +++ b/tests/service/data/SyntaxTree/Type/Record 05.fs @@ -0,0 +1,8 @@ +module Module + +type R = + { F1: int; + ; + F3: int } + +() diff --git a/tests/service/data/SyntaxTree/Type/Record 05.fs.bsl b/tests/service/data/SyntaxTree/Type/Record 05.fs.bsl new file mode 100644 index 0000000000..7bf4310b18 --- /dev/null +++ b/tests/service/data/SyntaxTree/Type/Record 05.fs.bsl @@ -0,0 +1,39 @@ +ImplFile + (ParsedImplFileInput + ("/root/Type/Record 05.fs", false, QualifiedNameOfFile Module, [], [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Types + ([SynTypeDefn + (SynComponentInfo + ([], None, [], [R], + PreXmlDoc ((3,0), FSharp.Compiler.Xml.XmlDocCollector), + false, None, (3,5--3,6)), + Simple + (Record + (None, + [SynField + ([], false, Some F1, + LongIdent (SynLongIdent ([int], [], [None])), false, + PreXmlDoc ((4,6), FSharp.Compiler.Xml.XmlDocCollector), + None, (4,6--4,13), { LeadingKeyword = None }); + SynField + ([], false, None, FromParseError (5,6--5,6), false, + PreXmlDoc ((5,6), FSharp.Compiler.Xml.XmlDocCollector), + None, (5,6--5,6), { LeadingKeyword = None }); + SynField + ([], false, Some F3, + LongIdent (SynLongIdent ([int], [], [None])), false, + PreXmlDoc ((6,6), FSharp.Compiler.Xml.XmlDocCollector), + None, (6,6--6,13), { LeadingKeyword = None })], + (4,4--6,15)), (4,4--6,15)), [], None, (3,5--6,15), + { LeadingKeyword = Type (3,0--3,4) + EqualsRange = Some (3,7--3,8) + WithKeyword = None })], (3,0--6,15)); + Expr (Const (Unit, (8,0--8,2)), (8,0--8,2))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--8,2), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + CodeComments = [] }, set [])) + +(5,6)-(5,7) parse error Unexpected symbol ';' in field declaration. Expected identifier or other token. diff --git a/tests/service/data/SyntaxTree/Type/Struct 02.fs.bsl b/tests/service/data/SyntaxTree/Type/Struct 02.fs.bsl index 5ed03aa81b..9e7e0e9263 100644 --- a/tests/service/data/SyntaxTree/Type/Struct 02.fs.bsl +++ b/tests/service/data/SyntaxTree/Type/Struct 02.fs.bsl @@ -16,7 +16,7 @@ ImplFile ([], false, Some Field, LongIdent (SynLongIdent ([int], [], [None])), false, PreXmlDoc ((5,8), FSharp.Compiler.Xml.XmlDocCollector), - None, (5,12--5,22), + None, (5,8--5,22), { LeadingKeyword = Some (Val (5,8--5,11)) }), (5,8--5,22))], (4,4--6,7)), [], None, (3,5--6,7), { LeadingKeyword = Type (3,0--3,4) From 1a8e817c15538ae638b6cc142992c3e4a4d5a939 Mon Sep 17 00:00:00 2001 From: Eugene Auduchinok Date: Wed, 29 Nov 2023 17:19:31 +0100 Subject: [PATCH 02/11] Fantomas --- src/Compiler/SyntaxTree/ParseHelpers.fs | 56 +++++++++++++++++-------- 1 file changed, 39 insertions(+), 17 deletions(-) diff --git a/src/Compiler/SyntaxTree/ParseHelpers.fs b/src/Compiler/SyntaxTree/ParseHelpers.fs index a41646e01c..32e8f14c76 100644 --- a/src/Compiler/SyntaxTree/ParseHelpers.fs +++ b/src/Compiler/SyntaxTree/ParseHelpers.fs @@ -1140,7 +1140,17 @@ let mkAutoPropDefn mVal access ident typ mEquals (expr: SynExpr) accessors xmlDo trivia ) -let mkSynField parseState (idOpt: Ident option) (t: SynType option) (isMutable: range option) (vis: SynAccess option) (attributes: SynAttributes) (mStatic: range option) (rangeStart: range) (leadingKeyword: SynLeadingKeyword option) = +let mkSynField + parseState + (idOpt: Ident option) + (t: SynType option) + (isMutable: range option) + (vis: SynAccess option) + (attributes: SynAttributes) + (mStatic: range option) + (rangeStart: range) + (leadingKeyword: SynLeadingKeyword option) + = let t, mStart = match t with | Some value -> value, rangeStart @@ -1150,22 +1160,22 @@ let mkSynField parseState (idOpt: Ident option) (t: SynType option) (isMutable: | Some id -> id.idRange, rangeStart | _ -> - match vis with - | Some vis -> vis.Range, rangeStart - | _ -> - - match isMutable with - | Some m -> m, rangeStart - | _ -> + match vis with + | Some vis -> vis.Range, rangeStart + | _ -> + + match isMutable with + | Some m -> m, rangeStart + | _ -> - match leadingKeyword with - | Some keyword -> keyword.Range, rangeStart - | None -> + match leadingKeyword with + | Some keyword -> keyword.Range, rangeStart + | None -> - attributes - |> Seq.tryLast - |> Option.map (fun l -> l.Range, rangeStart) - |> Option.defaultWith (fun _ -> rangeStart.StartRange, rangeStart.StartRange) + attributes + |> Seq.tryLast + |> Option.map (fun l -> l.Range, rangeStart) + |> Option.defaultWith (fun _ -> rangeStart.StartRange, rangeStart.StartRange) SynType.FromParseError(mType.EndRange), mStart @@ -1175,11 +1185,23 @@ let mkSynField parseState (idOpt: Ident option) (t: SynType option) (isMutable: SynField(attributes, Option.isSome mStatic, idOpt, t, Option.isSome isMutable, xmlDoc, vis, mWhole, { LeadingKeyword = leadingKeyword }) -let mkValField parseState mVal (isMutable: range option) access (idOpt: Ident option) (typ: SynType option) (rangeStart: range) attribs mStaticOpt = +let mkValField + parseState + mVal + (isMutable: range option) + access + (idOpt: Ident option) + (typ: SynType option) + (rangeStart: range) + attribs + mStaticOpt + = let leadingKeyword = match mStaticOpt with | None -> SynLeadingKeyword.Val mVal | Some mStatic -> SynLeadingKeyword.StaticVal(mStatic, mVal) - let field = mkSynField parseState idOpt typ isMutable access attribs mStaticOpt rangeStart (Some leadingKeyword) + let field = + mkSynField parseState idOpt typ isMutable access attribs mStaticOpt rangeStart (Some leadingKeyword) + SynMemberDefn.ValField(field, field.Range) From e0eac3b80188be7347419a28d10b90b016e95e3f Mon Sep 17 00:00:00 2001 From: Eugene Auduchinok Date: Thu, 30 Nov 2023 12:33:03 +0100 Subject: [PATCH 03/11] Better diagnostic ranges for fields --- src/Compiler/Checking/CheckDeclarations.fs | 7 ++++--- .../BasicGrammarElements/FieldMembers/FieldMembers.fs | 8 ++++---- .../Conformance/Types/RecordTypes/AnonymousRecords.fs | 2 ++ .../Language/StaticClassTests.fs | 8 ++++---- 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/Compiler/Checking/CheckDeclarations.fs b/src/Compiler/Checking/CheckDeclarations.fs index 0163ddb1e9..da3ecc9b0d 100644 --- a/src/Compiler/Checking/CheckDeclarations.fs +++ b/src/Compiler/Checking/CheckDeclarations.fs @@ -423,8 +423,9 @@ module TcRecdUnionAndEnumDeclarations = let vis = CombineReprAccess parent vis Construct.NewRecdField isStatic konst id nameGenerated tyR isMutable vol attrsForProperty attrsForField xmldoc vis false - let TcFieldDecl (cenv: cenv) env parent isIncrClass tpenv (isStatic, synAttrs, id, nameGenerated, ty, isMutable, xmldoc, vis, m) = + let TcFieldDecl (cenv: cenv) env parent isIncrClass tpenv (isStatic, synAttrs, id: Ident, nameGenerated, ty, isMutable, xmldoc, vis) = let g = cenv.g + let m = id.idRange let attrs, _ = TcAttributesWithPossibleTargets false cenv env AttributeTargets.FieldDecl synAttrs let attrsForProperty, attrsForField = attrs |> List.partition (fun (attrTargets, _) -> (attrTargets &&& AttributeTargets.Property) <> enum 0) let attrsForProperty = (List.map snd attrsForProperty) @@ -458,7 +459,7 @@ module TcRecdUnionAndEnumDeclarations = let checkXmlDocs = cenv.diagnosticOptions.CheckXmlDocs let xmlDoc = xmldoc.ToXmlDoc(checkXmlDocs, Some []) - TcFieldDecl cenv env parent false tpenv (isStatic, attribs, id, idOpt.IsNone, ty, isMutable, xmlDoc, vis, m) + TcFieldDecl cenv env parent false tpenv (isStatic, attribs, id, idOpt.IsNone, ty, isMutable, xmlDoc, vis) let TcNamedFieldDecl cenv env parent isIncrClass tpenv (SynField(Attributes attribs, isStatic, id, ty, isMutable, xmldoc, vis, m, _)) = match id with @@ -468,7 +469,7 @@ module TcRecdUnionAndEnumDeclarations = | Some id -> let checkXmlDocs = cenv.diagnosticOptions.CheckXmlDocs let xmlDoc = xmldoc.ToXmlDoc(checkXmlDocs, Some []) - Some(TcFieldDecl cenv env parent isIncrClass tpenv (isStatic, attribs, id, false, ty, isMutable, xmlDoc, vis, m)) + Some(TcFieldDecl cenv env parent isIncrClass tpenv (isStatic, attribs, id, false, ty, isMutable, xmlDoc, vis)) let TcNamedFieldDecls cenv env parent isIncrClass tpenv fields = fields |> List.choose (TcNamedFieldDecl cenv env parent isIncrClass tpenv) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/FieldMembers/FieldMembers.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/FieldMembers/FieldMembers.fs index 4ccc4a9b8c..138cf45e72 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/FieldMembers/FieldMembers.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/FieldMembers/FieldMembers.fs @@ -34,8 +34,8 @@ module FieldMembers = |> verifyCompile |> shouldFail |> withDiagnostics [ - (Error 880, Line 11, Col 20, Line 11, Col 33, "Uninitialized 'val' fields must be mutable and marked with the '[]' attribute. Consider using a 'let' binding instead of a 'val' field.") - (Error 881, Line 11, Col 20, Line 11, Col 33, "Static 'val' fields in types must be mutable, private and marked with the '[]' attribute. They are initialized to the 'null' or 'zero' value for their type. Consider also using a 'static let mutable' binding in a class type.") + (Error 880, Line 11, Col 20, Line 11, Col 27, "Uninitialized 'val' fields must be mutable and marked with the '[]' attribute. Consider using a 'let' binding instead of a 'val' field.") + (Error 881, Line 11, Col 20, Line 11, Col 27, "Static 'val' fields in types must be mutable, private and marked with the '[]' attribute. They are initialized to the 'null' or 'zero' value for their type. Consider also using a 'static let mutable' binding in a class type.") ] // SOURCE=E_StaticField02a.fs # E_StaticField02a.fs @@ -45,8 +45,8 @@ module FieldMembers = |> verifyCompile |> shouldFail |> withDiagnostics [ - (Error 881, Line 7, Col 32, Line 7, Col 49, "Static 'val' fields in types must be mutable, private and marked with the '[]' attribute. They are initialized to the 'null' or 'zero' value for their type. Consider also using a 'static let mutable' binding in a class type.") - (Error 881, Line 16, Col 32, Line 16, Col 49, "Static 'val' fields in types must be mutable, private and marked with the '[]' attribute. They are initialized to the 'null' or 'zero' value for their type. Consider also using a 'static let mutable' binding in a class type.") + (Error 881, Line 7, Col 32, Line 7, Col 40, "Static 'val' fields in types must be mutable, private and marked with the '[]' attribute. They are initialized to the 'null' or 'zero' value for their type. Consider also using a 'static let mutable' binding in a class type.") + (Error 881, Line 16, Col 32, Line 16, Col 40, "Static 'val' fields in types must be mutable, private and marked with the '[]' attribute. They are initialized to the 'null' or 'zero' value for their type. Consider also using a 'static let mutable' binding in a class type.") ] // SOURCE=StaticField01.fs # StaticField01.fs diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/AnonymousRecords.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/AnonymousRecords.fs index 6fa51549e9..354539ed7c 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/AnonymousRecords.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/AnonymousRecords.fs @@ -159,7 +159,9 @@ type ErrorResponse = |> withDiagnostics [ Error 10, Line 5, Col 42, Line 5, Col 43, "Unexpected integer literal in field declaration. Expected ':' or other token." Error 10, Line 7, Col 12, Line 7, Col 14, "Unexpected symbol '|}' in field declaration. Expected identifier or other token." + Error 3244, Line 7, Col 9, Line 7, Col 14, "Invalid anonymous record type" Error 10, Line 10, Col 17, Line 10, Col 21, "Incomplete structured construct at or before this point in field declaration. Expected identifier or other token." + Error 3244, Line 10, Col 14, Line 11, Col 36, "Invalid anonymous record type" ] [] diff --git a/tests/FSharp.Compiler.ComponentTests/Language/StaticClassTests.fs b/tests/FSharp.Compiler.ComponentTests/Language/StaticClassTests.fs index 6fc0501827..b28c96ccf5 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/StaticClassTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/StaticClassTests.fs @@ -650,8 +650,8 @@ type B() = |> compile |> shouldFail |> withDiagnostics [ - (Error 880, Line 4, Col 9, Line 4, Col 16, "Uninitialized 'val' fields must be mutable and marked with the '[]' attribute. Consider using a 'let' binding instead of a 'val' field.") - (Error 880, Line 5, Col 17, Line 5, Col 24, "Uninitialized 'val' fields must be mutable and marked with the '[]' attribute. Consider using a 'let' binding instead of a 'val' field.") + (Error 880, Line 4, Col 9, Line 4, Col 10, "Uninitialized 'val' fields must be mutable and marked with the '[]' attribute. Consider using a 'let' binding instead of a 'val' field.") + (Error 880, Line 5, Col 17, Line 5, Col 18, "Uninitialized 'val' fields must be mutable and marked with the '[]' attribute. Consider using a 'let' binding instead of a 'val' field.") ] [] @@ -682,8 +682,8 @@ type B() = |> compile |> shouldFail |> withDiagnostics [ - (Error 880, Line 4, Col 9, Line 4, Col 16, "Uninitialized 'val' fields must be mutable and marked with the '[]' attribute. Consider using a 'let' binding instead of a 'val' field.") - (Error 880, Line 5, Col 17, Line 5, Col 24, "Uninitialized 'val' fields must be mutable and marked with the '[]' attribute. Consider using a 'let' binding instead of a 'val' field.") + (Error 880, Line 4, Col 9, Line 4, Col 10, "Uninitialized 'val' fields must be mutable and marked with the '[]' attribute. Consider using a 'let' binding instead of a 'val' field.") + (Error 880, Line 5, Col 17, Line 5, Col 18, "Uninitialized 'val' fields must be mutable and marked with the '[]' attribute. Consider using a 'let' binding instead of a 'val' field.") (Warning 3558, Line 4, Col 9, Line 4, Col 10, "If a type uses both [] and [] attributes, it means it is static. Explicit field declarations are not allowed.") (Warning 3558, Line 5, Col 17, Line 5, Col 18, "If a type uses both [] and [] attributes, it means it is static. Explicit field declarations are not allowed.") ] From 395515ca23db44a004f99032068d56a56f1b762d Mon Sep 17 00:00:00 2001 From: Eugene Auduchinok Date: Thu, 30 Nov 2023 12:37:43 +0100 Subject: [PATCH 04/11] More parser tests --- .../data/SyntaxTree/Member/Field 15.fs | 7 ++++ .../data/SyntaxTree/Member/Field 15.fs.bsl | 36 +++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 tests/service/data/SyntaxTree/Member/Field 15.fs create mode 100644 tests/service/data/SyntaxTree/Member/Field 15.fs.bsl diff --git a/tests/service/data/SyntaxTree/Member/Field 15.fs b/tests/service/data/SyntaxTree/Member/Field 15.fs new file mode 100644 index 0000000000..77f72b83e9 --- /dev/null +++ b/tests/service/data/SyntaxTree/Member/Field 15.fs @@ -0,0 +1,7 @@ +module Module + +type T = + [] + static val F: int + +() diff --git a/tests/service/data/SyntaxTree/Member/Field 15.fs.bsl b/tests/service/data/SyntaxTree/Member/Field 15.fs.bsl new file mode 100644 index 0000000000..fade50ea6a --- /dev/null +++ b/tests/service/data/SyntaxTree/Member/Field 15.fs.bsl @@ -0,0 +1,36 @@ +ImplFile + (ParsedImplFileInput + ("/root/Member/Field 15.fs", false, QualifiedNameOfFile Module, [], [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Types + ([SynTypeDefn + (SynComponentInfo + ([], None, [], [T], + PreXmlDoc ((3,0), FSharp.Compiler.Xml.XmlDocCollector), + false, None, (3,5--3,6)), + ObjectModel + (Unspecified, + [ValField + (SynField + ([{ Attributes = + [{ TypeName = SynLongIdent ([A], [], [None]) + ArgExpr = Const (Unit, (4,6--4,7)) + Target = None + AppliesToGetterAndSetter = false + Range = (4,6--4,7) }] + Range = (4,4--4,9) }], true, Some F, + LongIdent (SynLongIdent ([int], [], [None])), false, + PreXmlDoc ((4,4), FSharp.Compiler.Xml.XmlDocCollector), + None, (4,4--5,21), + { LeadingKeyword = + Some (StaticVal ((5,4--5,10), (5,11--5,14))) }), + (4,4--5,21))], (4,4--5,21)), [], None, (3,5--5,21), + { LeadingKeyword = Type (3,0--3,4) + EqualsRange = Some (3,7--3,8) + WithKeyword = None })], (3,0--5,21)); + Expr (Const (Unit, (7,0--7,2)), (7,0--7,2))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--7,2), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + CodeComments = [] }, set [])) From d40a4bfadffd9d9ee9ab7cd8a09a9f9775035c77 Mon Sep 17 00:00:00 2001 From: Eugene Auduchinok Date: Thu, 30 Nov 2023 13:24:20 +0100 Subject: [PATCH 05/11] Update surface area --- .../FSharp.Compiler.Service.SurfaceArea.netstandard20.debug.bsl | 2 ++ ...Sharp.Compiler.Service.SurfaceArea.netstandard20.release.bsl | 2 ++ 2 files changed, 4 insertions(+) diff --git a/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.debug.bsl b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.debug.bsl index 5ac7347ed4..ea149ea3a6 100644 --- a/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.debug.bsl +++ b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.debug.bsl @@ -7370,6 +7370,8 @@ FSharp.Compiler.Syntax.SynField: FSharp.Compiler.Syntax.SynType fieldType FSharp.Compiler.Syntax.SynField: FSharp.Compiler.Syntax.SynType get_fieldType() FSharp.Compiler.Syntax.SynField: FSharp.Compiler.SyntaxTrivia.SynFieldTrivia get_trivia() FSharp.Compiler.Syntax.SynField: FSharp.Compiler.SyntaxTrivia.SynFieldTrivia trivia +FSharp.Compiler.Syntax.SynField: FSharp.Compiler.Text.Range Range +FSharp.Compiler.Syntax.SynField: FSharp.Compiler.Text.Range get_Range() FSharp.Compiler.Syntax.SynField: FSharp.Compiler.Text.Range get_range() FSharp.Compiler.Syntax.SynField: FSharp.Compiler.Text.Range range FSharp.Compiler.Syntax.SynField: FSharp.Compiler.Xml.PreXmlDoc get_xmlDoc() diff --git a/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.release.bsl b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.release.bsl index 5ac7347ed4..ea149ea3a6 100644 --- a/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.release.bsl +++ b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.release.bsl @@ -7370,6 +7370,8 @@ FSharp.Compiler.Syntax.SynField: FSharp.Compiler.Syntax.SynType fieldType FSharp.Compiler.Syntax.SynField: FSharp.Compiler.Syntax.SynType get_fieldType() FSharp.Compiler.Syntax.SynField: FSharp.Compiler.SyntaxTrivia.SynFieldTrivia get_trivia() FSharp.Compiler.Syntax.SynField: FSharp.Compiler.SyntaxTrivia.SynFieldTrivia trivia +FSharp.Compiler.Syntax.SynField: FSharp.Compiler.Text.Range Range +FSharp.Compiler.Syntax.SynField: FSharp.Compiler.Text.Range get_Range() FSharp.Compiler.Syntax.SynField: FSharp.Compiler.Text.Range get_range() FSharp.Compiler.Syntax.SynField: FSharp.Compiler.Text.Range range FSharp.Compiler.Syntax.SynField: FSharp.Compiler.Xml.PreXmlDoc get_xmlDoc() From 1f4f14424d4e088f8bcd45fe619c0f6a68145a97 Mon Sep 17 00:00:00 2001 From: Eugene Auduchinok Date: Thu, 30 Nov 2023 13:43:31 +0100 Subject: [PATCH 06/11] Fix xml doc test --- tests/service/XmlDocTests.fs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/service/XmlDocTests.fs b/tests/service/XmlDocTests.fs index bdb4fd8144..0872f118db 100644 --- a/tests/service/XmlDocTests.fs +++ b/tests/service/XmlDocTests.fs @@ -1334,7 +1334,7 @@ type Point = match parseResults.ParseTree with | Members([SynMemberDefn.ValField(fieldInfo = SynField(range = fieldRange); range = range)]) -> assertRange (4, 8) (8, 20) range - assertRange (8, 12) (8, 20) fieldRange + assertRange (4, 8) (8, 20) fieldRange | x -> failwith $"Unexpected ParsedInput %A{x}" From c628300ec45d25220862b13e09988f3b7a5bd2c7 Mon Sep 17 00:00:00 2001 From: Eugene Auduchinok Date: Thu, 30 Nov 2023 14:47:42 +0100 Subject: [PATCH 07/11] Update baselines --- tests/fsharp/typecheck/sigs/neg16.bsl | 2 +- tests/fsharp/typecheck/sigs/neg28.bsl | 2 +- .../StructTypes/E_Regressions02b.fs | 2 +- tests/fsharpqa/Source/InteractiveSession/Misc/E_emptyRecord.fsx | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/fsharp/typecheck/sigs/neg16.bsl b/tests/fsharp/typecheck/sigs/neg16.bsl index c32ad022d1..b3f777bea3 100644 --- a/tests/fsharp/typecheck/sigs/neg16.bsl +++ b/tests/fsharp/typecheck/sigs/neg16.bsl @@ -83,7 +83,7 @@ neg16.fs(102,3,103,9): typecheck error FS0823: The 'VolatileField' attribute may neg16.fs(102,3,103,9): typecheck error FS0879: Volatile fields must be marked 'mutable' and cannot be thread-static -neg16.fs(119,17,119,24): typecheck error FS0823: The 'VolatileField' attribute may only be used on 'let' bindings in classes +neg16.fs(119,17,119,18): typecheck error FS0823: The 'VolatileField' attribute may only be used on 'let' bindings in classes neg16.fs(106,5,107,19): typecheck error FS0879: Volatile fields must be marked 'mutable' and cannot be thread-static diff --git a/tests/fsharp/typecheck/sigs/neg28.bsl b/tests/fsharp/typecheck/sigs/neg28.bsl index 1b428ae309..3893eaf1fd 100644 --- a/tests/fsharp/typecheck/sigs/neg28.bsl +++ b/tests/fsharp/typecheck/sigs/neg28.bsl @@ -1,7 +1,7 @@ neg28.fsx(5,10,5,11): typecheck error FS1180: The struct, record or union type 'X' has the 'StructuralEquality' attribute but the component type '(int -> int)' does not satisfy the 'equality' constraint -neg28.fsx(12,13,12,20): typecheck error FS0880: Uninitialized 'val' fields must be mutable and marked with the '[]' attribute. Consider using a 'let' binding instead of a 'val' field. +neg28.fsx(12,13,12,14): typecheck error FS0880: Uninitialized 'val' fields must be mutable and marked with the '[]' attribute. Consider using a 'let' binding instead of a 'val' field. neg28.fsx(19,13,19,14): typecheck error FS1181: Each argument of the primary constructor for a struct must be given a type, for example 'type S(x1:int, x2: int) = ...'. These arguments determine the fields of the struct. diff --git a/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/StructTypes/E_Regressions02b.fs b/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/StructTypes/E_Regressions02b.fs index 175823c0e3..eac9452c02 100644 --- a/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/StructTypes/E_Regressions02b.fs +++ b/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/StructTypes/E_Regressions02b.fs @@ -1,7 +1,7 @@ // #Regression #Conformance #ObjectOrientedTypes #Structs // Regression for 4643: // infinite loop in typechecker - caused by recursive struct check via self typed static field -//Static 'val' fields in types must be mutable, private and marked with the '\[\]' attribute\. They are initialized to the 'null' or 'zero' value for their type\. Consider also using a 'static let mutable' binding in a class type\.$ +//Static 'val' fields in types must be mutable, private and marked with the '\[\]' attribute\. They are initialized to the 'null' or 'zero' value for their type\. Consider also using a 'static let mutable' binding in a class type\.$ [] type RIP(x:int) = diff --git a/tests/fsharpqa/Source/InteractiveSession/Misc/E_emptyRecord.fsx b/tests/fsharpqa/Source/InteractiveSession/Misc/E_emptyRecord.fsx index 847a5987b2..dfcd6a2e2a 100644 --- a/tests/fsharpqa/Source/InteractiveSession/Misc/E_emptyRecord.fsx +++ b/tests/fsharpqa/Source/InteractiveSession/Misc/E_emptyRecord.fsx @@ -1,5 +1,5 @@ // #Regression #NoMT #FSI // Regression test for FSHARP1.0:5629 -//Unexpected symbol '}' in field declaration\. Expected identifier or other token\.$ +//Expecting record field type R = { };; exit 1;; From 5fc794debb855f0aaaff0f90ff48a7e03bcee25c Mon Sep 17 00:00:00 2001 From: Eugene Auduchinok Date: Thu, 30 Nov 2023 16:34:54 +0100 Subject: [PATCH 08/11] Update src/Compiler/SyntaxTree/SyntaxTree.fsi Co-authored-by: Edgar Gonzalez --- src/Compiler/SyntaxTree/SyntaxTree.fsi | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Compiler/SyntaxTree/SyntaxTree.fsi b/src/Compiler/SyntaxTree/SyntaxTree.fsi index e2fd2053aa..72e4a9d216 100644 --- a/src/Compiler/SyntaxTree/SyntaxTree.fsi +++ b/src/Compiler/SyntaxTree/SyntaxTree.fsi @@ -1453,6 +1453,7 @@ type SynField = range: range * trivia: SynFieldTrivia + /// Gets the syntax range of this construct member Range: range /// Represents the syntax tree associated with the name of a type definition or module From 96d1a8657e45d8328d4430a7db8d90489640218e Mon Sep 17 00:00:00 2001 From: Florian Verdonck Date: Fri, 1 Dec 2023 14:04:28 +0100 Subject: [PATCH 09/11] Add MutableKeyword to SynFieldTrivia. (#11) --- src/Compiler/SyntaxTree/ParseHelpers.fs | 15 ++++++++++++++- src/Compiler/SyntaxTree/SyntaxTrivia.fs | 7 ++++++- src/Compiler/SyntaxTree/SyntaxTrivia.fsi | 2 ++ ...Service.SurfaceArea.netstandard20.debug.bsl | 4 +++- ...rvice.SurfaceArea.netstandard20.release.bsl | 4 +++- .../Exception/Recover Function Type 01.fs.bsl | 6 ++++-- .../LeadingKeyword/StaticValKeyword.fsi.bsl | 5 +++-- .../LeadingKeyword/ValKeyword.fsi.bsl | 5 +++-- .../data/SyntaxTree/Member/Field 01.fs.bsl | 5 +++-- .../data/SyntaxTree/Member/Field 02.fs.bsl | 9 +++++---- .../data/SyntaxTree/Member/Field 03.fs.bsl | 9 +++++---- .../data/SyntaxTree/Member/Field 04.fs.bsl | 9 +++++---- .../data/SyntaxTree/Member/Field 05.fs.bsl | 5 +++-- .../data/SyntaxTree/Member/Field 06.fs.bsl | 10 +++++----- .../data/SyntaxTree/Member/Field 07.fs.bsl | 10 +++++----- .../data/SyntaxTree/Member/Field 08.fs.bsl | 5 +++-- .../data/SyntaxTree/Member/Field 09.fs.bsl | 5 +++-- .../data/SyntaxTree/Member/Field 10.fs.bsl | 5 +++-- .../data/SyntaxTree/Member/Field 11.fs.bsl | 5 +++-- .../data/SyntaxTree/Member/Field 12.fs.bsl | 5 +++-- .../data/SyntaxTree/Member/Field 13.fs.bsl | 5 +++-- .../data/SyntaxTree/Member/Field 14.fs.bsl | 5 +++-- .../data/SyntaxTree/Member/Field 15.fs.bsl | 5 +++-- ...espaceShouldStartAtNamespaceKeyword.fsi.bsl | 6 ++++-- ...turnsRangeOfSynModuleOrNamespaceSig.fsi.bsl | 6 ++++-- ...eShouldEndAtTheLastSynModuleSigDecl.fsi.bsl | 18 ++++++++++++------ ...ExceptionDefnReprAndSynExceptionSig.fsi.bsl | 6 ++++-- ...tesShouldBeIncludedInRecursiveTypes.fsi.bsl | 3 ++- ...tionSigAndSynModuleSigDeclException.fsi.bsl | 6 ++++-- ...eDefnSigRecordShouldEndAtLastMember.fsi.bsl | 3 ++- ...TypeDefnSigSimpleShouldEndAtLastVal.fsi.bsl | 8 ++++---- ...nionContainsTheRangeOfTheEqualsSign.fsi.bsl | 9 ++++++--- ...utesShouldBeIncludedInRecursiveTypes.fs.bsl | 9 ++++++--- .../SyntaxTree/Type/Record - Access 01.fs.bsl | 3 ++- .../SyntaxTree/Type/Record - Access 02.fs.bsl | 6 ++++-- .../SyntaxTree/Type/Record - Access 03.fs.bsl | 6 ++++-- .../SyntaxTree/Type/Record - Access 04.fs.bsl | 3 ++- .../SyntaxTree/Type/Record - Mutable 01.fs.bsl | 6 ++++-- .../SyntaxTree/Type/Record - Mutable 02.fs.bsl | 9 ++++++--- .../SyntaxTree/Type/Record - Mutable 03.fs.bsl | 7 +++++-- .../SyntaxTree/Type/Record - Mutable 04.fs.bsl | 10 +++++++--- .../SyntaxTree/Type/Record - Mutable 05.fs.bsl | 10 +++++++--- .../data/SyntaxTree/Type/Record 01.fs.bsl | 6 ++++-- .../data/SyntaxTree/Type/Record 02.fs.bsl | 6 ++++-- .../data/SyntaxTree/Type/Record 04.fs.bsl | 3 ++- .../data/SyntaxTree/Type/Record 05.fs.bsl | 9 ++++++--- .../data/SyntaxTree/Type/Struct 02.fs.bsl | 5 +++-- ...cordContainsTheRangeOfTheWithKeyword.fs.bsl | 3 ++- ...UnionContainsTheRangeOfTheEqualsSign.fs.bsl | 9 ++++++--- .../UnionCase/Missing keyword of.fs.bsl | 9 ++++++--- .../UnionCase/Missing name 03.fs.bsl | 3 ++- .../UnionCase/Missing name 04.fs.bsl | 3 ++- .../UnionCase/Missing name 05.fs.bsl | 3 ++- .../MultipleSynUnionCasesHaveBarRange.fs.bsl | 6 ++++-- .../UnionCase/PrivateKeywordHasRange.fs.bsl | 3 ++- .../UnionCase/Recover Function Type 01.fs.bsl | 3 ++- .../UnionCase/Recover Function Type 02.fs.bsl | 3 ++- .../UnionCase/Recover Function Type 03.fs.bsl | 3 ++- .../SingleSynUnionCaseHasBarRange.fs.bsl | 3 ++- .../SingleSynUnionCaseWithoutBar.fs.bsl | 3 ++- .../UnionCaseFieldsCanHaveComments.fs.bsl | 6 ++++-- 61 files changed, 241 insertions(+), 127 deletions(-) diff --git a/src/Compiler/SyntaxTree/ParseHelpers.fs b/src/Compiler/SyntaxTree/ParseHelpers.fs index 32e8f14c76..eac167c2ca 100644 --- a/src/Compiler/SyntaxTree/ParseHelpers.fs +++ b/src/Compiler/SyntaxTree/ParseHelpers.fs @@ -1183,7 +1183,20 @@ let mkSynField let xmlDoc = grabXmlDocAtRangeStart (parseState, attributes, mWhole) let mWhole = unionRangeWithXmlDoc xmlDoc mWhole - SynField(attributes, Option.isSome mStatic, idOpt, t, Option.isSome isMutable, xmlDoc, vis, mWhole, { LeadingKeyword = leadingKeyword }) + SynField( + attributes, + Option.isSome mStatic, + idOpt, + t, + Option.isSome isMutable, + xmlDoc, + vis, + mWhole, + { + LeadingKeyword = leadingKeyword + MutableKeyword = isMutable + } + ) let mkValField parseState diff --git a/src/Compiler/SyntaxTree/SyntaxTrivia.fs b/src/Compiler/SyntaxTree/SyntaxTrivia.fs index 623e07fa1f..7330ac9b69 100644 --- a/src/Compiler/SyntaxTree/SyntaxTrivia.fs +++ b/src/Compiler/SyntaxTree/SyntaxTrivia.fs @@ -383,9 +383,14 @@ type SynMemberDefnAbstractSlotTrivia = type SynFieldTrivia = { LeadingKeyword: SynLeadingKeyword option + MutableKeyword: range option } - static member Zero: SynFieldTrivia = { LeadingKeyword = None } + static member Zero: SynFieldTrivia = + { + LeadingKeyword = None + MutableKeyword = None + } [] type SynTypeOrTrivia = { OrKeyword: range } diff --git a/src/Compiler/SyntaxTree/SyntaxTrivia.fsi b/src/Compiler/SyntaxTree/SyntaxTrivia.fsi index d30816e697..137f543280 100644 --- a/src/Compiler/SyntaxTree/SyntaxTrivia.fsi +++ b/src/Compiler/SyntaxTree/SyntaxTrivia.fsi @@ -486,6 +486,8 @@ type SynFieldTrivia = { /// Used leading keyword of SynField LeadingKeyword: SynLeadingKeyword option + /// The syntax range of the `mutable` keyword + MutableKeyword: range option } static member Zero: SynFieldTrivia diff --git a/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.debug.bsl b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.debug.bsl index ea149ea3a6..04475daccd 100644 --- a/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.debug.bsl +++ b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.debug.bsl @@ -9757,8 +9757,10 @@ FSharp.Compiler.SyntaxTrivia.SynFieldTrivia: FSharp.Compiler.SyntaxTrivia.SynFie FSharp.Compiler.SyntaxTrivia.SynFieldTrivia: FSharp.Compiler.SyntaxTrivia.SynFieldTrivia get_Zero() FSharp.Compiler.SyntaxTrivia.SynFieldTrivia: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.SyntaxTrivia.SynLeadingKeyword] LeadingKeyword FSharp.Compiler.SyntaxTrivia.SynFieldTrivia: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.SyntaxTrivia.SynLeadingKeyword] get_LeadingKeyword() +FSharp.Compiler.SyntaxTrivia.SynFieldTrivia: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range] MutableKeyword +FSharp.Compiler.SyntaxTrivia.SynFieldTrivia: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range] get_MutableKeyword() FSharp.Compiler.SyntaxTrivia.SynFieldTrivia: System.String ToString() -FSharp.Compiler.SyntaxTrivia.SynFieldTrivia: Void .ctor(Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.SyntaxTrivia.SynLeadingKeyword]) +FSharp.Compiler.SyntaxTrivia.SynFieldTrivia: Void .ctor(Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.SyntaxTrivia.SynLeadingKeyword], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range]) FSharp.Compiler.SyntaxTrivia.SynLeadingKeyword+Abstract: FSharp.Compiler.Text.Range abstractRange FSharp.Compiler.SyntaxTrivia.SynLeadingKeyword+Abstract: FSharp.Compiler.Text.Range get_abstractRange() FSharp.Compiler.SyntaxTrivia.SynLeadingKeyword+AbstractMember: FSharp.Compiler.Text.Range abstractRange diff --git a/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.release.bsl b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.release.bsl index ea149ea3a6..04475daccd 100644 --- a/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.release.bsl +++ b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.release.bsl @@ -9757,8 +9757,10 @@ FSharp.Compiler.SyntaxTrivia.SynFieldTrivia: FSharp.Compiler.SyntaxTrivia.SynFie FSharp.Compiler.SyntaxTrivia.SynFieldTrivia: FSharp.Compiler.SyntaxTrivia.SynFieldTrivia get_Zero() FSharp.Compiler.SyntaxTrivia.SynFieldTrivia: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.SyntaxTrivia.SynLeadingKeyword] LeadingKeyword FSharp.Compiler.SyntaxTrivia.SynFieldTrivia: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.SyntaxTrivia.SynLeadingKeyword] get_LeadingKeyword() +FSharp.Compiler.SyntaxTrivia.SynFieldTrivia: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range] MutableKeyword +FSharp.Compiler.SyntaxTrivia.SynFieldTrivia: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range] get_MutableKeyword() FSharp.Compiler.SyntaxTrivia.SynFieldTrivia: System.String ToString() -FSharp.Compiler.SyntaxTrivia.SynFieldTrivia: Void .ctor(Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.SyntaxTrivia.SynLeadingKeyword]) +FSharp.Compiler.SyntaxTrivia.SynFieldTrivia: Void .ctor(Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.SyntaxTrivia.SynLeadingKeyword], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range]) FSharp.Compiler.SyntaxTrivia.SynLeadingKeyword+Abstract: FSharp.Compiler.Text.Range abstractRange FSharp.Compiler.SyntaxTrivia.SynLeadingKeyword+Abstract: FSharp.Compiler.Text.Range get_abstractRange() FSharp.Compiler.SyntaxTrivia.SynLeadingKeyword+AbstractMember: FSharp.Compiler.Text.Range abstractRange diff --git a/tests/service/data/SyntaxTree/Exception/Recover Function Type 01.fs.bsl b/tests/service/data/SyntaxTree/Exception/Recover Function Type 01.fs.bsl index 9136c672d0..690183a18b 100644 --- a/tests/service/data/SyntaxTree/Exception/Recover Function Type 01.fs.bsl +++ b/tests/service/data/SyntaxTree/Exception/Recover Function Type 01.fs.bsl @@ -19,7 +19,8 @@ ImplFile (3,17--3,27), { ArrowRange = (3,21--3,23) }), false, PreXmlDoc ((3,17), FSharp.Compiler.Xml.XmlDocCollector), - None, (3,17--3,27), { LeadingKeyword = None })], + None, (3,17--3,27), { LeadingKeyword = None + MutableKeyword = None })], PreXmlDocEmpty, None, (3,10--3,27), { BarRange = None }), None, PreXmlDoc ((3,0), FSharp.Compiler.Xml.XmlDocCollector), None, (3,0--3,27)), None, [], (3,0--3,27)), (3,0--3,27)); @@ -34,7 +35,8 @@ ImplFile ([], false, None, LongIdent (SynLongIdent ([int], [], [None])), false, PreXmlDoc ((4,19), FSharp.Compiler.Xml.XmlDocCollector), - None, (4,19--4,22), { LeadingKeyword = None })], + None, (4,19--4,22), { LeadingKeyword = None + MutableKeyword = None })], PreXmlDocEmpty, None, (4,10--4,22), { BarRange = None }), None, PreXmlDoc ((4,0), FSharp.Compiler.Xml.XmlDocCollector), None, (4,0--4,22)), None, [], (4,0--4,22)), (4,0--4,22))], diff --git a/tests/service/data/SyntaxTree/LeadingKeyword/StaticValKeyword.fsi.bsl b/tests/service/data/SyntaxTree/LeadingKeyword/StaticValKeyword.fsi.bsl index 28e4012132..a30354d3b4 100644 --- a/tests/service/data/SyntaxTree/LeadingKeyword/StaticValKeyword.fsi.bsl +++ b/tests/service/data/SyntaxTree/LeadingKeyword/StaticValKeyword.fsi.bsl @@ -23,8 +23,9 @@ SigFile PreXmlDoc ((5,4), FSharp.Compiler.Xml.XmlDocCollector), None, (5,4--5,29), { LeadingKeyword = - Some (StaticVal ((5,4--5,10), (5,11--5,14))) }), - (5,4--5,29))], (5,4--5,29)), [], (4,5--5,29), + Some (StaticVal ((5,4--5,10), (5,11--5,14))) + MutableKeyword = None }), (5,4--5,29))], + (5,4--5,29)), [], (4,5--5,29), { LeadingKeyword = Type (4,0--4,4) EqualsRange = Some (4,7--4,8) WithKeyword = None })], (4,0--5,29))], PreXmlDocEmpty, [], diff --git a/tests/service/data/SyntaxTree/LeadingKeyword/ValKeyword.fsi.bsl b/tests/service/data/SyntaxTree/LeadingKeyword/ValKeyword.fsi.bsl index 9d3675ba2e..1c940b8d6f 100644 --- a/tests/service/data/SyntaxTree/LeadingKeyword/ValKeyword.fsi.bsl +++ b/tests/service/data/SyntaxTree/LeadingKeyword/ValKeyword.fsi.bsl @@ -18,8 +18,9 @@ SigFile LongIdent (SynLongIdent ([int], [], [None])), false, PreXmlDoc ((5,4), FSharp.Compiler.Xml.XmlDocCollector), None, (5,4--5,15), - { LeadingKeyword = Some (Val (5,4--5,7)) }), - (5,4--5,15))], (5,4--5,15)), [], (4,5--5,15), + { LeadingKeyword = Some (Val (5,4--5,7)) + MutableKeyword = None }), (5,4--5,15))], + (5,4--5,15)), [], (4,5--5,15), { LeadingKeyword = Type (4,0--4,4) EqualsRange = Some (4,7--4,8) WithKeyword = None })], (4,0--5,15))], PreXmlDocEmpty, [], diff --git a/tests/service/data/SyntaxTree/Member/Field 01.fs.bsl b/tests/service/data/SyntaxTree/Member/Field 01.fs.bsl index 4b60596ef6..add8ac4adb 100644 --- a/tests/service/data/SyntaxTree/Member/Field 01.fs.bsl +++ b/tests/service/data/SyntaxTree/Member/Field 01.fs.bsl @@ -17,8 +17,9 @@ ImplFile LongIdent (SynLongIdent ([int], [], [None])), false, PreXmlDoc ((4,4), FSharp.Compiler.Xml.XmlDocCollector), None, (4,4--4,15), - { LeadingKeyword = Some (Val (4,4--4,7)) }), - (4,4--4,15))], (4,4--4,15)), [], None, (3,5--4,15), + { LeadingKeyword = Some (Val (4,4--4,7)) + MutableKeyword = None }), (4,4--4,15))], + (4,4--4,15)), [], None, (3,5--4,15), { LeadingKeyword = Type (3,0--3,4) EqualsRange = Some (3,7--3,8) WithKeyword = None })], (3,0--4,15))], diff --git a/tests/service/data/SyntaxTree/Member/Field 02.fs.bsl b/tests/service/data/SyntaxTree/Member/Field 02.fs.bsl index 3bcc4264a2..33eba0a9f8 100644 --- a/tests/service/data/SyntaxTree/Member/Field 02.fs.bsl +++ b/tests/service/data/SyntaxTree/Member/Field 02.fs.bsl @@ -17,16 +17,17 @@ ImplFile false, PreXmlDoc ((4,4), FSharp.Compiler.Xml.XmlDocCollector), None, (4,4--4,11), - { LeadingKeyword = Some (Val (4,4--4,7)) }), - (4,4--4,11)); + { LeadingKeyword = Some (Val (4,4--4,7)) + MutableKeyword = None }), (4,4--4,11)); ValField (SynField ([], false, Some F2, LongIdent (SynLongIdent ([int], [], [None])), false, PreXmlDoc ((5,4), FSharp.Compiler.Xml.XmlDocCollector), None, (5,4--5,15), - { LeadingKeyword = Some (Val (5,4--5,7)) }), - (5,4--5,15))], (4,4--5,15)), [], None, (3,5--5,15), + { LeadingKeyword = Some (Val (5,4--5,7)) + MutableKeyword = None }), (5,4--5,15))], + (4,4--5,15)), [], None, (3,5--5,15), { LeadingKeyword = Type (3,0--3,4) EqualsRange = Some (3,7--3,8) WithKeyword = None })], (3,0--5,15)); diff --git a/tests/service/data/SyntaxTree/Member/Field 03.fs.bsl b/tests/service/data/SyntaxTree/Member/Field 03.fs.bsl index 9ea124eee3..4308cbcfeb 100644 --- a/tests/service/data/SyntaxTree/Member/Field 03.fs.bsl +++ b/tests/service/data/SyntaxTree/Member/Field 03.fs.bsl @@ -17,16 +17,17 @@ ImplFile false, PreXmlDoc ((4,4), FSharp.Compiler.Xml.XmlDocCollector), None, (4,4--4,10), - { LeadingKeyword = Some (Val (4,4--4,7)) }), - (4,4--4,10)); + { LeadingKeyword = Some (Val (4,4--4,7)) + MutableKeyword = None }), (4,4--4,10)); ValField (SynField ([], false, Some F2, LongIdent (SynLongIdent ([int], [], [None])), false, PreXmlDoc ((5,4), FSharp.Compiler.Xml.XmlDocCollector), None, (5,4--5,15), - { LeadingKeyword = Some (Val (5,4--5,7)) }), - (5,4--5,15))], (4,4--5,15)), [], None, (3,5--5,15), + { LeadingKeyword = Some (Val (5,4--5,7)) + MutableKeyword = None }), (5,4--5,15))], + (4,4--5,15)), [], None, (3,5--5,15), { LeadingKeyword = Type (3,0--3,4) EqualsRange = Some (3,7--3,8) WithKeyword = None })], (3,0--5,15)); diff --git a/tests/service/data/SyntaxTree/Member/Field 04.fs.bsl b/tests/service/data/SyntaxTree/Member/Field 04.fs.bsl index 1074b8e362..e481768ccb 100644 --- a/tests/service/data/SyntaxTree/Member/Field 04.fs.bsl +++ b/tests/service/data/SyntaxTree/Member/Field 04.fs.bsl @@ -16,16 +16,17 @@ ImplFile ([], false, None, FromParseError (4,7--4,7), false, PreXmlDoc ((4,4), FSharp.Compiler.Xml.XmlDocCollector), None, (4,4--4,7), - { LeadingKeyword = Some (Val (4,4--4,7)) }), - (4,4--4,7)); + { LeadingKeyword = Some (Val (4,4--4,7)) + MutableKeyword = None }), (4,4--4,7)); ValField (SynField ([], false, Some F2, LongIdent (SynLongIdent ([int], [], [None])), false, PreXmlDoc ((5,4), FSharp.Compiler.Xml.XmlDocCollector), None, (5,4--5,15), - { LeadingKeyword = Some (Val (5,4--5,7)) }), - (5,4--5,15))], (4,4--5,15)), [], None, (3,5--5,15), + { LeadingKeyword = Some (Val (5,4--5,7)) + MutableKeyword = None }), (5,4--5,15))], + (4,4--5,15)), [], None, (3,5--5,15), { LeadingKeyword = Type (3,0--3,4) EqualsRange = Some (3,7--3,8) WithKeyword = None })], (3,0--5,15)); diff --git a/tests/service/data/SyntaxTree/Member/Field 05.fs.bsl b/tests/service/data/SyntaxTree/Member/Field 05.fs.bsl index 27fe2dbef8..46cf2e29c7 100644 --- a/tests/service/data/SyntaxTree/Member/Field 05.fs.bsl +++ b/tests/service/data/SyntaxTree/Member/Field 05.fs.bsl @@ -17,8 +17,9 @@ ImplFile false, PreXmlDoc ((4,4), FSharp.Compiler.Xml.XmlDocCollector), None, (4,4--4,10), - { LeadingKeyword = Some (Val (4,4--4,7)) }), - (4,4--4,10))], (4,4--4,10)), [], None, (3,5--4,10), + { LeadingKeyword = Some (Val (4,4--4,7)) + MutableKeyword = None }), (4,4--4,10))], + (4,4--4,10)), [], None, (3,5--4,10), { LeadingKeyword = Type (3,0--3,4) EqualsRange = Some (3,7--3,8) WithKeyword = None })], (3,0--4,10)); diff --git a/tests/service/data/SyntaxTree/Member/Field 06.fs.bsl b/tests/service/data/SyntaxTree/Member/Field 06.fs.bsl index 930233ae6f..723a8c44f2 100644 --- a/tests/service/data/SyntaxTree/Member/Field 06.fs.bsl +++ b/tests/service/data/SyntaxTree/Member/Field 06.fs.bsl @@ -16,11 +16,11 @@ ImplFile ([], false, Some F, FromParseError (4,9--4,9), false, PreXmlDoc ((4,4), FSharp.Compiler.Xml.XmlDocCollector), None, (4,4--4,9), - { LeadingKeyword = Some (Val (4,4--4,7)) }), - (4,4--4,9))], (4,4--4,9)), [], None, (3,5--4,9), - { LeadingKeyword = Type (3,0--3,4) - EqualsRange = Some (3,7--3,8) - WithKeyword = None })], (3,0--4,9)); + { LeadingKeyword = Some (Val (4,4--4,7)) + MutableKeyword = None }), (4,4--4,9))], (4,4--4,9)), + [], None, (3,5--4,9), { LeadingKeyword = Type (3,0--3,4) + EqualsRange = Some (3,7--3,8) + WithKeyword = None })], (3,0--4,9)); Expr (Const (Unit, (6,0--6,2)), (6,0--6,2))], PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, (1,0--6,2), { LeadingKeyword = Module (1,0--1,6) })], (true, true), diff --git a/tests/service/data/SyntaxTree/Member/Field 07.fs.bsl b/tests/service/data/SyntaxTree/Member/Field 07.fs.bsl index 2e6dfc6906..e62126034d 100644 --- a/tests/service/data/SyntaxTree/Member/Field 07.fs.bsl +++ b/tests/service/data/SyntaxTree/Member/Field 07.fs.bsl @@ -16,11 +16,11 @@ ImplFile ([], false, None, FromParseError (4,7--4,7), false, PreXmlDoc ((4,4), FSharp.Compiler.Xml.XmlDocCollector), None, (4,4--4,7), - { LeadingKeyword = Some (Val (4,4--4,7)) }), - (4,4--4,7))], (4,4--4,7)), [], None, (3,5--4,7), - { LeadingKeyword = Type (3,0--3,4) - EqualsRange = Some (3,7--3,8) - WithKeyword = None })], (3,0--4,7)); + { LeadingKeyword = Some (Val (4,4--4,7)) + MutableKeyword = None }), (4,4--4,7))], (4,4--4,7)), + [], None, (3,5--4,7), { LeadingKeyword = Type (3,0--3,4) + EqualsRange = Some (3,7--3,8) + WithKeyword = None })], (3,0--4,7)); Expr (Const (Unit, (6,0--6,2)), (6,0--6,2))], PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, (1,0--6,2), { LeadingKeyword = Module (1,0--1,6) })], (true, true), diff --git a/tests/service/data/SyntaxTree/Member/Field 08.fs.bsl b/tests/service/data/SyntaxTree/Member/Field 08.fs.bsl index 47cc099ef4..c74f09be72 100644 --- a/tests/service/data/SyntaxTree/Member/Field 08.fs.bsl +++ b/tests/service/data/SyntaxTree/Member/Field 08.fs.bsl @@ -16,8 +16,9 @@ ImplFile ([], false, None, FromParseError (5,11--5,11), false, PreXmlDoc ((5,8), FSharp.Compiler.Xml.XmlDocCollector), None, (5,8--5,11), - { LeadingKeyword = Some (Val (5,8--5,11)) }), - (5,8--5,11))], (4,4--6,7)), [], None, (3,5--6,7), + { LeadingKeyword = Some (Val (5,8--5,11)) + MutableKeyword = None }), (5,8--5,11))], + (4,4--6,7)), [], None, (3,5--6,7), { LeadingKeyword = Type (3,0--3,4) EqualsRange = Some (3,7--3,8) WithKeyword = None })], (3,0--6,7)); diff --git a/tests/service/data/SyntaxTree/Member/Field 09.fs.bsl b/tests/service/data/SyntaxTree/Member/Field 09.fs.bsl index cf52b55505..8b4d8d1fa4 100644 --- a/tests/service/data/SyntaxTree/Member/Field 09.fs.bsl +++ b/tests/service/data/SyntaxTree/Member/Field 09.fs.bsl @@ -17,8 +17,9 @@ ImplFile PreXmlDoc ((4,4), FSharp.Compiler.Xml.XmlDocCollector), None, (4,4--4,14), { LeadingKeyword = - Some (StaticVal ((4,4--4,10), (4,11--4,14))) }), - (4,4--4,14))], (4,4--4,14)), [], None, (3,5--4,14), + Some (StaticVal ((4,4--4,10), (4,11--4,14))) + MutableKeyword = None }), (4,4--4,14))], + (4,4--4,14)), [], None, (3,5--4,14), { LeadingKeyword = Type (3,0--3,4) EqualsRange = Some (3,7--3,8) WithKeyword = None })], (3,0--4,14)); diff --git a/tests/service/data/SyntaxTree/Member/Field 10.fs.bsl b/tests/service/data/SyntaxTree/Member/Field 10.fs.bsl index d60916014f..77016903ad 100644 --- a/tests/service/data/SyntaxTree/Member/Field 10.fs.bsl +++ b/tests/service/data/SyntaxTree/Member/Field 10.fs.bsl @@ -17,8 +17,9 @@ ImplFile PreXmlDoc ((4,4), FSharp.Compiler.Xml.XmlDocCollector), None, (4,4--4,22), { LeadingKeyword = - Some (StaticVal ((4,4--4,10), (4,11--4,14))) }), - (4,4--4,22))], (4,4--4,22)), [], None, (3,5--4,22), + Some (StaticVal ((4,4--4,10), (4,11--4,14))) + MutableKeyword = Some (4,15--4,22) }), (4,4--4,22))], + (4,4--4,22)), [], None, (3,5--4,22), { LeadingKeyword = Type (3,0--3,4) EqualsRange = Some (3,7--3,8) WithKeyword = None })], (3,0--4,22)); diff --git a/tests/service/data/SyntaxTree/Member/Field 11.fs.bsl b/tests/service/data/SyntaxTree/Member/Field 11.fs.bsl index c0415e5509..4f3cfe4b8b 100644 --- a/tests/service/data/SyntaxTree/Member/Field 11.fs.bsl +++ b/tests/service/data/SyntaxTree/Member/Field 11.fs.bsl @@ -17,8 +17,9 @@ ImplFile PreXmlDoc ((4,4), FSharp.Compiler.Xml.XmlDocCollector), Some (Private (4,23--4,30)), (4,4--4,30), { LeadingKeyword = - Some (StaticVal ((4,4--4,10), (4,11--4,14))) }), - (4,4--4,30))], (4,4--4,30)), [], None, (3,5--4,30), + Some (StaticVal ((4,4--4,10), (4,11--4,14))) + MutableKeyword = Some (4,15--4,22) }), (4,4--4,30))], + (4,4--4,30)), [], None, (3,5--4,30), { LeadingKeyword = Type (3,0--3,4) EqualsRange = Some (3,7--3,8) WithKeyword = None })], (3,0--4,30)); diff --git a/tests/service/data/SyntaxTree/Member/Field 12.fs.bsl b/tests/service/data/SyntaxTree/Member/Field 12.fs.bsl index e9f7949564..d29045ba0e 100644 --- a/tests/service/data/SyntaxTree/Member/Field 12.fs.bsl +++ b/tests/service/data/SyntaxTree/Member/Field 12.fs.bsl @@ -17,8 +17,9 @@ ImplFile PreXmlDoc ((4,4), FSharp.Compiler.Xml.XmlDocCollector), Some (Private (4,23--4,30)), (4,4--4,32), { LeadingKeyword = - Some (StaticVal ((4,4--4,10), (4,11--4,14))) }), - (4,4--4,32))], (4,4--4,32)), [], None, (3,5--4,32), + Some (StaticVal ((4,4--4,10), (4,11--4,14))) + MutableKeyword = Some (4,15--4,22) }), (4,4--4,32))], + (4,4--4,32)), [], None, (3,5--4,32), { LeadingKeyword = Type (3,0--3,4) EqualsRange = Some (3,7--3,8) WithKeyword = None })], (3,0--4,32)); diff --git a/tests/service/data/SyntaxTree/Member/Field 13.fs.bsl b/tests/service/data/SyntaxTree/Member/Field 13.fs.bsl index 7d8c762c5d..3b42126b6d 100644 --- a/tests/service/data/SyntaxTree/Member/Field 13.fs.bsl +++ b/tests/service/data/SyntaxTree/Member/Field 13.fs.bsl @@ -17,8 +17,9 @@ ImplFile PreXmlDoc ((4,4), FSharp.Compiler.Xml.XmlDocCollector), Some (Private (4,23--4,30)), (4,4--4,33), { LeadingKeyword = - Some (StaticVal ((4,4--4,10), (4,11--4,14))) }), - (4,4--4,33))], (4,4--4,33)), [], None, (3,5--4,33), + Some (StaticVal ((4,4--4,10), (4,11--4,14))) + MutableKeyword = Some (4,15--4,22) }), (4,4--4,33))], + (4,4--4,33)), [], None, (3,5--4,33), { LeadingKeyword = Type (3,0--3,4) EqualsRange = Some (3,7--3,8) WithKeyword = None })], (3,0--4,33)); diff --git a/tests/service/data/SyntaxTree/Member/Field 14.fs.bsl b/tests/service/data/SyntaxTree/Member/Field 14.fs.bsl index 919a08217d..b9ae59996c 100644 --- a/tests/service/data/SyntaxTree/Member/Field 14.fs.bsl +++ b/tests/service/data/SyntaxTree/Member/Field 14.fs.bsl @@ -18,8 +18,9 @@ ImplFile PreXmlDoc ((4,4), FSharp.Compiler.Xml.XmlDocCollector), Some (Private (4,23--4,30)), (4,4--4,37), { LeadingKeyword = - Some (StaticVal ((4,4--4,10), (4,11--4,14))) }), - (4,4--4,37))], (4,4--4,37)), [], None, (3,5--4,37), + Some (StaticVal ((4,4--4,10), (4,11--4,14))) + MutableKeyword = Some (4,15--4,22) }), (4,4--4,37))], + (4,4--4,37)), [], None, (3,5--4,37), { LeadingKeyword = Type (3,0--3,4) EqualsRange = Some (3,7--3,8) WithKeyword = None })], (3,0--4,37)); diff --git a/tests/service/data/SyntaxTree/Member/Field 15.fs.bsl b/tests/service/data/SyntaxTree/Member/Field 15.fs.bsl index fade50ea6a..472d5e0c2f 100644 --- a/tests/service/data/SyntaxTree/Member/Field 15.fs.bsl +++ b/tests/service/data/SyntaxTree/Member/Field 15.fs.bsl @@ -24,8 +24,9 @@ ImplFile PreXmlDoc ((4,4), FSharp.Compiler.Xml.XmlDocCollector), None, (4,4--5,21), { LeadingKeyword = - Some (StaticVal ((5,4--5,10), (5,11--5,14))) }), - (4,4--5,21))], (4,4--5,21)), [], None, (3,5--5,21), + Some (StaticVal ((5,4--5,10), (5,11--5,14))) + MutableKeyword = None }), (4,4--5,21))], + (4,4--5,21)), [], None, (3,5--5,21), { LeadingKeyword = Type (3,0--3,4) EqualsRange = Some (3,7--3,8) WithKeyword = None })], (3,0--5,21)); diff --git a/tests/service/data/SyntaxTree/ModuleOrNamespaceSig/GlobalNamespaceShouldStartAtNamespaceKeyword.fsi.bsl b/tests/service/data/SyntaxTree/ModuleOrNamespaceSig/GlobalNamespaceShouldStartAtNamespaceKeyword.fsi.bsl index 587df130b0..13f845e312 100644 --- a/tests/service/data/SyntaxTree/ModuleOrNamespaceSig/GlobalNamespaceShouldStartAtNamespaceKeyword.fsi.bsl +++ b/tests/service/data/SyntaxTree/ModuleOrNamespaceSig/GlobalNamespaceShouldStartAtNamespaceKeyword.fsi.bsl @@ -21,13 +21,15 @@ SigFile LongIdent (SynLongIdent ([string], [], [None])), false, PreXmlDoc ((6,20), FSharp.Compiler.Xml.XmlDocCollector), - None, (6,20--6,26), { LeadingKeyword = None }); + None, (6,20--6,26), { LeadingKeyword = None + MutableKeyword = None }); SynField ([], false, None, LongIdent (SynLongIdent ([int], [], [None])), false, PreXmlDoc ((6,29), FSharp.Compiler.Xml.XmlDocCollector), - None, (6,29--6,32), { LeadingKeyword = None })], + None, (6,29--6,32), { LeadingKeyword = None + MutableKeyword = None })], PreXmlDoc ((6,11), FSharp.Compiler.Xml.XmlDocCollector), None, (6,13--6,32), { BarRange = Some (6,11--6,12) })], (6,11--6,32)), (6,11--6,32)), [], (6,5--6,32), diff --git a/tests/service/data/SyntaxTree/ModuleOrNamespaceSig/RangeMemberReturnsRangeOfSynModuleOrNamespaceSig.fsi.bsl b/tests/service/data/SyntaxTree/ModuleOrNamespaceSig/RangeMemberReturnsRangeOfSynModuleOrNamespaceSig.fsi.bsl index bf2904ff04..8a0f981091 100644 --- a/tests/service/data/SyntaxTree/ModuleOrNamespaceSig/RangeMemberReturnsRangeOfSynModuleOrNamespaceSig.fsi.bsl +++ b/tests/service/data/SyntaxTree/ModuleOrNamespaceSig/RangeMemberReturnsRangeOfSynModuleOrNamespaceSig.fsi.bsl @@ -22,13 +22,15 @@ SigFile LongIdent (SynLongIdent ([string], [], [None])), false, PreXmlDoc ((4,20), FSharp.Compiler.Xml.XmlDocCollector), - None, (4,20--4,26), { LeadingKeyword = None }); + None, (4,20--4,26), { LeadingKeyword = None + MutableKeyword = None }); SynField ([], false, None, LongIdent (SynLongIdent ([int], [], [None])), false, PreXmlDoc ((4,29), FSharp.Compiler.Xml.XmlDocCollector), - None, (4,29--4,32), { LeadingKeyword = None })], + None, (4,29--4,32), { LeadingKeyword = None + MutableKeyword = None })], PreXmlDoc ((4,11), FSharp.Compiler.Xml.XmlDocCollector), None, (4,13--4,32), { BarRange = Some (4,11--4,12) })], (4,11--4,32)), (4,11--4,32)), [], (4,5--4,32), diff --git a/tests/service/data/SyntaxTree/NestedModule/RangeOfNestedModuleInSignatureFileShouldEndAtTheLastSynModuleSigDecl.fsi.bsl b/tests/service/data/SyntaxTree/NestedModule/RangeOfNestedModuleInSignatureFileShouldEndAtTheLastSynModuleSigDecl.fsi.bsl index c949211307..b52c329f8c 100644 --- a/tests/service/data/SyntaxTree/NestedModule/RangeOfNestedModuleInSignatureFileShouldEndAtTheLastSynModuleSigDecl.fsi.bsl +++ b/tests/service/data/SyntaxTree/NestedModule/RangeOfNestedModuleInSignatureFileShouldEndAtTheLastSynModuleSigDecl.fsi.bsl @@ -297,7 +297,8 @@ SigFile (31,22--31,25)), false, PreXmlDoc ((31,22), FSharp.Compiler.Xml.XmlDocCollector), None, (31,22--31,25), - { LeadingKeyword = None })], + { LeadingKeyword = None + MutableKeyword = None })], PreXmlDoc ((31,6), FSharp.Compiler.Xml.XmlDocCollector), None, (30,6--31,25), { BarRange = Some (31,6--31,7) }); @@ -311,7 +312,8 @@ SigFile (33,22--33,25)), false, PreXmlDoc ((33,22), FSharp.Compiler.Xml.XmlDocCollector), None, (33,22--33,25), - { LeadingKeyword = None })], + { LeadingKeyword = None + MutableKeyword = None })], PreXmlDoc ((33,6), FSharp.Compiler.Xml.XmlDocCollector), None, (32,6--33,25), { BarRange = Some (33,6--33,7) }); @@ -325,7 +327,8 @@ SigFile (35,22--35,25)), false, PreXmlDoc ((35,22), FSharp.Compiler.Xml.XmlDocCollector), None, (35,22--35,25), - { LeadingKeyword = None })], + { LeadingKeyword = None + MutableKeyword = None })], PreXmlDoc ((35,6), FSharp.Compiler.Xml.XmlDocCollector), None, (34,6--35,25), { BarRange = Some (35,6--35,7) }); @@ -339,7 +342,8 @@ SigFile (37,22--37,25)), false, PreXmlDoc ((37,22), FSharp.Compiler.Xml.XmlDocCollector), None, (37,22--37,25), - { LeadingKeyword = None })], + { LeadingKeyword = None + MutableKeyword = None })], PreXmlDoc ((37,6), FSharp.Compiler.Xml.XmlDocCollector), None, (36,6--37,25), { BarRange = Some (37,6--37,7) }); @@ -353,7 +357,8 @@ SigFile (39,22--39,25)), false, PreXmlDoc ((39,22), FSharp.Compiler.Xml.XmlDocCollector), None, (39,22--39,25), - { LeadingKeyword = None })], + { LeadingKeyword = None + MutableKeyword = None })], PreXmlDoc ((39,6), FSharp.Compiler.Xml.XmlDocCollector), None, (38,6--39,25), { BarRange = Some (39,6--39,7) }); @@ -367,7 +372,8 @@ SigFile (41,22--41,25)), false, PreXmlDoc ((41,22), FSharp.Compiler.Xml.XmlDocCollector), None, (41,22--41,25), - { LeadingKeyword = None })], + { LeadingKeyword = None + MutableKeyword = None })], PreXmlDoc ((41,6), FSharp.Compiler.Xml.XmlDocCollector), None, (40,6--41,25), { BarRange = Some (41,6--41,7) })], diff --git a/tests/service/data/SyntaxTree/SignatureType/RangeOfAttributeShouldBeIncludedInSynExceptionDefnReprAndSynExceptionSig.fsi.bsl b/tests/service/data/SyntaxTree/SignatureType/RangeOfAttributeShouldBeIncludedInSynExceptionDefnReprAndSynExceptionSig.fsi.bsl index 35f55a5237..e92edcc811 100644 --- a/tests/service/data/SyntaxTree/SignatureType/RangeOfAttributeShouldBeIncludedInSynExceptionDefnReprAndSynExceptionSig.fsi.bsl +++ b/tests/service/data/SyntaxTree/SignatureType/RangeOfAttributeShouldBeIncludedInSynExceptionDefnReprAndSynExceptionSig.fsi.bsl @@ -26,13 +26,15 @@ SigFile ([], false, None, LongIdent (SynLongIdent ([obj], [], [None])), false, PreXmlDoc ((6,25), FSharp.Compiler.Xml.XmlDocCollector), - None, (6,25--6,28), { LeadingKeyword = None }); + None, (6,25--6,28), { LeadingKeyword = None + MutableKeyword = None }); SynField ([], false, Some range, LongIdent (SynLongIdent ([range], [], [None])), false, PreXmlDoc ((6,31), FSharp.Compiler.Xml.XmlDocCollector), - None, (6,31--6,43), { LeadingKeyword = None })], + None, (6,31--6,43), { LeadingKeyword = None + MutableKeyword = None })], PreXmlDocEmpty, None, (6,10--6,43), { BarRange = None }), None, PreXmlDoc ((5,0), FSharp.Compiler.Xml.XmlDocCollector), None, (5,0--6,43)), None, [], (5,0--6,43)), (5,0--6,43))], diff --git a/tests/service/data/SyntaxTree/SignatureType/RangeOfAttributesShouldBeIncludedInRecursiveTypes.fsi.bsl b/tests/service/data/SyntaxTree/SignatureType/RangeOfAttributesShouldBeIncludedInRecursiveTypes.fsi.bsl index 1046fa2547..bf3950ebf3 100644 --- a/tests/service/data/SyntaxTree/SignatureType/RangeOfAttributesShouldBeIncludedInRecursiveTypes.fsi.bsl +++ b/tests/service/data/SyntaxTree/SignatureType/RangeOfAttributesShouldBeIncludedInRecursiveTypes.fsi.bsl @@ -41,7 +41,8 @@ SigFile ([], false, Some LongNameBarBarBarBarBarBarBar, LongIdent (SynLongIdent ([int], [], [None])), false, PreXmlDoc ((10,12), FSharp.Compiler.Xml.XmlDocCollector), - None, (10,12--10,46), { LeadingKeyword = None })], + None, (10,12--10,46), { LeadingKeyword = None + MutableKeyword = None })], (8,4--11,9)), (8,4--11,9)), [Member (SynValSig diff --git a/tests/service/data/SyntaxTree/SignatureType/RangeOfMembersShouldBeIncludedInSynExceptionSigAndSynModuleSigDeclException.fsi.bsl b/tests/service/data/SyntaxTree/SignatureType/RangeOfMembersShouldBeIncludedInSynExceptionSigAndSynModuleSigDeclException.fsi.bsl index 27d724e66a..8a7477a040 100644 --- a/tests/service/data/SyntaxTree/SignatureType/RangeOfMembersShouldBeIncludedInSynExceptionSigAndSynModuleSigDeclException.fsi.bsl +++ b/tests/service/data/SyntaxTree/SignatureType/RangeOfMembersShouldBeIncludedInSynExceptionSigAndSynModuleSigDeclException.fsi.bsl @@ -15,13 +15,15 @@ SigFile ([], false, None, LongIdent (SynLongIdent ([obj], [], [None])), false, PreXmlDoc ((4,25), FSharp.Compiler.Xml.XmlDocCollector), - None, (4,25--4,28), { LeadingKeyword = None }); + None, (4,25--4,28), { LeadingKeyword = None + MutableKeyword = None }); SynField ([], false, Some range, LongIdent (SynLongIdent ([range], [], [None])), false, PreXmlDoc ((4,31), FSharp.Compiler.Xml.XmlDocCollector), - None, (4,31--4,43), { LeadingKeyword = None })], + None, (4,31--4,43), { LeadingKeyword = None + MutableKeyword = None })], PreXmlDocEmpty, None, (4,10--4,43), { BarRange = None }), None, PreXmlDoc ((4,0), FSharp.Compiler.Xml.XmlDocCollector), None, (4,0--4,43)), Some (4,44--4,48), diff --git a/tests/service/data/SyntaxTree/SignatureType/RangeOfSynTypeDefnSigRecordShouldEndAtLastMember.fsi.bsl b/tests/service/data/SyntaxTree/SignatureType/RangeOfSynTypeDefnSigRecordShouldEndAtLastMember.fsi.bsl index 5aa63f103b..d0fe920321 100644 --- a/tests/service/data/SyntaxTree/SignatureType/RangeOfSynTypeDefnSigRecordShouldEndAtLastMember.fsi.bsl +++ b/tests/service/data/SyntaxTree/SignatureType/RangeOfSynTypeDefnSigRecordShouldEndAtLastMember.fsi.bsl @@ -18,7 +18,8 @@ SigFile ([], false, Some Level, LongIdent (SynLongIdent ([int], [], [None])), false, PreXmlDoc ((4,6), FSharp.Compiler.Xml.XmlDocCollector), - None, (4,6--4,16), { LeadingKeyword = None })], + None, (4,6--4,16), { LeadingKeyword = None + MutableKeyword = None })], (4,4--4,18)), (4,4--4,18)), [Member (SynValSig diff --git a/tests/service/data/SyntaxTree/SignatureType/RangeOfSynTypeDefnSigSimpleShouldEndAtLastVal.fsi.bsl b/tests/service/data/SyntaxTree/SignatureType/RangeOfSynTypeDefnSigSimpleShouldEndAtLastVal.fsi.bsl index df1725af6c..7829833143 100644 --- a/tests/service/data/SyntaxTree/SignatureType/RangeOfSynTypeDefnSigSimpleShouldEndAtLastVal.fsi.bsl +++ b/tests/service/data/SyntaxTree/SignatureType/RangeOfSynTypeDefnSigSimpleShouldEndAtLastVal.fsi.bsl @@ -17,8 +17,8 @@ SigFile LongIdent (SynLongIdent ([int], [], [None])), false, PreXmlDoc ((4,4), FSharp.Compiler.Xml.XmlDocCollector), None, (4,4--4,23), - { LeadingKeyword = Some (Val (4,4--4,7)) }), - (4,4--4,23)); + { LeadingKeyword = Some (Val (4,4--4,7)) + MutableKeyword = None }), (4,4--4,23)); ValField (SynField ([], false, Some SomeThingElse, @@ -28,8 +28,8 @@ SigFile (5,24--5,37), { ArrowRange = (5,28--5,30) }), false, PreXmlDoc ((5,4), FSharp.Compiler.Xml.XmlDocCollector), None, (5,4--5,37), - { LeadingKeyword = Some (Val (5,4--5,7)) }), - (5,4--5,37))], (3,5--5,37), + { LeadingKeyword = Some (Val (5,4--5,7)) + MutableKeyword = None }), (5,4--5,37))], (3,5--5,37), { LeadingKeyword = Type (3,0--3,4) EqualsRange = None WithKeyword = Some (3,20--3,24) })], (3,0--5,37))], diff --git a/tests/service/data/SyntaxTree/SignatureType/SynTypeDefnSigWithUnionContainsTheRangeOfTheEqualsSign.fsi.bsl b/tests/service/data/SyntaxTree/SignatureType/SynTypeDefnSigWithUnionContainsTheRangeOfTheEqualsSign.fsi.bsl index 54ca9aa387..bfc76db57f 100644 --- a/tests/service/data/SyntaxTree/SignatureType/SynTypeDefnSigWithUnionContainsTheRangeOfTheEqualsSign.fsi.bsl +++ b/tests/service/data/SyntaxTree/SignatureType/SynTypeDefnSigWithUnionContainsTheRangeOfTheEqualsSign.fsi.bsl @@ -22,7 +22,8 @@ SigFile LongIdent (SynLongIdent ([int], [], [None])), false, PreXmlDoc ((5,12), FSharp.Compiler.Xml.XmlDocCollector), - None, (5,12--5,15), { LeadingKeyword = None })], + None, (5,12--5,15), { LeadingKeyword = None + MutableKeyword = None })], PreXmlDoc ((5,0), FSharp.Compiler.Xml.XmlDocCollector), None, (5,2--5,15), { BarRange = Some (5,0--5,1) }); SynUnionCase @@ -33,13 +34,15 @@ SigFile LongIdent (SynLongIdent ([int], [], [None])), false, PreXmlDoc ((6,15), FSharp.Compiler.Xml.XmlDocCollector), - None, (6,15--6,18), { LeadingKeyword = None }); + None, (6,15--6,18), { LeadingKeyword = None + MutableKeyword = None }); SynField ([], false, None, LongIdent (SynLongIdent ([int], [], [None])), false, PreXmlDoc ((6,21), FSharp.Compiler.Xml.XmlDocCollector), - None, (6,21--6,24), { LeadingKeyword = None })], + None, (6,21--6,24), { LeadingKeyword = None + MutableKeyword = None })], PreXmlDoc ((6,0), FSharp.Compiler.Xml.XmlDocCollector), None, (6,2--6,24), { BarRange = Some (6,0--6,1) })], (5,0--6,24)), (5,0--6,24)), [], (4,5--6,24), diff --git a/tests/service/data/SyntaxTree/Type/RangeOfAttributesShouldBeIncludedInRecursiveTypes.fs.bsl b/tests/service/data/SyntaxTree/Type/RangeOfAttributesShouldBeIncludedInRecursiveTypes.fs.bsl index 8ae96be677..0b685986fc 100644 --- a/tests/service/data/SyntaxTree/Type/RangeOfAttributesShouldBeIncludedInRecursiveTypes.fs.bsl +++ b/tests/service/data/SyntaxTree/Type/RangeOfAttributesShouldBeIncludedInRecursiveTypes.fs.bsl @@ -51,7 +51,8 @@ ImplFile [(4,34--4,35)], Some (4,38--4,39), false, (4,15--4,39)), false, PreXmlDoc ((4,15), FSharp.Compiler.Xml.XmlDocCollector), - None, (4,15--4,39), { LeadingKeyword = None })], + None, (4,15--4,39), { LeadingKeyword = None + MutableKeyword = None })], PreXmlDoc ((4,4), FSharp.Compiler.Xml.XmlDocCollector), None, (4,6--4,39), { BarRange = Some (4,4--4,5) })], (4,4--4,39)), (4,4--4,39)), [], None, (2,0--4,39), @@ -91,7 +92,8 @@ ImplFile ([], false, Some Hash, LongIdent (SynLongIdent ([int], [], [None])), false, PreXmlDoc ((8,8), FSharp.Compiler.Xml.XmlDocCollector), - None, (8,8--8,18), { LeadingKeyword = None }); + None, (8,8--8,18), { LeadingKeyword = None + MutableKeyword = None }); SynField ([], false, Some Foo, App @@ -102,7 +104,8 @@ ImplFile [(9,20--9,21)], Some (9,24--9,25), false, (9,14--9,25)), false, PreXmlDoc ((9,8), FSharp.Compiler.Xml.XmlDocCollector), - None, (9,8--9,25), { LeadingKeyword = None })], + None, (9,8--9,25), { LeadingKeyword = None + MutableKeyword = None })], (7,4--10,5)), (7,4--10,5)), [], None, (6,4--10,5), { LeadingKeyword = And (6,0--6,3) EqualsRange = Some (6,56--6,57) diff --git a/tests/service/data/SyntaxTree/Type/Record - Access 01.fs.bsl b/tests/service/data/SyntaxTree/Type/Record - Access 01.fs.bsl index 9421a92c55..9589553808 100644 --- a/tests/service/data/SyntaxTree/Type/Record - Access 01.fs.bsl +++ b/tests/service/data/SyntaxTree/Type/Record - Access 01.fs.bsl @@ -16,7 +16,8 @@ ImplFile [SynField ([], false, None, FromParseError (5,16--5,16), false, PreXmlDoc ((5,8), FSharp.Compiler.Xml.XmlDocCollector), - None, (5,8--5,16), { LeadingKeyword = None })], + None, (5,8--5,16), { LeadingKeyword = None + MutableKeyword = None })], (4,4--6,5)), (4,4--6,5)), [], None, (3,5--6,5), { LeadingKeyword = Type (3,0--3,4) EqualsRange = Some (3,7--3,8) diff --git a/tests/service/data/SyntaxTree/Type/Record - Access 02.fs.bsl b/tests/service/data/SyntaxTree/Type/Record - Access 02.fs.bsl index bd47ffadd8..dac1c3f625 100644 --- a/tests/service/data/SyntaxTree/Type/Record - Access 02.fs.bsl +++ b/tests/service/data/SyntaxTree/Type/Record - Access 02.fs.bsl @@ -16,8 +16,10 @@ ImplFile [SynField ([], false, None, FromParseError (5,24--5,24), true, PreXmlDoc ((5,8), FSharp.Compiler.Xml.XmlDocCollector), - None, (5,8--5,24), { LeadingKeyword = None })], - (4,4--6,5)), (4,4--6,5)), [], None, (3,5--6,5), + None, (5,8--5,24), + { LeadingKeyword = None + MutableKeyword = Some (5,8--5,15) })], (4,4--6,5)), + (4,4--6,5)), [], None, (3,5--6,5), { LeadingKeyword = Type (3,0--3,4) EqualsRange = Some (3,7--3,8) WithKeyword = None })], (3,0--6,5)); diff --git a/tests/service/data/SyntaxTree/Type/Record - Access 03.fs.bsl b/tests/service/data/SyntaxTree/Type/Record - Access 03.fs.bsl index 67dac77750..f819d61d7c 100644 --- a/tests/service/data/SyntaxTree/Type/Record - Access 03.fs.bsl +++ b/tests/service/data/SyntaxTree/Type/Record - Access 03.fs.bsl @@ -17,8 +17,10 @@ ImplFile ([], false, Some F, LongIdent (SynLongIdent ([int], [], [None])), true, PreXmlDoc ((5,8), FSharp.Compiler.Xml.XmlDocCollector), - None, (5,8--5,31), { LeadingKeyword = None })], - (4,4--6,5)), (4,4--6,5)), [], None, (3,5--6,5), + None, (5,8--5,31), + { LeadingKeyword = None + MutableKeyword = Some (5,8--5,15) })], (4,4--6,5)), + (4,4--6,5)), [], None, (3,5--6,5), { LeadingKeyword = Type (3,0--3,4) EqualsRange = Some (3,7--3,8) WithKeyword = None })], (3,0--6,5)); diff --git a/tests/service/data/SyntaxTree/Type/Record - Access 04.fs.bsl b/tests/service/data/SyntaxTree/Type/Record - Access 04.fs.bsl index d9b3583bdf..1bcbe107b4 100644 --- a/tests/service/data/SyntaxTree/Type/Record - Access 04.fs.bsl +++ b/tests/service/data/SyntaxTree/Type/Record - Access 04.fs.bsl @@ -17,7 +17,8 @@ ImplFile ([], false, Some F, LongIdent (SynLongIdent ([int], [], [None])), false, PreXmlDoc ((5,8), FSharp.Compiler.Xml.XmlDocCollector), - None, (5,8--5,23), { LeadingKeyword = None })], + None, (5,8--5,23), { LeadingKeyword = None + MutableKeyword = None })], (4,4--6,5)), (4,4--6,5)), [], None, (3,5--6,5), { LeadingKeyword = Type (3,0--3,4) EqualsRange = Some (3,7--3,8) diff --git a/tests/service/data/SyntaxTree/Type/Record - Mutable 01.fs.bsl b/tests/service/data/SyntaxTree/Type/Record - Mutable 01.fs.bsl index 5a44e8b076..1b629ceaf6 100644 --- a/tests/service/data/SyntaxTree/Type/Record - Mutable 01.fs.bsl +++ b/tests/service/data/SyntaxTree/Type/Record - Mutable 01.fs.bsl @@ -16,8 +16,10 @@ ImplFile [SynField ([], false, None, FromParseError (5,15--5,15), true, PreXmlDoc ((5,8), FSharp.Compiler.Xml.XmlDocCollector), - None, (5,8--5,15), { LeadingKeyword = None })], - (4,4--6,5)), (4,4--6,5)), [], None, (3,5--6,5), + None, (5,8--5,15), + { LeadingKeyword = None + MutableKeyword = Some (5,8--5,15) })], (4,4--6,5)), + (4,4--6,5)), [], None, (3,5--6,5), { LeadingKeyword = Type (3,0--3,4) EqualsRange = Some (3,7--3,8) WithKeyword = None })], (3,0--6,5)); diff --git a/tests/service/data/SyntaxTree/Type/Record - Mutable 02.fs.bsl b/tests/service/data/SyntaxTree/Type/Record - Mutable 02.fs.bsl index 2cedf23416..6d7a08f3ca 100644 --- a/tests/service/data/SyntaxTree/Type/Record - Mutable 02.fs.bsl +++ b/tests/service/data/SyntaxTree/Type/Record - Mutable 02.fs.bsl @@ -17,12 +17,15 @@ ImplFile ([], false, Some F1, LongIdent (SynLongIdent ([int], [], [None])), false, PreXmlDoc ((5,8), FSharp.Compiler.Xml.XmlDocCollector), - None, (5,8--5,15), { LeadingKeyword = None }); + None, (5,8--5,15), { LeadingKeyword = None + MutableKeyword = None }); SynField ([], false, None, FromParseError (6,15--6,15), true, PreXmlDoc ((6,8), FSharp.Compiler.Xml.XmlDocCollector), - None, (6,8--6,15), { LeadingKeyword = None })], - (4,4--7,5)), (4,4--7,5)), [], None, (3,5--7,5), + None, (6,8--6,15), + { LeadingKeyword = None + MutableKeyword = Some (6,8--6,15) })], (4,4--7,5)), + (4,4--7,5)), [], None, (3,5--7,5), { LeadingKeyword = Type (3,0--3,4) EqualsRange = Some (3,7--3,8) WithKeyword = None })], (3,0--7,5)); diff --git a/tests/service/data/SyntaxTree/Type/Record - Mutable 03.fs.bsl b/tests/service/data/SyntaxTree/Type/Record - Mutable 03.fs.bsl index 1ab133c1cb..34b8bfe0d5 100644 --- a/tests/service/data/SyntaxTree/Type/Record - Mutable 03.fs.bsl +++ b/tests/service/data/SyntaxTree/Type/Record - Mutable 03.fs.bsl @@ -16,12 +16,15 @@ ImplFile [SynField ([], false, None, FromParseError (5,15--5,15), true, PreXmlDoc ((5,8), FSharp.Compiler.Xml.XmlDocCollector), - None, (5,8--5,15), { LeadingKeyword = None }); + None, (5,8--5,15), + { LeadingKeyword = None + MutableKeyword = Some (5,8--5,15) }); SynField ([], false, Some F2, LongIdent (SynLongIdent ([int], [], [None])), false, PreXmlDoc ((6,8), FSharp.Compiler.Xml.XmlDocCollector), - None, (6,8--6,15), { LeadingKeyword = None })], + None, (6,8--6,15), { LeadingKeyword = None + MutableKeyword = None })], (4,4--7,5)), (4,4--7,5)), [], None, (3,5--7,5), { LeadingKeyword = Type (3,0--3,4) EqualsRange = Some (3,7--3,8) diff --git a/tests/service/data/SyntaxTree/Type/Record - Mutable 04.fs.bsl b/tests/service/data/SyntaxTree/Type/Record - Mutable 04.fs.bsl index 9b3ad61203..e8067343cd 100644 --- a/tests/service/data/SyntaxTree/Type/Record - Mutable 04.fs.bsl +++ b/tests/service/data/SyntaxTree/Type/Record - Mutable 04.fs.bsl @@ -17,16 +17,20 @@ ImplFile ([], false, Some F1, LongIdent (SynLongIdent ([int], [], [None])), false, PreXmlDoc ((5,8), FSharp.Compiler.Xml.XmlDocCollector), - None, (5,8--5,15), { LeadingKeyword = None }); + None, (5,8--5,15), { LeadingKeyword = None + MutableKeyword = None }); SynField ([], false, None, FromParseError (6,15--6,15), true, PreXmlDoc ((6,8), FSharp.Compiler.Xml.XmlDocCollector), - None, (6,8--6,15), { LeadingKeyword = None }); + None, (6,8--6,15), + { LeadingKeyword = None + MutableKeyword = Some (6,8--6,15) }); SynField ([], false, Some F3, LongIdent (SynLongIdent ([int], [], [None])), false, PreXmlDoc ((7,8), FSharp.Compiler.Xml.XmlDocCollector), - None, (7,8--7,15), { LeadingKeyword = None })], + None, (7,8--7,15), { LeadingKeyword = None + MutableKeyword = None })], (4,4--8,5)), (4,4--8,5)), [], None, (3,5--8,5), { LeadingKeyword = Type (3,0--3,4) EqualsRange = Some (3,7--3,8) diff --git a/tests/service/data/SyntaxTree/Type/Record - Mutable 05.fs.bsl b/tests/service/data/SyntaxTree/Type/Record - Mutable 05.fs.bsl index 567858760a..3679671665 100644 --- a/tests/service/data/SyntaxTree/Type/Record - Mutable 05.fs.bsl +++ b/tests/service/data/SyntaxTree/Type/Record - Mutable 05.fs.bsl @@ -17,17 +17,21 @@ ImplFile ([], false, Some F1, LongIdent (SynLongIdent ([int], [], [None])), false, PreXmlDoc ((5,8), FSharp.Compiler.Xml.XmlDocCollector), - None, (5,8--5,15), { LeadingKeyword = None }); + None, (5,8--5,15), { LeadingKeyword = None + MutableKeyword = None }); SynField ([], false, Some F2, LongIdent (SynLongIdent ([int], [], [None])), true, PreXmlDoc ((6,8), FSharp.Compiler.Xml.XmlDocCollector), - None, (6,8--6,23), { LeadingKeyword = None }); + None, (6,8--6,23), + { LeadingKeyword = None + MutableKeyword = Some (6,8--6,15) }); SynField ([], false, Some F3, LongIdent (SynLongIdent ([int], [], [None])), false, PreXmlDoc ((7,8), FSharp.Compiler.Xml.XmlDocCollector), - None, (7,8--7,15), { LeadingKeyword = None })], + None, (7,8--7,15), { LeadingKeyword = None + MutableKeyword = None })], (4,4--8,5)), (4,4--8,5)), [], None, (3,5--8,5), { LeadingKeyword = Type (3,0--3,4) EqualsRange = Some (3,7--3,8) diff --git a/tests/service/data/SyntaxTree/Type/Record 01.fs.bsl b/tests/service/data/SyntaxTree/Type/Record 01.fs.bsl index 109206f10c..1eabb2b2f6 100644 --- a/tests/service/data/SyntaxTree/Type/Record 01.fs.bsl +++ b/tests/service/data/SyntaxTree/Type/Record 01.fs.bsl @@ -16,11 +16,13 @@ ImplFile ([], false, Some Invest, LongIdent (SynLongIdent ([int], [], [None])), false, PreXmlDoc ((5,8), FSharp.Compiler.Xml.XmlDocCollector), - None, (5,8--5,19), { LeadingKeyword = None }); + None, (5,8--5,19), { LeadingKeyword = None + MutableKeyword = None }); SynField ([], false, Some T, FromParseError (6,9--6,9), false, PreXmlDoc ((6,8), FSharp.Compiler.Xml.XmlDocCollector), - None, (6,8--6,9), { LeadingKeyword = None })], + None, (6,8--6,9), { LeadingKeyword = None + MutableKeyword = None })], (4,4--7,5)), (4,4--7,5)), [], None, (3,5--7,5), { LeadingKeyword = Type (3,0--3,4) EqualsRange = Some (3,8--3,9) diff --git a/tests/service/data/SyntaxTree/Type/Record 02.fs.bsl b/tests/service/data/SyntaxTree/Type/Record 02.fs.bsl index b218789c91..11cabe541d 100644 --- a/tests/service/data/SyntaxTree/Type/Record 02.fs.bsl +++ b/tests/service/data/SyntaxTree/Type/Record 02.fs.bsl @@ -16,12 +16,14 @@ ImplFile ([], false, Some Invest, LongIdent (SynLongIdent ([int], [], [None])), false, PreXmlDoc ((5,8), FSharp.Compiler.Xml.XmlDocCollector), - None, (5,8--5,19), { LeadingKeyword = None }); + None, (5,8--5,19), { LeadingKeyword = None + MutableKeyword = None }); SynField ([], false, Some T, FromParseError (6,11--6,11), false, PreXmlDoc ((6,8), FSharp.Compiler.Xml.XmlDocCollector), - None, (6,8--6,11), { LeadingKeyword = None })], + None, (6,8--6,11), { LeadingKeyword = None + MutableKeyword = None })], (4,4--7,5)), (4,4--7,5)), [], None, (3,5--7,5), { LeadingKeyword = Type (3,0--3,4) EqualsRange = Some (3,8--3,9) diff --git a/tests/service/data/SyntaxTree/Type/Record 04.fs.bsl b/tests/service/data/SyntaxTree/Type/Record 04.fs.bsl index 659b756b71..db457dd8de 100644 --- a/tests/service/data/SyntaxTree/Type/Record 04.fs.bsl +++ b/tests/service/data/SyntaxTree/Type/Record 04.fs.bsl @@ -15,7 +15,8 @@ ImplFile [SynField ([], false, None, FromParseError (5,6--5,6), false, PreXmlDoc ((5,6), FSharp.Compiler.Xml.XmlDocCollector), - None, (5,6--5,6), { LeadingKeyword = None })], + None, (5,6--5,6), { LeadingKeyword = None + MutableKeyword = None })], (4,4--6,5)), (4,4--6,5)), [], None, (3,5--6,5), { LeadingKeyword = Type (3,0--3,4) EqualsRange = Some (3,7--3,8) diff --git a/tests/service/data/SyntaxTree/Type/Record 05.fs.bsl b/tests/service/data/SyntaxTree/Type/Record 05.fs.bsl index 7bf4310b18..19883a9e8c 100644 --- a/tests/service/data/SyntaxTree/Type/Record 05.fs.bsl +++ b/tests/service/data/SyntaxTree/Type/Record 05.fs.bsl @@ -16,16 +16,19 @@ ImplFile ([], false, Some F1, LongIdent (SynLongIdent ([int], [], [None])), false, PreXmlDoc ((4,6), FSharp.Compiler.Xml.XmlDocCollector), - None, (4,6--4,13), { LeadingKeyword = None }); + None, (4,6--4,13), { LeadingKeyword = None + MutableKeyword = None }); SynField ([], false, None, FromParseError (5,6--5,6), false, PreXmlDoc ((5,6), FSharp.Compiler.Xml.XmlDocCollector), - None, (5,6--5,6), { LeadingKeyword = None }); + None, (5,6--5,6), { LeadingKeyword = None + MutableKeyword = None }); SynField ([], false, Some F3, LongIdent (SynLongIdent ([int], [], [None])), false, PreXmlDoc ((6,6), FSharp.Compiler.Xml.XmlDocCollector), - None, (6,6--6,13), { LeadingKeyword = None })], + None, (6,6--6,13), { LeadingKeyword = None + MutableKeyword = None })], (4,4--6,15)), (4,4--6,15)), [], None, (3,5--6,15), { LeadingKeyword = Type (3,0--3,4) EqualsRange = Some (3,7--3,8) diff --git a/tests/service/data/SyntaxTree/Type/Struct 02.fs.bsl b/tests/service/data/SyntaxTree/Type/Struct 02.fs.bsl index 9e7e0e9263..3ca9cf08ae 100644 --- a/tests/service/data/SyntaxTree/Type/Struct 02.fs.bsl +++ b/tests/service/data/SyntaxTree/Type/Struct 02.fs.bsl @@ -17,8 +17,9 @@ ImplFile LongIdent (SynLongIdent ([int], [], [None])), false, PreXmlDoc ((5,8), FSharp.Compiler.Xml.XmlDocCollector), None, (5,8--5,22), - { LeadingKeyword = Some (Val (5,8--5,11)) }), - (5,8--5,22))], (4,4--6,7)), [], None, (3,5--6,7), + { LeadingKeyword = Some (Val (5,8--5,11)) + MutableKeyword = None }), (5,8--5,22))], + (4,4--6,7)), [], None, (3,5--6,7), { LeadingKeyword = Type (3,0--3,4) EqualsRange = Some (3,7--3,8) WithKeyword = None })], (3,0--6,7))], diff --git a/tests/service/data/SyntaxTree/Type/SynTypeDefnWithRecordContainsTheRangeOfTheWithKeyword.fs.bsl b/tests/service/data/SyntaxTree/Type/SynTypeDefnWithRecordContainsTheRangeOfTheWithKeyword.fs.bsl index 41f5400ce1..35e334478f 100644 --- a/tests/service/data/SyntaxTree/Type/SynTypeDefnWithRecordContainsTheRangeOfTheWithKeyword.fs.bsl +++ b/tests/service/data/SyntaxTree/Type/SynTypeDefnWithRecordContainsTheRangeOfTheWithKeyword.fs.bsl @@ -20,7 +20,8 @@ ImplFile ([], false, Some Bar, LongIdent (SynLongIdent ([int], [], [None])), false, PreXmlDoc ((3,6), FSharp.Compiler.Xml.XmlDocCollector), - None, (3,6--3,15), { LeadingKeyword = None })], + None, (3,6--3,15), { LeadingKeyword = None + MutableKeyword = None })], (3,4--3,17)), (3,4--3,17)), [Member (SynBinding diff --git a/tests/service/data/SyntaxTree/Type/SynTypeDefnWithUnionContainsTheRangeOfTheEqualsSign.fs.bsl b/tests/service/data/SyntaxTree/Type/SynTypeDefnWithUnionContainsTheRangeOfTheEqualsSign.fs.bsl index fdaf263fba..5e5b3b7fc3 100644 --- a/tests/service/data/SyntaxTree/Type/SynTypeDefnWithUnionContainsTheRangeOfTheEqualsSign.fs.bsl +++ b/tests/service/data/SyntaxTree/Type/SynTypeDefnWithUnionContainsTheRangeOfTheEqualsSign.fs.bsl @@ -23,7 +23,8 @@ ImplFile LongIdent (SynLongIdent ([int], [], [None])), false, PreXmlDoc ((3,16), FSharp.Compiler.Xml.XmlDocCollector), - None, (3,16--3,19), { LeadingKeyword = None })], + None, (3,16--3,19), { LeadingKeyword = None + MutableKeyword = None })], PreXmlDoc ((3,4), FSharp.Compiler.Xml.XmlDocCollector), None, (3,6--3,19), { BarRange = Some (3,4--3,5) }); SynUnionCase @@ -34,13 +35,15 @@ ImplFile LongIdent (SynLongIdent ([int], [], [None])), false, PreXmlDoc ((4,19), FSharp.Compiler.Xml.XmlDocCollector), - None, (4,19--4,22), { LeadingKeyword = None }); + None, (4,19--4,22), { LeadingKeyword = None + MutableKeyword = None }); SynField ([], false, None, LongIdent (SynLongIdent ([int], [], [None])), false, PreXmlDoc ((4,25), FSharp.Compiler.Xml.XmlDocCollector), - None, (4,25--4,28), { LeadingKeyword = None })], + None, (4,25--4,28), { LeadingKeyword = None + MutableKeyword = None })], PreXmlDoc ((4,4), FSharp.Compiler.Xml.XmlDocCollector), None, (4,6--4,28), { BarRange = Some (4,4--4,5) })], (3,4--4,28)), (3,4--4,28)), [], None, (2,5--4,28), diff --git a/tests/service/data/SyntaxTree/UnionCase/Missing keyword of.fs.bsl b/tests/service/data/SyntaxTree/UnionCase/Missing keyword of.fs.bsl index 61ef3fc799..2bac019ca2 100644 --- a/tests/service/data/SyntaxTree/UnionCase/Missing keyword of.fs.bsl +++ b/tests/service/data/SyntaxTree/UnionCase/Missing keyword of.fs.bsl @@ -37,7 +37,8 @@ ImplFile LongIdent (SynLongIdent ([string], [], [None])), false, PreXmlDoc ((7,12), FSharp.Compiler.Xml.XmlDocCollector), - None, (7,12--7,18), { LeadingKeyword = None })], + None, (7,12--7,18), { LeadingKeyword = None + MutableKeyword = None })], PreXmlDoc ((7,4), FSharp.Compiler.Xml.XmlDocCollector), None, (7,6--7,18), { BarRange = Some (7,4--7,5) }); SynUnionCase @@ -48,7 +49,8 @@ ImplFile LongIdent (SynLongIdent ([int], [], [None])), false, PreXmlDoc ((8,15), FSharp.Compiler.Xml.XmlDocCollector), - None, (8,15--8,18), { LeadingKeyword = None })], + None, (8,15--8,18), { LeadingKeyword = None + MutableKeyword = None })], PreXmlDoc ((8,4), FSharp.Compiler.Xml.XmlDocCollector), None, (8,6--8,18), { BarRange = Some (8,4--8,5) }); SynUnionCase @@ -58,7 +60,8 @@ ImplFile ([], false, None, StaticConstant (Int32 4, (9,12--9,13)), false, PreXmlDoc ((9,12), FSharp.Compiler.Xml.XmlDocCollector), - None, (9,12--9,13), { LeadingKeyword = None })], + None, (9,12--9,13), { LeadingKeyword = None + MutableKeyword = None })], PreXmlDoc ((9,4), FSharp.Compiler.Xml.XmlDocCollector), None, (9,6--9,13), { BarRange = Some (9,4--9,5) })], (6,4--9,13)), (6,4--9,13)), [], None, (5,5--9,13), diff --git a/tests/service/data/SyntaxTree/UnionCase/Missing name 03.fs.bsl b/tests/service/data/SyntaxTree/UnionCase/Missing name 03.fs.bsl index f8f3055038..4a272764df 100644 --- a/tests/service/data/SyntaxTree/UnionCase/Missing name 03.fs.bsl +++ b/tests/service/data/SyntaxTree/UnionCase/Missing name 03.fs.bsl @@ -21,7 +21,8 @@ ImplFile LongIdent (SynLongIdent ([int], [], [None])), false, PreXmlDoc ((4,7), FSharp.Compiler.Xml.XmlDocCollector), - None, (4,7--4,10), { LeadingKeyword = None })], + None, (4,7--4,10), { LeadingKeyword = None + MutableKeyword = None })], PreXmlDoc ((4,4), FSharp.Compiler.Xml.XmlDocCollector), None, (4,4--4,10), { BarRange = None })], (4,4--4,10)), (4,4--4,10)), [], None, (3,5--4,10), diff --git a/tests/service/data/SyntaxTree/UnionCase/Missing name 04.fs.bsl b/tests/service/data/SyntaxTree/UnionCase/Missing name 04.fs.bsl index 3d1dfee767..8913b904ce 100644 --- a/tests/service/data/SyntaxTree/UnionCase/Missing name 04.fs.bsl +++ b/tests/service/data/SyntaxTree/UnionCase/Missing name 04.fs.bsl @@ -25,7 +25,8 @@ ImplFile LongIdent (SynLongIdent ([int], [], [None])), false, PreXmlDoc ((5,9), FSharp.Compiler.Xml.XmlDocCollector), - None, (5,9--5,12), { LeadingKeyword = None })], + None, (5,9--5,12), { LeadingKeyword = None + MutableKeyword = None })], PreXmlDoc ((5,4), FSharp.Compiler.Xml.XmlDocCollector), None, (5,6--5,12), { BarRange = Some (5,4--5,5) }); SynUnionCase diff --git a/tests/service/data/SyntaxTree/UnionCase/Missing name 05.fs.bsl b/tests/service/data/SyntaxTree/UnionCase/Missing name 05.fs.bsl index a258d294e9..9d7a69011e 100644 --- a/tests/service/data/SyntaxTree/UnionCase/Missing name 05.fs.bsl +++ b/tests/service/data/SyntaxTree/UnionCase/Missing name 05.fs.bsl @@ -25,7 +25,8 @@ ImplFile LongIdent (SynLongIdent ([int], [], [None])), false, PreXmlDoc ((5,18), FSharp.Compiler.Xml.XmlDocCollector), - None, (5,18--5,21), { LeadingKeyword = None })], + None, (5,18--5,21), { LeadingKeyword = None + MutableKeyword = None })], PreXmlDoc ((5,4), FSharp.Compiler.Xml.XmlDocCollector), None, (5,6--5,21), { BarRange = Some (5,4--5,5) }); SynUnionCase diff --git a/tests/service/data/SyntaxTree/UnionCase/MultipleSynUnionCasesHaveBarRange.fs.bsl b/tests/service/data/SyntaxTree/UnionCase/MultipleSynUnionCasesHaveBarRange.fs.bsl index a3d6304cb9..8691d476cc 100644 --- a/tests/service/data/SyntaxTree/UnionCase/MultipleSynUnionCasesHaveBarRange.fs.bsl +++ b/tests/service/data/SyntaxTree/UnionCase/MultipleSynUnionCasesHaveBarRange.fs.bsl @@ -21,7 +21,8 @@ ImplFile LongIdent (SynLongIdent ([string], [], [None])), false, PreXmlDoc ((3,13), FSharp.Compiler.Xml.XmlDocCollector), - None, (3,13--3,19), { LeadingKeyword = None })], + None, (3,13--3,19), { LeadingKeyword = None + MutableKeyword = None })], PreXmlDoc ((3,4), FSharp.Compiler.Xml.XmlDocCollector), None, (3,6--3,19), { BarRange = Some (3,4--3,5) }); SynUnionCase @@ -32,7 +33,8 @@ ImplFile LongIdent (SynLongIdent ([int], [], [None])), false, PreXmlDoc ((4,14), FSharp.Compiler.Xml.XmlDocCollector), - None, (4,14--4,17), { LeadingKeyword = None })], + None, (4,14--4,17), { LeadingKeyword = None + MutableKeyword = None })], PreXmlDoc ((4,4), FSharp.Compiler.Xml.XmlDocCollector), None, (4,6--4,17), { BarRange = Some (4,4--4,5) })], (3,4--4,17)), (3,4--4,17)), [], None, (2,5--4,17), diff --git a/tests/service/data/SyntaxTree/UnionCase/PrivateKeywordHasRange.fs.bsl b/tests/service/data/SyntaxTree/UnionCase/PrivateKeywordHasRange.fs.bsl index 868b74daa1..21d1081b55 100644 --- a/tests/service/data/SyntaxTree/UnionCase/PrivateKeywordHasRange.fs.bsl +++ b/tests/service/data/SyntaxTree/UnionCase/PrivateKeywordHasRange.fs.bsl @@ -21,7 +21,8 @@ ImplFile LongIdent (SynLongIdent ([string], [], [None])), false, PreXmlDoc ((9,14), FSharp.Compiler.Xml.XmlDocCollector), - None, (9,14--9,20), { LeadingKeyword = None })], + None, (9,14--9,20), { LeadingKeyword = None + MutableKeyword = None })], PreXmlDoc ((9,4), FSharp.Compiler.Xml.XmlDocCollector), None, (9,6--9,20), { BarRange = Some (9,4--9,5) })], (7,4--9,20)), (7,4--9,20)), [], None, (2,5--9,20), diff --git a/tests/service/data/SyntaxTree/UnionCase/Recover Function Type 01.fs.bsl b/tests/service/data/SyntaxTree/UnionCase/Recover Function Type 01.fs.bsl index 5c804d4a84..4817546864 100644 --- a/tests/service/data/SyntaxTree/UnionCase/Recover Function Type 01.fs.bsl +++ b/tests/service/data/SyntaxTree/UnionCase/Recover Function Type 01.fs.bsl @@ -26,7 +26,8 @@ ImplFile (3,20--3,30), { ArrowRange = (3,24--3,26) }), false, PreXmlDoc ((3,20), FSharp.Compiler.Xml.XmlDocCollector), - None, (3,20--3,30), { LeadingKeyword = None })], + None, (3,20--3,30), { LeadingKeyword = None + MutableKeyword = None })], PreXmlDoc ((3,11), FSharp.Compiler.Xml.XmlDocCollector), None, (3,13--3,30), { BarRange = Some (3,11--3,12) })], (3,11--3,30)), (3,11--3,30)), [], None, (3,5--3,30), diff --git a/tests/service/data/SyntaxTree/UnionCase/Recover Function Type 02.fs.bsl b/tests/service/data/SyntaxTree/UnionCase/Recover Function Type 02.fs.bsl index d73d7a6a39..0b908ef60f 100644 --- a/tests/service/data/SyntaxTree/UnionCase/Recover Function Type 02.fs.bsl +++ b/tests/service/data/SyntaxTree/UnionCase/Recover Function Type 02.fs.bsl @@ -26,7 +26,8 @@ ImplFile (3,19--3,29), { ArrowRange = (3,23--3,25) }), false, PreXmlDoc ((3,16), FSharp.Compiler.Xml.XmlDocCollector), - None, (3,16--3,29), { LeadingKeyword = None })], + None, (3,16--3,29), { LeadingKeyword = None + MutableKeyword = None })], PreXmlDoc ((3,9), FSharp.Compiler.Xml.XmlDocCollector), None, (3,11--3,29), { BarRange = Some (3,9--3,10) })], (3,9--3,29)), (3,9--3,29)), [], None, (3,5--3,29), diff --git a/tests/service/data/SyntaxTree/UnionCase/Recover Function Type 03.fs.bsl b/tests/service/data/SyntaxTree/UnionCase/Recover Function Type 03.fs.bsl index 7ccf1e70d6..97defcda3c 100644 --- a/tests/service/data/SyntaxTree/UnionCase/Recover Function Type 03.fs.bsl +++ b/tests/service/data/SyntaxTree/UnionCase/Recover Function Type 03.fs.bsl @@ -31,7 +31,8 @@ ImplFile (3,16--3,33), { ArrowRange = (3,20--3,22) }), false, PreXmlDoc ((3,16), FSharp.Compiler.Xml.XmlDocCollector), - None, (3,16--3,33), { LeadingKeyword = None })], + None, (3,16--3,33), { LeadingKeyword = None + MutableKeyword = None })], PreXmlDoc ((3,9), FSharp.Compiler.Xml.XmlDocCollector), None, (3,11--3,33), { BarRange = Some (3,9--3,10) })], (3,9--3,33)), (3,9--3,33)), [], None, (3,5--3,33), diff --git a/tests/service/data/SyntaxTree/UnionCase/SingleSynUnionCaseHasBarRange.fs.bsl b/tests/service/data/SyntaxTree/UnionCase/SingleSynUnionCaseHasBarRange.fs.bsl index eaa8e08291..d5c4b3f2f8 100644 --- a/tests/service/data/SyntaxTree/UnionCase/SingleSynUnionCaseHasBarRange.fs.bsl +++ b/tests/service/data/SyntaxTree/UnionCase/SingleSynUnionCaseHasBarRange.fs.bsl @@ -21,7 +21,8 @@ ImplFile LongIdent (SynLongIdent ([string], [], [None])), false, PreXmlDoc ((2,20), FSharp.Compiler.Xml.XmlDocCollector), - None, (2,20--2,26), { LeadingKeyword = None })], + None, (2,20--2,26), { LeadingKeyword = None + MutableKeyword = None })], PreXmlDoc ((2,11), FSharp.Compiler.Xml.XmlDocCollector), None, (2,13--2,26), { BarRange = Some (2,11--2,12) })], (2,11--2,26)), (2,11--2,26)), [], None, (2,5--2,26), diff --git a/tests/service/data/SyntaxTree/UnionCase/SingleSynUnionCaseWithoutBar.fs.bsl b/tests/service/data/SyntaxTree/UnionCase/SingleSynUnionCaseWithoutBar.fs.bsl index 61f328fc6a..32910732a1 100644 --- a/tests/service/data/SyntaxTree/UnionCase/SingleSynUnionCaseWithoutBar.fs.bsl +++ b/tests/service/data/SyntaxTree/UnionCase/SingleSynUnionCaseWithoutBar.fs.bsl @@ -21,7 +21,8 @@ ImplFile LongIdent (SynLongIdent ([string], [], [None])), false, PreXmlDoc ((2,18), FSharp.Compiler.Xml.XmlDocCollector), - None, (2,18--2,24), { LeadingKeyword = None })], + None, (2,18--2,24), { LeadingKeyword = None + MutableKeyword = None })], PreXmlDoc ((2,11), FSharp.Compiler.Xml.XmlDocCollector), None, (2,11--2,24), { BarRange = None })], (2,11--2,24)), (2,11--2,24)), [], None, (2,5--2,24), diff --git a/tests/service/data/SyntaxTree/UnionCase/UnionCaseFieldsCanHaveComments.fs.bsl b/tests/service/data/SyntaxTree/UnionCase/UnionCaseFieldsCanHaveComments.fs.bsl index 8ee3e63844..51363b02c3 100644 --- a/tests/service/data/SyntaxTree/UnionCase/UnionCaseFieldsCanHaveComments.fs.bsl +++ b/tests/service/data/SyntaxTree/UnionCase/UnionCaseFieldsCanHaveComments.fs.bsl @@ -21,13 +21,15 @@ ImplFile LongIdent (SynLongIdent ([string], [], [None])), false, PreXmlDoc ((6,2), FSharp.Compiler.Xml.XmlDocCollector), - None, (5,2--6,15), { LeadingKeyword = None }); + None, (5,2--6,15), { LeadingKeyword = None + MutableKeyword = None }); SynField ([], false, None, LongIdent (SynLongIdent ([bool], [], [None])), false, PreXmlDoc ((8,2), FSharp.Compiler.Xml.XmlDocCollector), - None, (7,2--8,6), { LeadingKeyword = None })], + None, (7,2--8,6), { LeadingKeyword = None + MutableKeyword = None })], PreXmlDoc ((4,0), FSharp.Compiler.Xml.XmlDocCollector), None, (3,0--8,6), { BarRange = Some (4,0--4,1) })], (3,0--8,6)), (3,0--8,6)), [], None, (2,5--8,6), From e0af85f7088db445de423d5c88cbed256fcef0ae Mon Sep 17 00:00:00 2001 From: Eugene Auduchinok Date: Fri, 1 Dec 2023 14:20:35 +0100 Subject: [PATCH 10/11] Simplify --- src/Compiler/SyntaxTree/ParseHelpers.fs | 53 ++++++++++--------------- 1 file changed, 21 insertions(+), 32 deletions(-) diff --git a/src/Compiler/SyntaxTree/ParseHelpers.fs b/src/Compiler/SyntaxTree/ParseHelpers.fs index eac167c2ca..aa10f3fad3 100644 --- a/src/Compiler/SyntaxTree/ParseHelpers.fs +++ b/src/Compiler/SyntaxTree/ParseHelpers.fs @@ -1141,43 +1141,32 @@ let mkAutoPropDefn mVal access ident typ mEquals (expr: SynExpr) accessors xmlDo ) let mkSynField - parseState - (idOpt: Ident option) - (t: SynType option) - (isMutable: range option) - (vis: SynAccess option) - (attributes: SynAttributes) - (mStatic: range option) - (rangeStart: range) - (leadingKeyword: SynLeadingKeyword option) - = + parseState + (idOpt: Ident option) + (t: SynType option) + (isMutable: range option) + (vis: SynAccess option) + (attributes: SynAttributes) + (mStatic: range option) + (rangeStart: range) + (leadingKeyword: SynLeadingKeyword option) = + let t, mStart = match t with | Some value -> value, rangeStart | None -> - let mType, mStart = - match idOpt with - | Some id -> id.idRange, rangeStart - | _ -> - - match vis with - | Some vis -> vis.Range, rangeStart - | _ -> - - match isMutable with - | Some m -> m, rangeStart - | _ -> - - match leadingKeyword with - | Some keyword -> keyword.Range, rangeStart - | None -> - - attributes - |> Seq.tryLast - |> Option.map (fun l -> l.Range, rangeStart) - |> Option.defaultWith (fun _ -> rangeStart.StartRange, rangeStart.StartRange) - SynType.FromParseError(mType.EndRange), mStart + let mType, mStart = + idOpt + |> Option.map _.idRange + |> Option.orElseWith (fun _ -> vis |> Option.map (fun v -> v.Range)) + |> Option.orElse isMutable + |> Option.orElseWith (fun _ -> leadingKeyword |> Option.map (fun k -> k.Range)) + |> Option.orElseWith (fun _ -> attributes |> List.tryLast |> Option.map (fun l -> l.Range)) + |> Option.map (fun m -> m, rangeStart) + |> Option.defaultWith (fun _ -> rangeStart.StartRange, rangeStart.StartRange) + + SynType.FromParseError(mType.EndRange), mStart let mWhole = unionRanges mStart t.Range let xmlDoc = grabXmlDocAtRangeStart (parseState, attributes, mWhole) From 508ce09604c2748e544dd56cbe137a043b7b7ed4 Mon Sep 17 00:00:00 2001 From: Eugene Auduchinok Date: Fri, 1 Dec 2023 14:21:03 +0100 Subject: [PATCH 11/11] Fantomas --- src/Compiler/SyntaxTree/ParseHelpers.fs | 41 +++++++++++++------------ 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/src/Compiler/SyntaxTree/ParseHelpers.fs b/src/Compiler/SyntaxTree/ParseHelpers.fs index aa10f3fad3..bb2e775576 100644 --- a/src/Compiler/SyntaxTree/ParseHelpers.fs +++ b/src/Compiler/SyntaxTree/ParseHelpers.fs @@ -1141,32 +1141,33 @@ let mkAutoPropDefn mVal access ident typ mEquals (expr: SynExpr) accessors xmlDo ) let mkSynField - parseState - (idOpt: Ident option) - (t: SynType option) - (isMutable: range option) - (vis: SynAccess option) - (attributes: SynAttributes) - (mStatic: range option) - (rangeStart: range) - (leadingKeyword: SynLeadingKeyword option) = + parseState + (idOpt: Ident option) + (t: SynType option) + (isMutable: range option) + (vis: SynAccess option) + (attributes: SynAttributes) + (mStatic: range option) + (rangeStart: range) + (leadingKeyword: SynLeadingKeyword option) + = let t, mStart = match t with | Some value -> value, rangeStart | None -> - let mType, mStart = - idOpt - |> Option.map _.idRange - |> Option.orElseWith (fun _ -> vis |> Option.map (fun v -> v.Range)) - |> Option.orElse isMutable - |> Option.orElseWith (fun _ -> leadingKeyword |> Option.map (fun k -> k.Range)) - |> Option.orElseWith (fun _ -> attributes |> List.tryLast |> Option.map (fun l -> l.Range)) - |> Option.map (fun m -> m, rangeStart) - |> Option.defaultWith (fun _ -> rangeStart.StartRange, rangeStart.StartRange) - - SynType.FromParseError(mType.EndRange), mStart + let mType, mStart = + idOpt + |> Option.map _.idRange + |> Option.orElseWith (fun _ -> vis |> Option.map (fun v -> v.Range)) + |> Option.orElse isMutable + |> Option.orElseWith (fun _ -> leadingKeyword |> Option.map (fun k -> k.Range)) + |> Option.orElseWith (fun _ -> attributes |> List.tryLast |> Option.map (fun l -> l.Range)) + |> Option.map (fun m -> m, rangeStart) + |> Option.defaultWith (fun _ -> rangeStart.StartRange, rangeStart.StartRange) + + SynType.FromParseError(mType.EndRange), mStart let mWhole = unionRanges mStart t.Range let xmlDoc = grabXmlDocAtRangeStart (parseState, attributes, mWhole)