Skip to content

Commit 3d5e700

Browse files
authored
Parser: fix tree for missing item in top tuple type (#15909)
1 parent d1ed630 commit 3d5e700

File tree

5 files changed

+39
-2
lines changed

5 files changed

+39
-2
lines changed

src/Compiler/SyntaxTree/SyntaxTreeOps.fs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -663,6 +663,8 @@ module SynInfo =
663663

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

666+
let emptySynArgInfo = SynArgInfo([], false, None)
667+
666668
/// Infer the syntactic information for a 'let' or 'member' definition, based on the argument pattern,
667669
/// any declared return information (e.g. .NET attributes on the return element), and the r.h.s. expression
668670
/// in the case of 'let' definitions.

src/Compiler/SyntaxTree/SyntaxTreeOps.fsi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,8 @@ module SynInfo =
257257

258258
val emptySynValData: SynValData
259259

260+
val emptySynArgInfo: SynArgInfo
261+
260262
/// Infer the syntactic information for a 'let' or 'member' definition, based on the argument pattern,
261263
/// any declared return information (e.g. .NET attributes on the return element), and the r.h.s. expression
262264
/// in the case of 'let' definitions.

src/Compiler/pars.fsy

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5690,7 +5690,7 @@ topTupleType:
56905690
let mStar = rhs parseState 2
56915691
let ty2 = SynType.FromParseError(mStar.EndRange)
56925692
let path = [SynTupleTypeSegment.Type ty1; SynTupleTypeSegment.Star mStar; SynTupleTypeSegment.Type ty2]
5693-
mkSynTypeTuple path, [argInfo] }
5693+
mkSynTypeTuple path, [argInfo; SynInfo.emptySynArgInfo] }
56945694

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

57185718
| STAR topTupleTypeElements
57195719
{ let mStar = rhs parseState 1
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module Module
2+
3+
val f: int * -> unit
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
SigFile
2+
(ParsedSigFileInput
3+
("/root/ModuleMember/Val 01.fsi", QualifiedNameOfFile Module, [], [],
4+
[SynModuleOrNamespaceSig
5+
([Module], false, NamedModule,
6+
[Val
7+
(SynValSig
8+
([], SynIdent (f, None), SynValTyparDecls (None, true),
9+
Fun
10+
(Tuple
11+
(false,
12+
[Type (LongIdent (SynLongIdent ([int], [], [None])));
13+
Star (3,11--3,12); Type (FromParseError (3,12--3,12))],
14+
(3,7--3,12)),
15+
LongIdent (SynLongIdent ([unit], [], [None])), (3,7--3,20),
16+
{ ArrowRange = (3,13--3,15) }),
17+
SynValInfo
18+
([[SynArgInfo ([], false, None); SynArgInfo ([], false, None)]],
19+
SynArgInfo ([], false, None)), false, false,
20+
PreXmlDoc ((3,0), FSharp.Compiler.Xml.XmlDocCollector), None,
21+
None, (3,0--3,20), { LeadingKeyword = Val (3,0--3,3)
22+
InlineKeyword = None
23+
WithKeyword = None
24+
EqualsRange = None }), (3,0--3,20))],
25+
PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None,
26+
(1,0--3,20), { LeadingKeyword = Module (1,0--1,6) })],
27+
{ ConditionalDirectives = []
28+
CodeComments = [] }, set []))
29+
30+
(3,13)-(3,15) parse error Unexpected symbol '->' in value signature

0 commit comments

Comments
 (0)