Skip to content

Parser: fix tree for missing item in top tuple type #15909

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/Compiler/SyntaxTree/SyntaxTreeOps.fs
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,8 @@ module SynInfo =

let emptySynValData = SynValData(None, emptySynValInfo, None, None)

let emptySynArgInfo = SynArgInfo([], false, None)

/// Infer the syntactic information for a 'let' or 'member' definition, based on the argument pattern,
/// any declared return information (e.g. .NET attributes on the return element), and the r.h.s. expression
/// in the case of 'let' definitions.
Expand Down
2 changes: 2 additions & 0 deletions src/Compiler/SyntaxTree/SyntaxTreeOps.fsi
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,8 @@ module SynInfo =

val emptySynValData: SynValData

val emptySynArgInfo: SynArgInfo

/// Infer the syntactic information for a 'let' or 'member' definition, based on the argument pattern,
/// any declared return information (e.g. .NET attributes on the return element), and the r.h.s. expression
/// in the case of 'let' definitions.
Expand Down
4 changes: 2 additions & 2 deletions src/Compiler/pars.fsy
Original file line number Diff line number Diff line change
Expand Up @@ -5690,7 +5690,7 @@ topTupleType:
let mStar = rhs parseState 2
let ty2 = SynType.FromParseError(mStar.EndRange)
let path = [SynTupleTypeSegment.Type ty1; SynTupleTypeSegment.Star mStar; SynTupleTypeSegment.Type ty2]
mkSynTypeTuple path, [argInfo] }
mkSynTypeTuple path, [argInfo; SynInfo.emptySynArgInfo] }

| STAR topTupleTypeElements
{ let mStar = rhs parseState 1
Expand All @@ -5713,7 +5713,7 @@ topTupleTypeElements:
{ let ty1, argInfo = $1
let mStar = rhs parseState 2
let ty2 = SynType.FromParseError(mStar.EndRange)
[(SynTupleTypeSegment.Type ty1, Some argInfo); (SynTupleTypeSegment.Star mStar, None); (SynTupleTypeSegment.Type ty2, None)] }
[SynTupleTypeSegment.Type ty1, Some argInfo; SynTupleTypeSegment.Star mStar, None; SynTupleTypeSegment.Type ty2, Some SynInfo.emptySynArgInfo] }

| STAR topTupleTypeElements
{ let mStar = rhs parseState 1
Expand Down
3 changes: 3 additions & 0 deletions tests/service/data/SyntaxTree/ModuleMember/Val 01.fsi
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module Module

val f: int * -> unit
30 changes: 30 additions & 0 deletions tests/service/data/SyntaxTree/ModuleMember/Val 01.fsi.bsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
SigFile
(ParsedSigFileInput
("/root/ModuleMember/Val 01.fsi", QualifiedNameOfFile Module, [], [],
[SynModuleOrNamespaceSig
([Module], false, NamedModule,
[Val
(SynValSig
([], SynIdent (f, None), SynValTyparDecls (None, true),
Fun
(Tuple
(false,
[Type (LongIdent (SynLongIdent ([int], [], [None])));
Star (3,11--3,12); Type (FromParseError (3,12--3,12))],
(3,7--3,12)),
LongIdent (SynLongIdent ([unit], [], [None])), (3,7--3,20),
{ ArrowRange = (3,13--3,15) }),
SynValInfo
([[SynArgInfo ([], false, None); SynArgInfo ([], false, None)]],
SynArgInfo ([], false, None)), false, false,
PreXmlDoc ((3,0), FSharp.Compiler.Xml.XmlDocCollector), None,
None, (3,0--3,20), { LeadingKeyword = Val (3,0--3,3)
InlineKeyword = None
WithKeyword = None
EqualsRange = None }), (3,0--3,20))],
PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None,
(1,0--3,20), { LeadingKeyword = Module (1,0--1,6) })],
{ ConditionalDirectives = []
CodeComments = [] }, set []))

(3,13)-(3,15) parse error Unexpected symbol '->' in value signature