From 58b8fdb13736bb138523950633eedd602d5ad2cb Mon Sep 17 00:00:00 2001 From: Eugene Auduchinok Date: Tue, 19 Sep 2023 13:52:09 +0200 Subject: [PATCH] Parser: report error on missing first item in tuple expressions --- src/Compiler/pars.fsy | 1 + .../data/SyntaxTree/Expression/Tuple - Missing item 02.fs.bsl | 2 ++ .../data/SyntaxTree/Expression/Tuple - Missing item 03.fs.bsl | 2 ++ 3 files changed, 5 insertions(+) diff --git a/src/Compiler/pars.fsy b/src/Compiler/pars.fsy index 966d8dc393d..3b425da23e4 100644 --- a/src/Compiler/pars.fsy +++ b/src/Compiler/pars.fsy @@ -5173,6 +5173,7 @@ parenExpr: { let mComma = rhs parseState 2 let mLparen = rhs parseState 1 let mRparen = rhs parseState 3 + reportParseErrorAt mComma (FSComp.SR.parsExpectingExpression ()) let errorExpr = arbExpr ("tupleExpr3", mComma.EndRange) let mTuple = unionRanges mComma $3.Range let tupleExpr = diff --git a/tests/service/data/SyntaxTree/Expression/Tuple - Missing item 02.fs.bsl b/tests/service/data/SyntaxTree/Expression/Tuple - Missing item 02.fs.bsl index bb46bd40622..8478b3cd009 100644 --- a/tests/service/data/SyntaxTree/Expression/Tuple - Missing item 02.fs.bsl +++ b/tests/service/data/SyntaxTree/Expression/Tuple - Missing item 02.fs.bsl @@ -15,3 +15,5 @@ ImplFile (1,0--3,4), { LeadingKeyword = Module (1,0--1,6) })], (true, true), { ConditionalDirectives = [] CodeComments = [] }, set [])) + +(3,1)-(3,2) parse error Expecting expression diff --git a/tests/service/data/SyntaxTree/Expression/Tuple - Missing item 03.fs.bsl b/tests/service/data/SyntaxTree/Expression/Tuple - Missing item 03.fs.bsl index 13f70c4c778..8690087c0b8 100644 --- a/tests/service/data/SyntaxTree/Expression/Tuple - Missing item 03.fs.bsl +++ b/tests/service/data/SyntaxTree/Expression/Tuple - Missing item 03.fs.bsl @@ -15,3 +15,5 @@ ImplFile (1,0--3,6), { LeadingKeyword = Module (1,0--1,6) })], (true, true), { ConditionalDirectives = [] CodeComments = [] }, set [])) + +(3,1)-(3,2) parse error Expecting expression