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 5d87cbc7fe2..0163ddb1e9d 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 e2aaa935a92..fd3b780aacf 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 fed1e4c924e..a41646e01c0 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 02b844894cb..9add16af683 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 e05377af0ba..97f40bee62c 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 6f8a86d14b7..e2fd2053aaa 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 a4a77de3bf5..c40a2fe380e 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 a55e3597c88..d9d890c7102 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 61ba65dcc1e..34027132edd 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 3b2dd6ee6a7..4c591f6f135 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 7857228abf6..14001fbd9e6 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 134e094dffd..a0edd202be0 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 f5a0d7e0573..9181e17a428 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 7d68a8d3b73..0f11ea8327b 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 4a768bb43a3..cd5ef76a637 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 b44ad46613e..35d75d2ccfe 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 55a7fa70adf..89ce0d6951f 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 b1f1ba766fa..1607a64406e 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 7b87a733430..f116c2f1a78 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 cc69cca8708..8decd4ee8f6 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 19453574e0a..4b60596ef66 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 fff1abdc078..3bcc4264a2a 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 de49a40d0ab..9ea124eee3c 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 17a1c250067..1074b8e362c 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 e5485cf278c..27fe2dbef80 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 066a055a8da..930233ae6f3 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 f86322e7ed2..2e6dfc69065 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 000f2c63128..47cc099ef45 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 22f89b87864..cf52b55505e 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 00000000000..4e4f23d2858 --- /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 00000000000..d60916014f7 --- /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 00000000000..5599e7906ae --- /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 00000000000..c0415e5509c --- /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 00000000000..0f62041753c --- /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 00000000000..e9f79495640 --- /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 00000000000..6656f609f9e --- /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 00000000000..7d8c762c5dd --- /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 00000000000..fa2e7923047 --- /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 00000000000..919a08217d2 --- /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 00000000000..5aa6084b5f1 --- /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 00000000000..9421a92c55a --- /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 00000000000..0763672605a --- /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 00000000000..bd47ffadd86 --- /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 00000000000..f2aeb291f6d --- /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 00000000000..67dac777503 --- /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 00000000000..da377bf20b1 --- /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 00000000000..d9b3583bdf5 --- /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 00000000000..0aff5f6999d --- /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 00000000000..5a44e8b0760 --- /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 00000000000..db2a7fa0f00 --- /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 00000000000..2cedf234164 --- /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 00000000000..1f1c5dcbf47 --- /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 00000000000..1ab133c1cb3 --- /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 00000000000..f61e93105ab --- /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 00000000000..9b3ad612030 --- /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 00000000000..81e33d6c9a8 --- /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 00000000000..567858760a6 --- /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 91d5f58ca56..109206f10ce 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 3ebdfe18ae4..b218789c911 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 00000000000..3bd731d5d69 --- /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 00000000000..8777aa1b200 --- /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 00000000000..f3437a91250 --- /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 00000000000..659b756b718 --- /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 00000000000..c74857840e1 --- /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 00000000000..7bf4310b183 --- /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 5ed03aa81bd..9e7e0e92639 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 a41646e01c0..32e8f14c765 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 0163ddb1e9d..da3ecc9b0d9 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 4ccc4a9b8cd..138cf45e723 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 6fa51549e91..354539ed7c1 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 6fc05018271..b28c96ccf51 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 00000000000..77f72b83e97 --- /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 00000000000..fade50ea6ab --- /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 5ac7347ed49..ea149ea3a61 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 5ac7347ed49..ea149ea3a61 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 bdb4fd81444..0872f118db1 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 c32ad022d1f..b3f777bea39 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 1b428ae309e..3893eaf1fdd 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 175823c0e39..eac9452c02c 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 847a5987b20..dfcd6a2e2a1 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 e2fd2053aaa..72e4a9d216a 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 32e8f14c765..eac167c2ca4 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 623e07fa1ff..7330ac9b695 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 d30816e697b..137f5432803 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 ea149ea3a61..04475daccd2 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 ea149ea3a61..04475daccd2 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 9136c672d0f..690183a18b6 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 28e40121327..a30354d3b41 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 9d3675ba2e3..1c940b8d6fd 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 4b60596ef66..add8ac4adbe 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 3bcc4264a2a..33eba0a9f87 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 9ea124eee3c..4308cbcfebb 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 1074b8e362c..e481768ccb4 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 27fe2dbef80..46cf2e29c7f 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 930233ae6f3..723a8c44f25 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 2e6dfc69065..e62126034db 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 47cc099ef45..c74f09be72c 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 cf52b55505e..8b4d8d1fa48 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 d60916014f7..77016903ad5 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 c0415e5509c..4f3cfe4b8b4 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 e9f79495640..d29045ba0e7 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 7d8c762c5dd..3b42126b6db 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 919a08217d2..b9ae59996cf 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 fade50ea6ab..472d5e0c2f9 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 587df130b0f..13f845e312a 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 bf2904ff046..8a0f981091f 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 c949211307e..b52c329f8c9 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 35f55a52373..e92edcc8113 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 1046fa25479..bf3950ebf3c 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 27d724e66ab..8a7477a0400 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 5aa63f103b5..d0fe920321f 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 df1725af6c4..7829833143a 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 54ca9aa3877..bfc76db57f5 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 8ae96be677d..0b685986fc4 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 9421a92c55a..95895538080 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 bd47ffadd86..dac1c3f6255 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 67dac777503..f819d61d7c4 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 d9b3583bdf5..1bcbe107b49 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 5a44e8b0760..1b629ceaf6f 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 2cedf234164..6d7a08f3caa 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 1ab133c1cb3..34b8bfe0d51 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 9b3ad612030..e8067343cd8 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 567858760a6..3679671665f 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 109206f10ce..1eabb2b2f62 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 b218789c911..11cabe541de 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 659b756b718..db457dd8de3 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 7bf4310b183..19883a9e8c9 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 9e7e0e92639..3ca9cf08ae3 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 41f5400ce1a..35e334478f0 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 fdaf263fba8..5e5b3b7fc3b 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 61ef3fc7998..2bac019ca23 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 f8f3055038c..4a272764df0 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 3d1dfee767b..8913b904cea 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 a258d294e96..9d7a69011ef 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 a3d6304cb9b..8691d476cc6 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 868b74daa10..21d1081b55d 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 5c804d4a845..4817546864d 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 d73d7a6a397..0b908ef60f6 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 7ccf1e70d61..97defcda3ce 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 eaa8e082910..d5c4b3f2f80 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 61f328fc6a9..32910732a1c 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 8ee3e638446..51363b02c37 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 eac167c2ca4..aa10f3fad3a 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 aa10f3fad3a..bb2e7755767 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)