Skip to content

Commit f93b0ba

Browse files
authored
SyntaxTree: fix struct tuple range (#11316)
1 parent 99f261d commit f93b0ba

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/fsharp/pars.fsy

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4118,12 +4118,16 @@ atomicExpr:
41184118
// silent recovery
41194119
exprFromParseError (SynExpr.ArrayOrList (false, [ ], rhs parseState 1)), false }
41204120

4121-
| STRUCT LPAREN tupleExpr rparen
4122-
{ let exprs, commas = $3 in SynExpr.Tuple (true, List.rev exprs, List.rev commas, (commas.Head, exprs) ||> unionRangeWithListBy (fun e -> e.Range) ), false }
4123-
4124-
| STRUCT LPAREN tupleExpr recover
4125-
{ reportParseErrorAt (rhs parseState 2) (FSComp.SR.parsUnmatchedBracket());
4126-
let exprs, commas = $3 in SynExpr.Tuple (true, List.rev exprs, List.rev commas, (commas.Head, exprs) ||> unionRangeWithListBy (fun e -> e.Range) ), false }
4121+
| STRUCT LPAREN tupleExpr rparen
4122+
{ let exprs, commas = $3
4123+
let m = rhs2 parseState 1 4
4124+
SynExpr.Tuple (true, List.rev exprs, List.rev commas, m), false }
4125+
4126+
| STRUCT LPAREN tupleExpr recover
4127+
{ reportParseErrorAt (rhs parseState 2) (FSComp.SR.parsUnmatchedBracket());
4128+
let exprs, commas = $3
4129+
let m = (rhs parseState 1, exprs) ||> unionRangeWithListBy (fun e -> e.Range)
4130+
SynExpr.Tuple (true, List.rev exprs, List.rev commas, m), false }
41274131

41284132
| atomicExprAfterType
41294133
{ $1, false }

0 commit comments

Comments
 (0)