From f6d61c1df5395c1ef03c260496bc6a472b7355ea Mon Sep 17 00:00:00 2001 From: Eugene Auduchinok Date: Thu, 7 Sep 2023 11:56:54 +0200 Subject: [PATCH 1/5] Parser: recover on unfinished interface member --- src/Compiler/SyntaxTree/LexFilter.fs | 63 ++++++++++++------- src/Compiler/pars.fsy | 16 +++-- .../data/SyntaxTree/Member/Inherit 03.fs.bsl | 5 +- .../data/SyntaxTree/Member/Inherit 04.fs.bsl | 5 +- .../data/SyntaxTree/Member/Inherit 05.fs.bsl | 4 +- .../data/SyntaxTree/Member/Inherit 08.fs | 6 ++ .../data/SyntaxTree/Member/Inherit 08.fs.bsl | 47 ++++++++++++++ .../data/SyntaxTree/Member/Interface 08.fs | 8 +++ .../SyntaxTree/Member/Interface 08.fs.bsl | 49 +++++++++++++++ .../data/SyntaxTree/Member/Interface 09.fs | 8 +++ .../SyntaxTree/Member/Interface 09.fs.bsl | 39 ++++++++++++ .../data/SyntaxTree/Member/Interface 10.fs | 8 +++ .../SyntaxTree/Member/Interface 10.fs.bsl | 39 ++++++++++++ .../data/SyntaxTree/Type/Interface 01.fs | 6 ++ .../data/SyntaxTree/Type/Interface 01.fs.bsl | 20 ++++++ .../data/SyntaxTree/Type/Interface 02.fs | 7 +++ .../data/SyntaxTree/Type/Interface 02.fs.bsl | 20 ++++++ .../data/SyntaxTree/Type/Interface 03.fs | 8 +++ .../data/SyntaxTree/Type/Interface 03.fs.bsl | 41 ++++++++++++ .../data/SyntaxTree/Type/Interface 04.fs | 7 +++ .../data/SyntaxTree/Type/Interface 04.fs.bsl | 41 ++++++++++++ .../data/SyntaxTree/Type/Interface 05.fs | 7 +++ .../data/SyntaxTree/Type/Interface 05.fs.bsl | 13 ++++ .../data/SyntaxTree/Type/Interface 06.fs | 6 ++ .../data/SyntaxTree/Type/Interface 06.fs.bsl | 13 ++++ .../data/SyntaxTree/Type/Interface 07.fs | 8 +++ .../data/SyntaxTree/Type/Interface 07.fs.bsl | 46 ++++++++++++++ 27 files changed, 506 insertions(+), 34 deletions(-) create mode 100644 tests/service/data/SyntaxTree/Member/Inherit 08.fs create mode 100644 tests/service/data/SyntaxTree/Member/Inherit 08.fs.bsl create mode 100644 tests/service/data/SyntaxTree/Member/Interface 08.fs create mode 100644 tests/service/data/SyntaxTree/Member/Interface 08.fs.bsl create mode 100644 tests/service/data/SyntaxTree/Member/Interface 09.fs create mode 100644 tests/service/data/SyntaxTree/Member/Interface 09.fs.bsl create mode 100644 tests/service/data/SyntaxTree/Member/Interface 10.fs create mode 100644 tests/service/data/SyntaxTree/Member/Interface 10.fs.bsl create mode 100644 tests/service/data/SyntaxTree/Type/Interface 01.fs create mode 100644 tests/service/data/SyntaxTree/Type/Interface 01.fs.bsl create mode 100644 tests/service/data/SyntaxTree/Type/Interface 02.fs create mode 100644 tests/service/data/SyntaxTree/Type/Interface 02.fs.bsl create mode 100644 tests/service/data/SyntaxTree/Type/Interface 03.fs create mode 100644 tests/service/data/SyntaxTree/Type/Interface 03.fs.bsl create mode 100644 tests/service/data/SyntaxTree/Type/Interface 04.fs create mode 100644 tests/service/data/SyntaxTree/Type/Interface 04.fs.bsl create mode 100644 tests/service/data/SyntaxTree/Type/Interface 05.fs create mode 100644 tests/service/data/SyntaxTree/Type/Interface 05.fs.bsl create mode 100644 tests/service/data/SyntaxTree/Type/Interface 06.fs create mode 100644 tests/service/data/SyntaxTree/Type/Interface 06.fs.bsl create mode 100644 tests/service/data/SyntaxTree/Type/Interface 07.fs create mode 100644 tests/service/data/SyntaxTree/Type/Interface 07.fs.bsl diff --git a/src/Compiler/SyntaxTree/LexFilter.fs b/src/Compiler/SyntaxTree/LexFilter.fs index f5529d64de4..fa9042b14a7 100644 --- a/src/Compiler/SyntaxTree/LexFilter.fs +++ b/src/Compiler/SyntaxTree/LexFilter.fs @@ -46,7 +46,7 @@ type Context = | CtxtElse of Position | CtxtDo of Position | CtxtInterfaceHead of Position - | CtxtTypeDefns of Position // 'type =', not removed when we find the "=" + | CtxtTypeDefns of Position * equalsEndPos: Position option // 'type =', not removed when we find the "=" | CtxtNamespaceHead of Position * token | CtxtModuleHead of Position * token * LexingModuleAttributes * isNested: bool @@ -69,7 +69,7 @@ type Context = member c.StartPos = match c with | CtxtNamespaceHead (p, _) | CtxtModuleHead (p, _, _, _) | CtxtException p | CtxtModuleBody (p, _) | CtxtNamespaceBody p - | CtxtLetDecl (_, p) | CtxtDo p | CtxtInterfaceHead p | CtxtTypeDefns p | CtxtParen (_, p) | CtxtMemberHead p | CtxtMemberBody p + | CtxtLetDecl (_, p) | CtxtDo p | CtxtInterfaceHead p | CtxtTypeDefns(p, _) | CtxtParen (_, p) | CtxtMemberHead p | CtxtMemberBody p | CtxtWithAsLet p | CtxtWithAsAugment p | CtxtMatchClauses (_, p) | CtxtIf p | CtxtMatch p | CtxtFor p | CtxtWhile p | CtxtWhen p | CtxtFunction p | CtxtFun p | CtxtTry p | CtxtThen p | CtxtElse p | CtxtVanilla (p, _) @@ -1679,7 +1679,7 @@ type LexFilterImpl ( // | B // // <-- close the type context sequence block here *) - | _, CtxtTypeDefns posType :: _ when offsidePos.Column = posType.Column && not (isTypeSeqBlockElementContinuator token) -> -1 + | _, CtxtTypeDefns(posType, _) :: _ when offsidePos.Column = posType.Column && not (isTypeSeqBlockElementContinuator token) -> -1 // This ensures we close a namespace body when we see the next namespace definition // @@ -1822,7 +1822,7 @@ type LexFilterImpl ( popCtxt() reprocess() - | _, CtxtTypeDefns offsidePos :: _ + | _, CtxtTypeDefns(offsidePos, _) :: _ when isSemiSemi || (if relaxWhitespace2OffsideRule || isTypeContinuator token then tokenStartCol + 1 else tokenStartCol) <= offsidePos.Column -> if debug then dprintf "token at column %d is offside from TYPE(offsidePos=%a)! pop and reprocess\n" tokenStartCol outputPos offsidePos popCtxt() @@ -2076,8 +2076,9 @@ type LexFilterImpl ( pushCtxtSeqBlock tokenTup AddBlockEnd returnToken tokenLexbufState token - | EQUALS, CtxtTypeDefns _ :: _ -> + | EQUALS, CtxtTypeDefns(p, _) :: _ -> if debug then dprintf "CtxType: EQUALS, pushing CtxtSeqBlock\n" + replaceCtxt tokenTup (CtxtTypeDefns(p, Some tokenTup.EndPos)) pushCtxtSeqBlock tokenTup AddBlockEnd returnToken tokenLexbufState token @@ -2385,22 +2386,42 @@ type LexFilterImpl ( pushCtxt tokenTup (CtxtFun tokenStartPos) returnToken tokenLexbufState OFUN + // type I = interface .... end + | INTERFACE, CtxtSeqBlock _ :: CtxtTypeDefns(typePos, Some equalsEndPos) :: _ when + (tokenTup.LastTokenPos = equalsEndPos && + + // Allow deindenting interface representation when started after `=`: + // + // type I = interface + // abstract P: int + // end + + let allowDeindent = tokenTup.EndPos.Line = equalsEndPos.Line + + let lookaheadTokenTup = peekNextTokenTup () + let lookaheadTokenStartPos = startPosOfTokenTup lookaheadTokenTup + match lookaheadTokenTup.Token with + | END -> + lookaheadTokenStartPos.Column >= typePos.Column + + | DEFAULT | OVERRIDE | INTERFACE | NEW | TYPE | STATIC | MEMBER | ABSTRACT | INHERIT | LBRACK_LESS -> + let limitPos = if allowDeindent then typePos else tokenTup.StartPos + lookaheadTokenStartPos.Column >= limitPos.Column + 1 + + | _ -> + false) -> + + if debug then dprintf "INTERFACE, pushing CtxtParen, tokenStartPos = %a\n" outputPos tokenStartPos + pushCtxt tokenTup (CtxtParen (token, tokenStartPos)) + pushCtxtSeqBlock tokenTup AddBlockEnd + returnToken tokenLexbufState token + + // type C with interface .... with + // type C = interface .... with | INTERFACE, _ -> - let lookaheadTokenTup = peekNextTokenTup() - let lookaheadTokenStartPos = startPosOfTokenTup lookaheadTokenTup - match lookaheadTokenTup.Token with - // type I = interface .... end - | DEFAULT | OVERRIDE | INTERFACE | NEW | TYPE | STATIC | END | MEMBER | ABSTRACT | INHERIT | LBRACK_LESS -> - if debug then dprintf "INTERFACE, pushing CtxtParen, tokenStartPos = %a, lookaheadTokenStartPos = %a\n" outputPos tokenStartPos outputPos lookaheadTokenStartPos - pushCtxt tokenTup (CtxtParen (token, tokenStartPos)) - pushCtxtSeqBlock tokenTup AddBlockEnd - returnToken tokenLexbufState token - // type C with interface .... with - // type C = interface .... with - | _ -> - if debug then dprintf "INTERFACE, pushing CtxtInterfaceHead, tokenStartPos = %a, lookaheadTokenStartPos = %a\n" outputPos tokenStartPos outputPos lookaheadTokenStartPos - pushCtxt tokenTup (CtxtInterfaceHead tokenStartPos) - returnToken tokenLexbufState OINTERFACE_MEMBER + if debug then dprintf "INTERFACE, pushing CtxtInterfaceHead, tokenStartPos = %a, lookaheadTokenStartPos \n" outputPos tokenStartPos + pushCtxt tokenTup (CtxtInterfaceHead tokenStartPos) + returnToken tokenLexbufState OINTERFACE_MEMBER | CLASS, _ -> if debug then dprintf "CLASS, pushing CtxtParen(%a)\n" outputPos tokenStartPos @@ -2411,7 +2432,7 @@ type LexFilterImpl ( | TYPE, _ -> insertComingSoonTokens("TYPE", TYPE_COMING_SOON, TYPE_IS_HERE) if debug then dprintf "TYPE, pushing CtxtTypeDefns(%a)\n" outputPos tokenStartPos - pushCtxt tokenTup (CtxtTypeDefns tokenStartPos) + pushCtxt tokenTup (CtxtTypeDefns(tokenStartPos, None)) pool.Return tokenTup hwTokenFetch useBlockRule diff --git a/src/Compiler/pars.fsy b/src/Compiler/pars.fsy index c020df5f9ca..00d132155e9 100644 --- a/src/Compiler/pars.fsy +++ b/src/Compiler/pars.fsy @@ -1760,7 +1760,7 @@ tyconClassDefn: | classOrInterfaceOrStruct classDefnBlock END { false, ($1, $2), Some(rhs2 parseState 1 3) } - | classOrInterfaceOrStruct classDefnBlock recover + | classOrInterfaceOrStruct classDefnBlock ends_coming_soon_or_recover { reportParseErrorAt (rhs parseState 1) (FSComp.SR.parsUnmatchedClassInterfaceOrStruct()) let m = (rhs parseState 1, $2) ||> unionRangeWithListBy (fun (d: SynMemberDefn) -> d.Range) false, ($1, $2), Some(m) } @@ -2006,6 +2006,13 @@ classDefnMember: | Some(mWithKwd, members, m) -> Some mWithKwd, Some members, unionRanges (rhs2 parseState 1 4) m [ SynMemberDefn.Interface($4, mWithKwd, members, mWhole) ] } + | opt_attributes opt_access interfaceMember recover + { let mInterface = rhs parseState 3 + if not (isNil $1) then errorR(Error(FSComp.SR.parsAttributesAreNotPermittedOnInterfaceImplementations(), rhs parseState 1)) + if Option.isSome $2 then errorR(Error(FSComp.SR.parsInterfacesHaveSameVisibilityAsEnclosingType(), mInterface)) + let ty = SynType.FromParseError(mInterface.EndRange) + [ SynMemberDefn.Interface(ty, None, None, rhs2 parseState 1 3) ] } + | opt_attributes opt_access abstractMemberFlags opt_inline nameop opt_explicitValTyparDecls COLON topTypeWithTypeConstraints classMemberSpfnGetSet opt_ODECLEND { let ty, arity = $8 let isInline, doc, id, explicitValTyparDecls = (Option.isSome $4), grabXmlDoc(parseState, $1, 1), $5, $6 @@ -2293,9 +2300,10 @@ inheritsDefn: SynMemberDefn.ImplicitInherit($2, $4, $5, mDecl) } | INHERIT ends_coming_soon_or_recover - { let mDecl = (rhs parseState 1) - if not $2 then errorR (Error(FSComp.SR.parsTypeNameCannotBeEmpty (), mDecl)) - SynMemberDefn.Inherit(SynType.LongIdent(SynLongIdent([], [], [])), None, mDecl) } + { let mInherit = rhs parseState 1 + if not $2 then errorR (Error(FSComp.SR.parsTypeNameCannotBeEmpty (), mInherit)) + let ty = SynType.FromParseError(mInherit.EndRange) + SynMemberDefn.Inherit(ty, None, mInherit) } optAsSpec: | asSpec diff --git a/tests/service/data/SyntaxTree/Member/Inherit 03.fs.bsl b/tests/service/data/SyntaxTree/Member/Inherit 03.fs.bsl index eeab1704856..aa982025cf9 100644 --- a/tests/service/data/SyntaxTree/Member/Inherit 03.fs.bsl +++ b/tests/service/data/SyntaxTree/Member/Inherit 03.fs.bsl @@ -11,9 +11,8 @@ ImplFile false, None, (3,5--3,6)), ObjectModel (Unspecified, - [Inherit - (LongIdent (SynLongIdent ([], [], [])), None, - (4,4--4,11))], (4,4--4,11)), [], None, (3,5--4,11), + [Inherit (FromParseError (4,11--4,11), None, (4,4--4,11))], + (4,4--4,11)), [], None, (3,5--4,11), { LeadingKeyword = Type (3,0--3,4) EqualsRange = Some (3,7--3,8) WithKeyword = None })], (3,0--4,11))], diff --git a/tests/service/data/SyntaxTree/Member/Inherit 04.fs.bsl b/tests/service/data/SyntaxTree/Member/Inherit 04.fs.bsl index 9c03baf2b56..d88f5d29b11 100644 --- a/tests/service/data/SyntaxTree/Member/Inherit 04.fs.bsl +++ b/tests/service/data/SyntaxTree/Member/Inherit 04.fs.bsl @@ -11,9 +11,8 @@ ImplFile false, None, (3,5--3,6)), ObjectModel (Unspecified, - [Inherit - (LongIdent (SynLongIdent ([], [], [])), None, - (4,4--4,11))], (4,4--4,11)), [], None, (3,5--4,11), + [Inherit (FromParseError (4,11--4,11), None, (4,4--4,11))], + (4,4--4,11)), [], None, (3,5--4,11), { LeadingKeyword = Type (3,0--3,4) EqualsRange = Some (3,7--3,8) WithKeyword = None })], (3,0--4,11)); diff --git a/tests/service/data/SyntaxTree/Member/Inherit 05.fs.bsl b/tests/service/data/SyntaxTree/Member/Inherit 05.fs.bsl index 37100c58ad0..db4fed86e71 100644 --- a/tests/service/data/SyntaxTree/Member/Inherit 05.fs.bsl +++ b/tests/service/data/SyntaxTree/Member/Inherit 05.fs.bsl @@ -11,9 +11,7 @@ ImplFile false, None, (3,5--3,6)), ObjectModel (Unspecified, - [Inherit - (LongIdent (SynLongIdent ([], [], [])), None, - (4,4--4,11)); + [Inherit (FromParseError (4,11--4,11), None, (4,4--4,11)); Member (SynBinding (None, Normal, false, false, [], diff --git a/tests/service/data/SyntaxTree/Member/Inherit 08.fs b/tests/service/data/SyntaxTree/Member/Inherit 08.fs new file mode 100644 index 00000000000..862c1727685 --- /dev/null +++ b/tests/service/data/SyntaxTree/Member/Inherit 08.fs @@ -0,0 +1,6 @@ +module Module + +type T = + inherit as t + + member this.P = 1 diff --git a/tests/service/data/SyntaxTree/Member/Inherit 08.fs.bsl b/tests/service/data/SyntaxTree/Member/Inherit 08.fs.bsl new file mode 100644 index 00000000000..0635de73f53 --- /dev/null +++ b/tests/service/data/SyntaxTree/Member/Inherit 08.fs.bsl @@ -0,0 +1,47 @@ +ImplFile + (ParsedImplFileInput + ("/root/Member/Inherit 08.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, + [Inherit (FromParseError (4,11--4,11), None, (4,4--4,11)); + Member + (SynBinding + (None, Normal, false, false, [], + PreXmlDoc ((4,12), FSharp.Compiler.Xml.XmlDocCollector), + SynValData + (Some { IsInstance = true + IsDispatchSlot = false + IsOverrideOrExplicitImpl = false + IsFinal = false + GetterOrSetterIsCompilerGenerated = false + MemberKind = Member }, + SynValInfo + ([[SynArgInfo ([], false, None)]; []], + SynArgInfo ([], false, None)), None, None), + LongIdent + (SynLongIdent + ([this; P], [(6,15--6,16)], [None; None]), None, + None, Pats [], None, (6,11--6,17)), None, + Const (Int32 1, (6,20--6,21)), (6,11--6,17), + NoneAtInvisible, + { LeadingKeyword = Member (6,4--6,10) + InlineKeyword = None + EqualsRange = Some (6,18--6,19) }), (4,12--6,21))], + (4,4--6,21)), [], None, (3,5--6,21), + { LeadingKeyword = Type (3,0--3,4) + EqualsRange = Some (3,7--3,8) + WithKeyword = None })], (3,0--6,21))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--6,21), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + CodeComments = [] }, set [])) + +(4,12)-(4,14) parse error Unexpected keyword 'as' in type definition diff --git a/tests/service/data/SyntaxTree/Member/Interface 08.fs b/tests/service/data/SyntaxTree/Member/Interface 08.fs new file mode 100644 index 00000000000..d0ccea9faae --- /dev/null +++ b/tests/service/data/SyntaxTree/Member/Interface 08.fs @@ -0,0 +1,8 @@ +module Module + +type T = + interface + + member this.P = 1 + +() diff --git a/tests/service/data/SyntaxTree/Member/Interface 08.fs.bsl b/tests/service/data/SyntaxTree/Member/Interface 08.fs.bsl new file mode 100644 index 00000000000..f0e64cdad0a --- /dev/null +++ b/tests/service/data/SyntaxTree/Member/Interface 08.fs.bsl @@ -0,0 +1,49 @@ +ImplFile + (ParsedImplFileInput + ("/root/Member/Interface 08.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, + [Interface + (FromParseError (4,13--4,13), None, None, (4,4--4,13)); + Member + (SynBinding + (None, Normal, false, false, [], + PreXmlDoc ((6,4), FSharp.Compiler.Xml.XmlDocCollector), + SynValData + (Some { IsInstance = true + IsDispatchSlot = false + IsOverrideOrExplicitImpl = false + IsFinal = false + GetterOrSetterIsCompilerGenerated = false + MemberKind = Member }, + SynValInfo + ([[SynArgInfo ([], false, None)]; []], + SynArgInfo ([], false, None)), None, None), + LongIdent + (SynLongIdent + ([this; P], [(6,15--6,16)], [None; None]), None, + None, Pats [], None, (6,11--6,17)), None, + Const (Int32 1, (6,20--6,21)), (6,11--6,17), + NoneAtInvisible, + { LeadingKeyword = Member (6,4--6,10) + InlineKeyword = None + EqualsRange = Some (6,18--6,19) }), (6,4--6,21))], + (4,4--6,21)), [], None, (3,5--6,21), + { LeadingKeyword = Type (3,0--3,4) + EqualsRange = Some (3,7--3,8) + WithKeyword = None })], (3,0--6,21)); + 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 [])) + +(4,14)-(6,4) parse error Incomplete structured construct at or before this point in member definition diff --git a/tests/service/data/SyntaxTree/Member/Interface 09.fs b/tests/service/data/SyntaxTree/Member/Interface 09.fs new file mode 100644 index 00000000000..6f6bcb56dff --- /dev/null +++ b/tests/service/data/SyntaxTree/Member/Interface 09.fs @@ -0,0 +1,8 @@ +module Module + +type T = + interface + +type T2 = int + +() diff --git a/tests/service/data/SyntaxTree/Member/Interface 09.fs.bsl b/tests/service/data/SyntaxTree/Member/Interface 09.fs.bsl new file mode 100644 index 00000000000..9260f21ff5b --- /dev/null +++ b/tests/service/data/SyntaxTree/Member/Interface 09.fs.bsl @@ -0,0 +1,39 @@ +ImplFile + (ParsedImplFileInput + ("/root/Member/Interface 09.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, + [Interface + (FromParseError (4,13--4,13), None, None, (4,4--4,13))], + (4,4--4,13)), [], None, (3,5--4,13), + { LeadingKeyword = Type (3,0--3,4) + EqualsRange = Some (3,7--3,8) + WithKeyword = None })], (3,0--4,13)); + Types + ([SynTypeDefn + (SynComponentInfo + ([], None, [], [T2], + PreXmlDoc ((6,0), FSharp.Compiler.Xml.XmlDocCollector), + false, None, (6,5--6,7)), + Simple + (TypeAbbrev + (Ok, LongIdent (SynLongIdent ([int], [], [None])), + (6,10--6,13)), (6,10--6,13)), [], None, (6,5--6,13), + { LeadingKeyword = Type (6,0--6,4) + EqualsRange = Some (6,8--6,9) + WithKeyword = None })], (6,0--6,13)); + 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,0)-(6,4) parse error Incomplete structured construct at or before this point in member definition diff --git a/tests/service/data/SyntaxTree/Member/Interface 10.fs b/tests/service/data/SyntaxTree/Member/Interface 10.fs new file mode 100644 index 00000000000..6f6bcb56dff --- /dev/null +++ b/tests/service/data/SyntaxTree/Member/Interface 10.fs @@ -0,0 +1,8 @@ +module Module + +type T = + interface + +type T2 = int + +() diff --git a/tests/service/data/SyntaxTree/Member/Interface 10.fs.bsl b/tests/service/data/SyntaxTree/Member/Interface 10.fs.bsl new file mode 100644 index 00000000000..9ddc6fb80bb --- /dev/null +++ b/tests/service/data/SyntaxTree/Member/Interface 10.fs.bsl @@ -0,0 +1,39 @@ +ImplFile + (ParsedImplFileInput + ("/root/Member/Interface 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, + [Interface + (FromParseError (4,13--4,13), None, None, (4,4--4,13))], + (4,4--4,13)), [], None, (3,5--4,13), + { LeadingKeyword = Type (3,0--3,4) + EqualsRange = Some (3,7--3,8) + WithKeyword = None })], (3,0--4,13)); + Types + ([SynTypeDefn + (SynComponentInfo + ([], None, [], [T2], + PreXmlDoc ((6,0), FSharp.Compiler.Xml.XmlDocCollector), + false, None, (6,5--6,7)), + Simple + (TypeAbbrev + (Ok, LongIdent (SynLongIdent ([int], [], [None])), + (6,10--6,13)), (6,10--6,13)), [], None, (6,5--6,13), + { LeadingKeyword = Type (6,0--6,4) + EqualsRange = Some (6,8--6,9) + WithKeyword = None })], (6,0--6,13)); + 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,0)-(6,4) parse error Incomplete structured construct at or before this point in member definition diff --git a/tests/service/data/SyntaxTree/Type/Interface 01.fs b/tests/service/data/SyntaxTree/Type/Interface 01.fs new file mode 100644 index 00000000000..7364f174597 --- /dev/null +++ b/tests/service/data/SyntaxTree/Type/Interface 01.fs @@ -0,0 +1,6 @@ +module Module + +type T = + interface end + +() diff --git a/tests/service/data/SyntaxTree/Type/Interface 01.fs.bsl b/tests/service/data/SyntaxTree/Type/Interface 01.fs.bsl new file mode 100644 index 00000000000..27d0bc70287 --- /dev/null +++ b/tests/service/data/SyntaxTree/Type/Interface 01.fs.bsl @@ -0,0 +1,20 @@ +ImplFile + (ParsedImplFileInput + ("/root/Type/Interface 01.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 (Interface, [], (4,4--4,17)), [], None, + (3,5--4,17), { LeadingKeyword = Type (3,0--3,4) + EqualsRange = Some (3,7--3,8) + WithKeyword = None })], (3,0--4,17)); + 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/Interface 02.fs b/tests/service/data/SyntaxTree/Type/Interface 02.fs new file mode 100644 index 00000000000..05a0596bd93 --- /dev/null +++ b/tests/service/data/SyntaxTree/Type/Interface 02.fs @@ -0,0 +1,7 @@ +module Module + +type T = + interface + end + +() diff --git a/tests/service/data/SyntaxTree/Type/Interface 02.fs.bsl b/tests/service/data/SyntaxTree/Type/Interface 02.fs.bsl new file mode 100644 index 00000000000..9a516b1a4a4 --- /dev/null +++ b/tests/service/data/SyntaxTree/Type/Interface 02.fs.bsl @@ -0,0 +1,20 @@ +ImplFile + (ParsedImplFileInput + ("/root/Type/Interface 02.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 (Interface, [], (4,4--5,7)), [], None, (3,5--5,7), + { LeadingKeyword = Type (3,0--3,4) + EqualsRange = Some (3,7--3,8) + WithKeyword = None })], (3,0--5,7)); + 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 [])) diff --git a/tests/service/data/SyntaxTree/Type/Interface 03.fs b/tests/service/data/SyntaxTree/Type/Interface 03.fs new file mode 100644 index 00000000000..ed4c97d1b5c --- /dev/null +++ b/tests/service/data/SyntaxTree/Type/Interface 03.fs @@ -0,0 +1,8 @@ +module Module + +type T = + interface + abstract P: int + end + +() diff --git a/tests/service/data/SyntaxTree/Type/Interface 03.fs.bsl b/tests/service/data/SyntaxTree/Type/Interface 03.fs.bsl new file mode 100644 index 00000000000..b93004493d6 --- /dev/null +++ b/tests/service/data/SyntaxTree/Type/Interface 03.fs.bsl @@ -0,0 +1,41 @@ +ImplFile + (ParsedImplFileInput + ("/root/Type/Interface 03.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 + (Interface, + [AbstractSlot + (SynValSig + ([], SynIdent (P, None), + SynValTyparDecls (None, true), + LongIdent (SynLongIdent ([int], [], [None])), + SynValInfo ([], SynArgInfo ([], false, None)), false, + false, + PreXmlDoc ((5,8), FSharp.Compiler.Xml.XmlDocCollector), + None, None, (5,8--5,23), + { LeadingKeyword = Abstract (5,8--5,16) + InlineKeyword = None + WithKeyword = None + EqualsRange = None }), + { IsInstance = true + IsDispatchSlot = true + IsOverrideOrExplicitImpl = false + IsFinal = false + GetterOrSetterIsCompilerGenerated = false + MemberKind = PropertyGet }, (5,8--5,23), + { GetSetKeywords = None })], (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)); + 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 [])) diff --git a/tests/service/data/SyntaxTree/Type/Interface 04.fs b/tests/service/data/SyntaxTree/Type/Interface 04.fs new file mode 100644 index 00000000000..4c96474490e --- /dev/null +++ b/tests/service/data/SyntaxTree/Type/Interface 04.fs @@ -0,0 +1,7 @@ +module Module + +type T = interface + abstract P: int +end + +() diff --git a/tests/service/data/SyntaxTree/Type/Interface 04.fs.bsl b/tests/service/data/SyntaxTree/Type/Interface 04.fs.bsl new file mode 100644 index 00000000000..1a6d2a60721 --- /dev/null +++ b/tests/service/data/SyntaxTree/Type/Interface 04.fs.bsl @@ -0,0 +1,41 @@ +ImplFile + (ParsedImplFileInput + ("/root/Type/Interface 04.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 + (Interface, + [AbstractSlot + (SynValSig + ([], SynIdent (P, None), + SynValTyparDecls (None, true), + LongIdent (SynLongIdent ([int], [], [None])), + SynValInfo ([], SynArgInfo ([], false, None)), false, + false, + PreXmlDoc ((4,4), FSharp.Compiler.Xml.XmlDocCollector), + None, None, (4,4--4,19), + { LeadingKeyword = Abstract (4,4--4,12) + InlineKeyword = None + WithKeyword = None + EqualsRange = None }), + { IsInstance = true + IsDispatchSlot = true + IsOverrideOrExplicitImpl = false + IsFinal = false + GetterOrSetterIsCompilerGenerated = false + MemberKind = PropertyGet }, (4,4--4,19), + { GetSetKeywords = None })], (3,9--5,3)), [], None, + (3,5--5,3), { LeadingKeyword = Type (3,0--3,4) + EqualsRange = Some (3,7--3,8) + WithKeyword = None })], (3,0--5,3)); + 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 [])) diff --git a/tests/service/data/SyntaxTree/Type/Interface 05.fs b/tests/service/data/SyntaxTree/Type/Interface 05.fs new file mode 100644 index 00000000000..e43b2614d69 --- /dev/null +++ b/tests/service/data/SyntaxTree/Type/Interface 05.fs @@ -0,0 +1,7 @@ +module Module + +type T = + interface + abstract P: int + +() diff --git a/tests/service/data/SyntaxTree/Type/Interface 05.fs.bsl b/tests/service/data/SyntaxTree/Type/Interface 05.fs.bsl new file mode 100644 index 00000000000..b8c09362664 --- /dev/null +++ b/tests/service/data/SyntaxTree/Type/Interface 05.fs.bsl @@ -0,0 +1,13 @@ +ImplFile + (ParsedImplFileInput + ("/root/Type/Interface 05.fs", false, QualifiedNameOfFile Interface 05, [], + [], + [SynModuleOrNamespace + ([Interface 05], false, AnonModule, [], PreXmlDocEmpty, [], None, + (8,0--8,0), { LeadingKeyword = None })], (true, true), + { ConditionalDirectives = [] + CodeComments = [] }, set [])) + +(7,0)-(7,1) parse error Possible incorrect indentation: this token is offside of context started at position (3:1). Try indenting this token further or using standard formatting conventions. +(7,0)-(7,1) parse error Unexpected symbol '(' in type definition +(4,4)-(4,13) parse error Unmatched 'class', 'interface' or 'struct' diff --git a/tests/service/data/SyntaxTree/Type/Interface 06.fs b/tests/service/data/SyntaxTree/Type/Interface 06.fs new file mode 100644 index 00000000000..a6d8dda2a6f --- /dev/null +++ b/tests/service/data/SyntaxTree/Type/Interface 06.fs @@ -0,0 +1,6 @@ +module Module + +type T = interface + abstract P: int + +() diff --git a/tests/service/data/SyntaxTree/Type/Interface 06.fs.bsl b/tests/service/data/SyntaxTree/Type/Interface 06.fs.bsl new file mode 100644 index 00000000000..615ad4d56bc --- /dev/null +++ b/tests/service/data/SyntaxTree/Type/Interface 06.fs.bsl @@ -0,0 +1,13 @@ +ImplFile + (ParsedImplFileInput + ("/root/Type/Interface 06.fs", false, QualifiedNameOfFile Interface 06, [], + [], + [SynModuleOrNamespace + ([Interface 06], false, AnonModule, [], PreXmlDocEmpty, [], None, + (7,0--7,0), { LeadingKeyword = None })], (true, true), + { ConditionalDirectives = [] + CodeComments = [] }, set [])) + +(6,0)-(6,1) parse error Possible incorrect indentation: this token is offside of context started at position (3:1). Try indenting this token further or using standard formatting conventions. +(6,0)-(6,1) parse error Unexpected symbol '(' in type definition +(3,9)-(3,18) parse error Unmatched 'class', 'interface' or 'struct' diff --git a/tests/service/data/SyntaxTree/Type/Interface 07.fs b/tests/service/data/SyntaxTree/Type/Interface 07.fs new file mode 100644 index 00000000000..92d704524bf --- /dev/null +++ b/tests/service/data/SyntaxTree/Type/Interface 07.fs @@ -0,0 +1,8 @@ +module Module + +type T = + interface + abstract P: int + end + +() diff --git a/tests/service/data/SyntaxTree/Type/Interface 07.fs.bsl b/tests/service/data/SyntaxTree/Type/Interface 07.fs.bsl new file mode 100644 index 00000000000..2030a97bf39 --- /dev/null +++ b/tests/service/data/SyntaxTree/Type/Interface 07.fs.bsl @@ -0,0 +1,46 @@ +ImplFile + (ParsedImplFileInput + ("/root/Type/Interface 07.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, + [Interface + (FromParseError (4,13--4,13), None, None, (4,4--4,13)); + AbstractSlot + (SynValSig + ([], SynIdent (P, None), + SynValTyparDecls (None, true), + LongIdent (SynLongIdent ([int], [], [None])), + SynValInfo ([], SynArgInfo ([], false, None)), false, + false, + PreXmlDoc ((5,4), FSharp.Compiler.Xml.XmlDocCollector), + None, None, (5,4--5,19), + { LeadingKeyword = Abstract (5,4--5,12) + InlineKeyword = None + WithKeyword = None + EqualsRange = None }), + { IsInstance = true + IsDispatchSlot = true + IsOverrideOrExplicitImpl = false + IsFinal = false + GetterOrSetterIsCompilerGenerated = false + MemberKind = PropertyGet }, (5,4--5,19), + { GetSetKeywords = None })], (4,4--5,19)), [], None, + (3,5--5,19), { LeadingKeyword = Type (3,0--3,4) + EqualsRange = Some (3,7--3,8) + WithKeyword = None })], (3,0--5,19))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--5,19), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + CodeComments = [] }, set [])) + +(4,14)-(5,4) parse error Incomplete structured construct at or before this point in member definition +(6,4)-(6,7) parse error Unexpected keyword 'end' in type definition. Expected incomplete structured construct at or before this point or other token. +(8,0)-(8,1) parse error Unexpected symbol '(' in implementation file From 83198ae749dd178f3a13f0ee888389c0c2b357d3 Mon Sep 17 00:00:00 2001 From: Eugene Auduchinok Date: Thu, 7 Sep 2023 14:30:12 +0200 Subject: [PATCH 2/5] Update baseline --- .../LexicalFiltering/OffsideExceptions/OffsideExceptions.fs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/LexicalFiltering/OffsideExceptions/OffsideExceptions.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/LexicalFiltering/OffsideExceptions/OffsideExceptions.fs index bfd20903018..eeb47d2139d 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/LexicalFiltering/OffsideExceptions/OffsideExceptions.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/LexicalFiltering/OffsideExceptions/OffsideExceptions.fs @@ -480,6 +480,12 @@ raise (new Exception("exit 1")) EndLine = 5 EndColumn = 31 } Message = "Expecting member body" } + { Error = Error 3113 + Range = { StartLine = 6 + StartColumn = 9 + EndLine = 6 + EndColumn = 9 } + Message = "Unexpected end of input in type definition" } ] |> ignore [] From 4cdeab071ce7b16eacdc2fcc62feec8e1a55e39d Mon Sep 17 00:00:00 2001 From: Eugene Auduchinok Date: Thu, 7 Sep 2023 14:52:47 +0200 Subject: [PATCH 3/5] Replace context without additional warnings --- src/Compiler/SyntaxTree/LexFilter.fs | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/Compiler/SyntaxTree/LexFilter.fs b/src/Compiler/SyntaxTree/LexFilter.fs index fa9042b14a7..64bc43c6ebc 100644 --- a/src/Compiler/SyntaxTree/LexFilter.fs +++ b/src/Compiler/SyntaxTree/LexFilter.fs @@ -742,7 +742,7 @@ type LexFilterImpl ( //let indexerNotationWithoutDot = lexbuf.SupportsFeature LanguageFeature.IndexerNotationWithoutDot - let tryPushCtxt strict tokenTup (newCtxt: Context) = + let tryPushCtxt strict ignoreIndent tokenTup (newCtxt: Context) = let rec undentationLimit strict stack = match newCtxt, stack with | _, [] -> PositionWithColumn(newCtxt.StartPos, -1) @@ -960,8 +960,10 @@ type LexFilterImpl ( // These contexts can have their contents exactly aligning | _, (CtxtParen _ | CtxtFor _ | CtxtWhen _ | CtxtWhile _ | CtxtTypeDefns _ | CtxtMatch _ | CtxtModuleBody (_, true) | CtxtNamespaceBody _ | CtxtTry _ | CtxtMatchClauses _ | CtxtSeqBlock _ as limitCtxt :: _) -> PositionWithColumn(limitCtxt.StartPos, limitCtxt.StartCol) - + let isCorrectIndent = + if ignoreIndent then true else + match newCtxt with // Don't bother to check pushes of Vanilla blocks since we've // always already pushed a SeqBlock at this position. @@ -992,7 +994,7 @@ type LexFilterImpl ( true let pushCtxt tokenTup newCtxt = - tryPushCtxt false tokenTup newCtxt |> ignore + tryPushCtxt false false tokenTup newCtxt |> ignore let rec popCtxt() = match offsideStack with @@ -1008,6 +1010,10 @@ type LexFilterImpl ( let replaceCtxt p ctxt = popCtxt(); pushCtxt p ctxt + let replaceCtxtIgnoreIndent p ctxt = + popCtxt() + tryPushCtxt false true p ctxt |> ignore + //---------------------------------------------------------------------------- // Peek ahead at a token, either from the old lexer or from our delayedStack //-------------------------------------------------------------------------- @@ -2078,7 +2084,7 @@ type LexFilterImpl ( | EQUALS, CtxtTypeDefns(p, _) :: _ -> if debug then dprintf "CtxType: EQUALS, pushing CtxtSeqBlock\n" - replaceCtxt tokenTup (CtxtTypeDefns(p, Some tokenTup.EndPos)) + replaceCtxtIgnoreIndent tokenTup (CtxtTypeDefns(p, Some tokenTup.EndPos)) pushCtxtSeqBlock tokenTup AddBlockEnd returnToken tokenLexbufState token @@ -2203,7 +2209,7 @@ type LexFilterImpl ( let leadingBar = match (peekNextToken()) with BAR -> true | _ -> false if debug then dprintf "WITH, pushing CtxtMatchClauses, lookaheadTokenStartPos = %a, tokenStartPos = %a\n" outputPos lookaheadTokenStartPos outputPos tokenStartPos - tryPushCtxt strictIndentation lookaheadTokenTup (CtxtMatchClauses(leadingBar, lookaheadTokenStartPos)) |> ignore + tryPushCtxt strictIndentation false lookaheadTokenTup (CtxtMatchClauses(leadingBar, lookaheadTokenStartPos)) |> ignore returnToken tokenLexbufState OWITH @@ -2603,7 +2609,7 @@ type LexFilterImpl ( pushCtxtSeqBlockAt strictIndentation false fallbackToken (peekNextTokenTup ()) addBlockEnd and pushCtxtSeqBlockAt strict (useFallback: bool) (fallbackToken: TokenTup) (tokenTup: TokenTup) addBlockEnd = - let pushed = tryPushCtxt strict tokenTup (CtxtSeqBlock(FirstInSeqBlock, startPosOfTokenTup tokenTup, addBlockEnd)) + let pushed = tryPushCtxt strict false tokenTup (CtxtSeqBlock(FirstInSeqBlock, startPosOfTokenTup tokenTup, addBlockEnd)) if not pushed && useFallback then // The upcoming token isn't sufficiently indented to start the new context. // The parser expects proper contexts structure, so we push a new recovery context at the fallback token position. From 1a3343932919ed3aafa7f2cc27ad9b283397c6b7 Mon Sep 17 00:00:00 2001 From: Eugene Auduchinok Date: Thu, 7 Sep 2023 16:33:31 +0200 Subject: [PATCH 4/5] Undo `inherit` change --- src/Compiler/pars.fsy | 7 +++---- tests/service/data/SyntaxTree/Member/Inherit 03.fs.bsl | 5 +++-- tests/service/data/SyntaxTree/Member/Inherit 04.fs.bsl | 5 +++-- tests/service/data/SyntaxTree/Member/Inherit 05.fs.bsl | 4 +++- tests/service/data/SyntaxTree/Member/Inherit 08.fs.bsl | 4 +++- 5 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/Compiler/pars.fsy b/src/Compiler/pars.fsy index 00d132155e9..f10bb7be2e9 100644 --- a/src/Compiler/pars.fsy +++ b/src/Compiler/pars.fsy @@ -2300,10 +2300,9 @@ inheritsDefn: SynMemberDefn.ImplicitInherit($2, $4, $5, mDecl) } | INHERIT ends_coming_soon_or_recover - { let mInherit = rhs parseState 1 - if not $2 then errorR (Error(FSComp.SR.parsTypeNameCannotBeEmpty (), mInherit)) - let ty = SynType.FromParseError(mInherit.EndRange) - SynMemberDefn.Inherit(ty, None, mInherit) } + { let mDecl = (rhs parseState 1) + if not $2 then errorR (Error(FSComp.SR.parsTypeNameCannotBeEmpty (), mDecl)) + SynMemberDefn.Inherit(SynType.LongIdent(SynLongIdent([], [], [])), None, mDecl) } optAsSpec: | asSpec diff --git a/tests/service/data/SyntaxTree/Member/Inherit 03.fs.bsl b/tests/service/data/SyntaxTree/Member/Inherit 03.fs.bsl index aa982025cf9..eeab1704856 100644 --- a/tests/service/data/SyntaxTree/Member/Inherit 03.fs.bsl +++ b/tests/service/data/SyntaxTree/Member/Inherit 03.fs.bsl @@ -11,8 +11,9 @@ ImplFile false, None, (3,5--3,6)), ObjectModel (Unspecified, - [Inherit (FromParseError (4,11--4,11), None, (4,4--4,11))], - (4,4--4,11)), [], None, (3,5--4,11), + [Inherit + (LongIdent (SynLongIdent ([], [], [])), None, + (4,4--4,11))], (4,4--4,11)), [], None, (3,5--4,11), { LeadingKeyword = Type (3,0--3,4) EqualsRange = Some (3,7--3,8) WithKeyword = None })], (3,0--4,11))], diff --git a/tests/service/data/SyntaxTree/Member/Inherit 04.fs.bsl b/tests/service/data/SyntaxTree/Member/Inherit 04.fs.bsl index d88f5d29b11..9c03baf2b56 100644 --- a/tests/service/data/SyntaxTree/Member/Inherit 04.fs.bsl +++ b/tests/service/data/SyntaxTree/Member/Inherit 04.fs.bsl @@ -11,8 +11,9 @@ ImplFile false, None, (3,5--3,6)), ObjectModel (Unspecified, - [Inherit (FromParseError (4,11--4,11), None, (4,4--4,11))], - (4,4--4,11)), [], None, (3,5--4,11), + [Inherit + (LongIdent (SynLongIdent ([], [], [])), None, + (4,4--4,11))], (4,4--4,11)), [], None, (3,5--4,11), { LeadingKeyword = Type (3,0--3,4) EqualsRange = Some (3,7--3,8) WithKeyword = None })], (3,0--4,11)); diff --git a/tests/service/data/SyntaxTree/Member/Inherit 05.fs.bsl b/tests/service/data/SyntaxTree/Member/Inherit 05.fs.bsl index db4fed86e71..37100c58ad0 100644 --- a/tests/service/data/SyntaxTree/Member/Inherit 05.fs.bsl +++ b/tests/service/data/SyntaxTree/Member/Inherit 05.fs.bsl @@ -11,7 +11,9 @@ ImplFile false, None, (3,5--3,6)), ObjectModel (Unspecified, - [Inherit (FromParseError (4,11--4,11), None, (4,4--4,11)); + [Inherit + (LongIdent (SynLongIdent ([], [], [])), None, + (4,4--4,11)); Member (SynBinding (None, Normal, false, false, [], diff --git a/tests/service/data/SyntaxTree/Member/Inherit 08.fs.bsl b/tests/service/data/SyntaxTree/Member/Inherit 08.fs.bsl index 0635de73f53..28dcc0d77f9 100644 --- a/tests/service/data/SyntaxTree/Member/Inherit 08.fs.bsl +++ b/tests/service/data/SyntaxTree/Member/Inherit 08.fs.bsl @@ -11,7 +11,9 @@ ImplFile false, None, (3,5--3,6)), ObjectModel (Unspecified, - [Inherit (FromParseError (4,11--4,11), None, (4,4--4,11)); + [Inherit + (LongIdent (SynLongIdent ([], [], [])), None, + (4,4--4,11)); Member (SynBinding (None, Normal, false, false, [], From 348130086d6198fbdface46bd8ba537291af315f Mon Sep 17 00:00:00 2001 From: Eugene Auduchinok Date: Fri, 8 Sep 2023 11:17:13 +0200 Subject: [PATCH 5/5] Update baseline --- tests/fsharp/typecheck/sigs/neg71.vsbsl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/fsharp/typecheck/sigs/neg71.vsbsl b/tests/fsharp/typecheck/sigs/neg71.vsbsl index bbdad6e76ff..433b951a1d9 100644 --- a/tests/fsharp/typecheck/sigs/neg71.vsbsl +++ b/tests/fsharp/typecheck/sigs/neg71.vsbsl @@ -17,4 +17,6 @@ neg71.fsx(128,5,128,81): parse info FS3520: XML comment is not placed on a valid neg71.fsx(168,1,168,28): typecheck error FS0960: 'let' and 'do' bindings must come before member and interface definitions in type definitions -neg71.fsx(168,9,168,18): typecheck error FS0039: The value or constructor 'Simulator' is not defined. +neg71.fsx(104,14,104,14): typecheck error FS0887: The type ''a' is not an interface type + +neg71.fsx(104,14,104,14): typecheck error FS0909: All implemented interfaces should be declared on the initial declaration of the type