diff --git a/src/Compiler/pars.fsy b/src/Compiler/pars.fsy index 496d70bae62..b4da5e4b249 100644 --- a/src/Compiler/pars.fsy +++ b/src/Compiler/pars.fsy @@ -3440,10 +3440,13 @@ declExprBlock: /* for these it only inserts a trailing ORIGHT_BLOCK_END */ typedSequentialExprBlockR: | typedSequentialExpr ORIGHT_BLOCK_END - { $1 } + { fun _ -> $1 } | typedSequentialExpr - { $1 } + { fun _ -> $1 } + + | recover + { fun mStart -> arbExpr ("typedSequentialExprBlockR", mStart) } typedSequentialExpr: | sequentialExpr COLON typeWithTypeConstraints @@ -3573,36 +3576,49 @@ declExpr: { if not $3 then reportParseErrorAt (rhs parseState 1) (FSComp.SR.parsUnexpectedEndOfFileMatch()) // Produce approximate expression during error recovery exprFromParseError $2 } - - | TRY typedSequentialExprBlockR withClauses %prec expr_try - { let mTry = (rhs parseState 1) + + | TRY typedSequentialExprBlockR withClauses %prec expr_try + { let mTry = rhs parseState 1 + let expr = $2 mTry let spTry = DebugPointAtTry.Yes mTry - let mWith, (clauses, mLast) = $3 + let mWith, (clauses, mLast) = $3 let spWith = DebugPointAtWith.Yes mWith - let mTryToWith = unionRanges mTry mWith - let mWithToLast = unionRanges mWith mLast + let mTryToWith = unionRanges mTry mWith + let mWithToLast = unionRanges mWith mLast let mTryToLast = unionRanges mTry mLast - let trivia: SynExprTryWithTrivia = + let trivia: SynExprTryWithTrivia = { TryKeyword = mTry TryToWithRange = mTryToWith WithKeyword = mWith WithToEndRange = mWithToLast } - SynExpr.TryWith ($2, clauses, mTryToLast, spTry, spWith, trivia) } - - | TRY typedSequentialExprBlockR recover %prec expr_try - { // Produce approximate expression during error recovery - // Include any expressions to make sure they gets type checked in case that generates useful results for intellisense - if not $3 then reportParseErrorAt (rhs parseState 1) (FSComp.SR.parsUnexpectedEndOfFileTry()) - exprFromParseError $2 } + SynExpr.TryWith (expr, clauses, mTryToLast, spTry, spWith, trivia) } - | TRY typedSequentialExprBlockR FINALLY typedSequentialExprBlock %prec expr_try - { let mTry = rhs parseState 1 + | TRY typedSequentialExprBlockR recover %prec expr_try + { let mTry = rhs parseState 1 + let spTry = DebugPointAtTry.Yes mTry + if not $3 then reportParseErrorAt mTry (FSComp.SR.parsUnexpectedEndOfFileTry ()) + let expr = $2 mTry + let mExpr = expr.Range + let mEnd = mExpr.EndRange + let spWith = DebugPointAtWith.Yes mEnd + let mWhole = unionRanges mTry mEnd + let trivia: SynExprTryWithTrivia = + { TryKeyword = mTry + TryToWithRange = mWhole + WithKeyword = mEnd + WithToEndRange = mWhole } + SynExpr.TryWith (expr, [], mWhole, spTry, spWith, trivia) } + + | TRY typedSequentialExprBlockR FINALLY typedSequentialExprBlock %prec expr_try + { let mTry = rhs parseState 1 + let tryExpr = $2 mTry let spTry = DebugPointAtTry.Yes mTry let mFinally = rhs parseState 3 + let finallyExpr = $4 let spFinally = DebugPointAtFinally.Yes mFinally - let mTryToLast = unionRanges mTry $4.Range + let mTryToLast = unionRanges mTry finallyExpr.Range let trivia = { TryKeyword = mTry; FinallyKeyword = mFinally } - SynExpr.TryFinally ($2, $4, mTryToLast, spTry, spFinally, trivia) } + SynExpr.TryFinally (tryExpr, finallyExpr, mTryToLast, spTry, spFinally, trivia) } | IF declExpr ifExprCases %prec expr_if { let mIf = rhs parseState 1 @@ -3856,9 +3872,11 @@ declExpr: | FIXED declExpr { SynExpr.Fixed ($2, (unionRanges (rhs parseState 1) $2.Range)) } - | RARROW typedSequentialExprBlockR - { errorR(Error(FSComp.SR.parsArrowUseIsLimited(), lhs parseState)) - SynExpr.YieldOrReturn ((true, true), $2, (unionRanges (rhs parseState 1) $2.Range)) } + | RARROW typedSequentialExprBlockR + { errorR(Error(FSComp.SR.parsArrowUseIsLimited(), lhs parseState)) + let mArrow = rhs parseState 1 + let expr = $2 mArrow + SynExpr.YieldOrReturn ((true, true), expr, (unionRanges mArrow expr.Range)) } | declExpr COLON_QMARK typ { SynExpr.TypeTest ($1, $3, unionRanges $1.Range $3.Range) } @@ -4156,11 +4174,12 @@ patternGuard: | /* EMPTY */ { None } -patternResult: - | RARROW typedSequentialExprBlockR - { let mArrow = rhs parseState 1 - mArrow, $2 } - +patternResult: + | RARROW typedSequentialExprBlockR + { let mArrow = rhs parseState 1 + let expr = $2 mArrow + mArrow, expr } + ifExprCases: | ifExprThen ifExprElifs { let exprThen, mThen = $1 @@ -4667,8 +4686,10 @@ computationExpr: { $1.Range, (fun mLhs -> SynExpr.ComputationExpr (false, $1, mLhs)) } arrowThenExprR: - | RARROW typedSequentialExprBlockR - { SynExpr.YieldOrReturn ((true, false), $2, unionRanges (rhs parseState 1) $2.Range) } + | RARROW typedSequentialExprBlockR + { let mArrow = rhs parseState 1 + let expr = $2 mArrow + SynExpr.YieldOrReturn ((true, false), expr, unionRanges mArrow expr.Range) } forLoopBinder: | parenPattern IN declExpr @@ -5009,15 +5030,17 @@ anonLambdaExpr: mkSynFunMatchLambdas parseState.SynArgNameGenerator false mAll $2 mArrow (arbExpr("anonLambdaExpr1", (rhs parseState 4))) } | OFUN atomicPatterns RARROW typedSequentialExprBlockR OEND - { let mAll = unionRanges (rhs parseState 1) $4.Range - let mArrow = Some (rhs parseState 3) - mkSynFunMatchLambdas parseState.SynArgNameGenerator false mAll $2 mArrow $4 } + { let mArrow = rhs parseState 3 + let expr = $4 mArrow + let mAll = unionRanges (rhs parseState 1) expr.Range + mkSynFunMatchLambdas parseState.SynArgNameGenerator false mAll $2 (Some mArrow) expr } | OFUN atomicPatterns RARROW typedSequentialExprBlockR recover - { if not $5 then reportParseErrorAt (rhs parseState 1) (FSComp.SR.parsUnexpectedEndOfFileFunBody()); - let mAll = unionRanges (rhs parseState 1) $4.Range - let mArrow = Some (rhs parseState 3) - exprFromParseError (mkSynFunMatchLambdas parseState.SynArgNameGenerator false mAll $2 mArrow $4) } + { if not $5 then reportParseErrorAt (rhs parseState 1) (FSComp.SR.parsUnexpectedEndOfFileFunBody ()) + let mArrow = rhs parseState 3 + let expr = $4 mArrow + let mAll = unionRanges (rhs parseState 1) expr.Range + exprFromParseError (mkSynFunMatchLambdas parseState.SynArgNameGenerator false mAll $2 (Some mArrow) expr) } | OFUN atomicPatterns RARROW ORIGHT_BLOCK_END OEND { let mLambda = rhs2 parseState 1 3 diff --git a/tests/service/data/SyntaxTree/Expression/Lambda - Missing expr 01.fs b/tests/service/data/SyntaxTree/Expression/Lambda - Missing expr 01.fs new file mode 100644 index 00000000000..9810ae0fb08 --- /dev/null +++ b/tests/service/data/SyntaxTree/Expression/Lambda - Missing expr 01.fs @@ -0,0 +1,3 @@ +module Module + +(fun _ -> ) diff --git a/tests/service/data/SyntaxTree/Expression/Lambda - Missing expr 01.fs.bsl b/tests/service/data/SyntaxTree/Expression/Lambda - Missing expr 01.fs.bsl new file mode 100644 index 00000000000..dde40e65bd4 --- /dev/null +++ b/tests/service/data/SyntaxTree/Expression/Lambda - Missing expr 01.fs.bsl @@ -0,0 +1,25 @@ +ImplFile + (ParsedImplFileInput + ("/root/Expression/Lambda - Missing expr 01.fs", false, + QualifiedNameOfFile Module, [], [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Expr + (Paren + (Lambda + (false, false, + SimplePats + ([Id (_arg1, None, true, false, false, (3,5--3,6))], + (3,5--3,6)), + ArbitraryAfterError ("anonLambdaExpr2", (3,9--3,9)), + Some + ([Wild (3,5--3,6)], + ArbitraryAfterError ("anonLambdaExpr2", (3,9--3,9))), + (3,1--3,9), { ArrowRange = Some (3,7--3,9) }), (3,0--3,1), + Some (3,10--3,11), (3,0--3,11)), (3,0--3,11))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--3,11), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + CodeComments = [] }, set [])) + +(3,1)-(3,9) parse error Missing function body diff --git a/tests/service/data/SyntaxTree/Expression/Lambda - Missing expr 02.fs b/tests/service/data/SyntaxTree/Expression/Lambda - Missing expr 02.fs new file mode 100644 index 00000000000..2fec6da4cbf --- /dev/null +++ b/tests/service/data/SyntaxTree/Expression/Lambda - Missing expr 02.fs @@ -0,0 +1,3 @@ +module Module + +fun _ -> diff --git a/tests/service/data/SyntaxTree/Expression/Lambda - Missing expr 02.fs.bsl b/tests/service/data/SyntaxTree/Expression/Lambda - Missing expr 02.fs.bsl new file mode 100644 index 00000000000..57f88ea64e5 --- /dev/null +++ b/tests/service/data/SyntaxTree/Expression/Lambda - Missing expr 02.fs.bsl @@ -0,0 +1,24 @@ +ImplFile + (ParsedImplFileInput + ("/root/Expression/Lambda - Missing expr 02.fs", false, + QualifiedNameOfFile Module, [], [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Expr + (Lambda + (false, false, + SimplePats + ([Id (_arg1, None, true, false, false, (3,4--3,5))], + (3,4--3,5)), + ArbitraryAfterError ("anonLambdaExpr2", (3,8--3,8)), + Some + ([Wild (3,4--3,5)], + ArbitraryAfterError ("anonLambdaExpr2", (3,8--3,8))), + (3,0--3,8), { ArrowRange = Some (3,6--3,8) }), (3,0--3,8))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--3,8), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + CodeComments = [] }, set [])) + +(4,0)-(4,0) parse warning Possible incorrect indentation: this token is offside of context started at position (1:1). Try indenting this token further or using standard formatting conventions. +(3,0)-(3,8) parse error Missing function body diff --git a/tests/service/data/SyntaxTree/Expression/Lambda 01.fs b/tests/service/data/SyntaxTree/Expression/Lambda 01.fs new file mode 100644 index 00000000000..b419ec23d3f --- /dev/null +++ b/tests/service/data/SyntaxTree/Expression/Lambda 01.fs @@ -0,0 +1,3 @@ +module Module + +(fun _ -> ()) diff --git a/tests/service/data/SyntaxTree/Expression/Lambda 01.fs.bsl b/tests/service/data/SyntaxTree/Expression/Lambda 01.fs.bsl new file mode 100644 index 00000000000..edfb74fc66c --- /dev/null +++ b/tests/service/data/SyntaxTree/Expression/Lambda 01.fs.bsl @@ -0,0 +1,19 @@ +ImplFile + (ParsedImplFileInput + ("/root/Expression/Lambda 01.fs", false, QualifiedNameOfFile Module, [], [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Expr + (Paren + (Lambda + (false, false, + SimplePats + ([Id (_arg1, None, true, false, false, (3,5--3,6))], + (3,5--3,6)), Const (Unit, (3,10--3,12)), + Some ([Wild (3,5--3,6)], Const (Unit, (3,10--3,12))), + (3,1--3,12), { ArrowRange = Some (3,7--3,9) }), (3,0--3,1), + Some (3,12--3,13), (3,0--3,13)), (3,0--3,13))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--3,13), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/Expression/Lambda 02.fs b/tests/service/data/SyntaxTree/Expression/Lambda 02.fs new file mode 100644 index 00000000000..8df9c48f803 --- /dev/null +++ b/tests/service/data/SyntaxTree/Expression/Lambda 02.fs @@ -0,0 +1,3 @@ +module Module + +fun _ -> () diff --git a/tests/service/data/SyntaxTree/Expression/Lambda 02.fs.bsl b/tests/service/data/SyntaxTree/Expression/Lambda 02.fs.bsl new file mode 100644 index 00000000000..06559d39a01 --- /dev/null +++ b/tests/service/data/SyntaxTree/Expression/Lambda 02.fs.bsl @@ -0,0 +1,17 @@ +ImplFile + (ParsedImplFileInput + ("/root/Expression/Lambda 02.fs", false, QualifiedNameOfFile Module, [], [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Expr + (Lambda + (false, false, + SimplePats + ([Id (_arg1, None, true, false, false, (3,4--3,5))], + (3,4--3,5)), Const (Unit, (3,9--3,11)), + Some ([Wild (3,4--3,5)], Const (Unit, (3,9--3,11))), + (3,0--3,11), { ArrowRange = Some (3,6--3,8) }), (3,0--3,11))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--3,11), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/Expression/List - Comprehension 01.fs b/tests/service/data/SyntaxTree/Expression/List - Comprehension 01.fs new file mode 100644 index 00000000000..7bc42e26a3d --- /dev/null +++ b/tests/service/data/SyntaxTree/Expression/List - Comprehension 01.fs @@ -0,0 +1,3 @@ +module Module + +[ for x in [] -> () ] diff --git a/tests/service/data/SyntaxTree/Expression/List - Comprehension 01.fs.bsl b/tests/service/data/SyntaxTree/Expression/List - Comprehension 01.fs.bsl new file mode 100644 index 00000000000..7cc9b348848 --- /dev/null +++ b/tests/service/data/SyntaxTree/Expression/List - Comprehension 01.fs.bsl @@ -0,0 +1,20 @@ +ImplFile + (ParsedImplFileInput + ("/root/Expression/List - Comprehension 01.fs", false, + QualifiedNameOfFile Module, [], [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Expr + (ArrayOrListComputed + (false, + ForEach + (Yes (3,2--3,5), Yes (3,8--3,10), SeqExprOnly true, true, + Named (SynIdent (x, None), false, None, (3,6--3,7)), + ArrayOrList (false, [], (3,11--3,13)), + YieldOrReturn + ((true, false), Const (Unit, (3,17--3,19)), (3,14--3,19)), + (3,2--3,19)), (3,0--3,21)), (3,0--3,21))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--3,21), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/Expression/List - Comprehension 02.fs b/tests/service/data/SyntaxTree/Expression/List - Comprehension 02.fs new file mode 100644 index 00000000000..fa58258ceb7 --- /dev/null +++ b/tests/service/data/SyntaxTree/Expression/List - Comprehension 02.fs @@ -0,0 +1,3 @@ +module Module + +[ for x in [] -> ] diff --git a/tests/service/data/SyntaxTree/Expression/List - Comprehension 02.fs.bsl b/tests/service/data/SyntaxTree/Expression/List - Comprehension 02.fs.bsl new file mode 100644 index 00000000000..e3f3af166c5 --- /dev/null +++ b/tests/service/data/SyntaxTree/Expression/List - Comprehension 02.fs.bsl @@ -0,0 +1,24 @@ +ImplFile + (ParsedImplFileInput + ("/root/Expression/List - Comprehension 02.fs", false, + QualifiedNameOfFile Module, [], [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Expr + (ArrayOrListComputed + (false, + ForEach + (Yes (3,2--3,5), Yes (3,8--3,10), SeqExprOnly true, true, + Named (SynIdent (x, None), false, None, (3,6--3,7)), + ArrayOrList (false, [], (3,11--3,13)), + YieldOrReturn + ((true, false), + ArbitraryAfterError + ("typedSequentialExprBlockR", (3,14--3,16)), + (3,14--3,16)), (3,2--3,16)), (3,0--3,18)), (3,0--3,18))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--3,18), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + CodeComments = [] }, set [])) + +(3,17)-(3,18) parse error Incomplete structured construct at or before this point in expression diff --git a/tests/service/data/SyntaxTree/Expression/Rarrow 01.fs b/tests/service/data/SyntaxTree/Expression/Rarrow 01.fs new file mode 100644 index 00000000000..7cbee69d3e6 --- /dev/null +++ b/tests/service/data/SyntaxTree/Expression/Rarrow 01.fs @@ -0,0 +1,3 @@ +module Module + +-> 1 diff --git a/tests/service/data/SyntaxTree/Expression/Rarrow 01.fs.bsl b/tests/service/data/SyntaxTree/Expression/Rarrow 01.fs.bsl new file mode 100644 index 00000000000..9d7e7af2125 --- /dev/null +++ b/tests/service/data/SyntaxTree/Expression/Rarrow 01.fs.bsl @@ -0,0 +1,15 @@ +ImplFile + (ParsedImplFileInput + ("/root/Expression/Rarrow 01.fs", false, QualifiedNameOfFile Module, [], [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Expr + (YieldOrReturn + ((true, true), Const (Int32 1, (3,3--3,4)), (3,0--3,4)), + (3,0--3,4))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--3,4), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + CodeComments = [] }, set [])) + +(3,0)-(3,4) parse error The use of '->' in sequence and computation expressions is limited to the form 'for pat in expr -> expr'. Use the syntax 'for ... in ... do ... yield...' to generate elements in more complex sequence expressions. diff --git a/tests/service/data/SyntaxTree/Expression/Rarrow 02.fs b/tests/service/data/SyntaxTree/Expression/Rarrow 02.fs new file mode 100644 index 00000000000..200da968094 --- /dev/null +++ b/tests/service/data/SyntaxTree/Expression/Rarrow 02.fs @@ -0,0 +1,3 @@ +module Module + +-> diff --git a/tests/service/data/SyntaxTree/Expression/Rarrow 02.fs.bsl b/tests/service/data/SyntaxTree/Expression/Rarrow 02.fs.bsl new file mode 100644 index 00000000000..7f2dacb2a83 --- /dev/null +++ b/tests/service/data/SyntaxTree/Expression/Rarrow 02.fs.bsl @@ -0,0 +1,17 @@ +ImplFile + (ParsedImplFileInput + ("/root/Expression/Rarrow 02.fs", false, QualifiedNameOfFile Module, [], [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Expr + (YieldOrReturn + ((true, true), + ArbitraryAfterError ("typedSequentialExprBlockR", (3,0--3,2)), + (3,0--3,2)), (3,0--3,2))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--3,2), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + CodeComments = [] }, set [])) + +(4,0)-(4,0) parse error Incomplete structured construct at or before this point in expression +(3,0)-(4,0) parse error The use of '->' in sequence and computation expressions is limited to the form 'for pat in expr -> expr'. Use the syntax 'for ... in ... do ... yield...' to generate elements in more complex sequence expressions. diff --git a/tests/service/data/SyntaxTree/Expression/Rarrow 03.fs b/tests/service/data/SyntaxTree/Expression/Rarrow 03.fs new file mode 100644 index 00000000000..3434ca62d1e --- /dev/null +++ b/tests/service/data/SyntaxTree/Expression/Rarrow 03.fs @@ -0,0 +1,3 @@ +module Module + +-> -> diff --git a/tests/service/data/SyntaxTree/Expression/Rarrow 03.fs.bsl b/tests/service/data/SyntaxTree/Expression/Rarrow 03.fs.bsl new file mode 100644 index 00000000000..f551649cdb8 --- /dev/null +++ b/tests/service/data/SyntaxTree/Expression/Rarrow 03.fs.bsl @@ -0,0 +1,21 @@ +ImplFile + (ParsedImplFileInput + ("/root/Expression/Rarrow 03.fs", false, QualifiedNameOfFile Module, [], [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Expr + (YieldOrReturn + ((true, true), + YieldOrReturn + ((true, true), + ArbitraryAfterError + ("typedSequentialExprBlockR", (3,3--3,5)), (3,3--3,5)), + (3,0--3,5)), (3,0--3,5))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--3,5), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + CodeComments = [] }, set [])) + +(4,0)-(4,0) parse error Incomplete structured construct at or before this point in expression +(3,3)-(4,0) parse error The use of '->' in sequence and computation expressions is limited to the form 'for pat in expr -> expr'. Use the syntax 'for ... in ... do ... yield...' to generate elements in more complex sequence expressions. +(3,0)-(4,0) parse error The use of '->' in sequence and computation expressions is limited to the form 'for pat in expr -> expr'. Use the syntax 'for ... in ... do ... yield...' to generate elements in more complex sequence expressions. diff --git a/tests/service/data/SyntaxTree/Expression/Try with - Missing expr 01.fs b/tests/service/data/SyntaxTree/Expression/Try with - Missing expr 01.fs new file mode 100644 index 00000000000..153f12ceb27 --- /dev/null +++ b/tests/service/data/SyntaxTree/Expression/Try with - Missing expr 01.fs @@ -0,0 +1,4 @@ +module Module + +try +with _ -> () diff --git a/tests/service/data/SyntaxTree/Expression/Try with - Missing expr 01.fs.bsl b/tests/service/data/SyntaxTree/Expression/Try with - Missing expr 01.fs.bsl new file mode 100644 index 00000000000..12da5ed09a5 --- /dev/null +++ b/tests/service/data/SyntaxTree/Expression/Try with - Missing expr 01.fs.bsl @@ -0,0 +1,24 @@ +ImplFile + (ParsedImplFileInput + ("/root/Expression/Try with - Missing expr 01.fs", false, + QualifiedNameOfFile Module, [], [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Expr + (TryWith + (ArbitraryAfterError ("typedSequentialExprBlockR", (3,0--3,3)), + [SynMatchClause + (Wild (4,5--4,6), None, Const (Unit, (4,10--4,12)), + (4,5--4,12), Yes, { ArrowRange = Some (4,7--4,9) + BarRange = None })], (3,0--4,12), + Yes (3,0--3,3), Yes (4,0--4,4), + { TryKeyword = (3,0--3,3) + TryToWithRange = (3,0--4,4) + WithKeyword = (4,0--4,4) + WithToEndRange = (4,0--4,12) }), (3,0--4,12))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--4,12), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + CodeComments = [] }, set [])) + +(4,0)-(4,4) parse error Incomplete structured construct at or before this point in expression diff --git a/tests/service/data/SyntaxTree/Expression/Try with - Missing expr 02.fs b/tests/service/data/SyntaxTree/Expression/Try with - Missing expr 02.fs new file mode 100644 index 00000000000..196aa44511e --- /dev/null +++ b/tests/service/data/SyntaxTree/Expression/Try with - Missing expr 02.fs @@ -0,0 +1,4 @@ +module Module + +try +with _ -> diff --git a/tests/service/data/SyntaxTree/Expression/Try with - Missing expr 02.fs.bsl b/tests/service/data/SyntaxTree/Expression/Try with - Missing expr 02.fs.bsl new file mode 100644 index 00000000000..22f976bd705 --- /dev/null +++ b/tests/service/data/SyntaxTree/Expression/Try with - Missing expr 02.fs.bsl @@ -0,0 +1,27 @@ +ImplFile + (ParsedImplFileInput + ("/root/Expression/Try with - Missing expr 02.fs", false, + QualifiedNameOfFile Module, [], [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Expr + (TryWith + (ArbitraryAfterError ("typedSequentialExprBlockR", (3,0--3,3)), + [SynMatchClause + (Wild (4,5--4,6), None, + ArbitraryAfterError + ("typedSequentialExprBlockR", (4,7--4,9)), (4,5--4,9), + Yes, { ArrowRange = Some (4,7--4,9) + BarRange = None })], (3,0--4,9), Yes (3,0--3,3), + Yes (4,0--4,4), { TryKeyword = (3,0--3,3) + TryToWithRange = (3,0--4,4) + WithKeyword = (4,0--4,4) + WithToEndRange = (4,0--4,9) }), (3,0--4,9))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--4,9), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + CodeComments = [] }, set [])) + +(4,0)-(4,4) parse error Incomplete structured construct at or before this point in expression +(5,0)-(5,0) parse warning Possible incorrect indentation: this token is offside of context started at position (3:1). Try indenting this token further or using standard formatting conventions. +(5,0)-(5,0) parse error Incomplete structured construct at or before this point in pattern matching diff --git a/tests/service/data/SyntaxTree/Expression/Try with - Missing expr 03.fs b/tests/service/data/SyntaxTree/Expression/Try with - Missing expr 03.fs new file mode 100644 index 00000000000..fbf5dd7a340 --- /dev/null +++ b/tests/service/data/SyntaxTree/Expression/Try with - Missing expr 03.fs @@ -0,0 +1,3 @@ +module Module + +try diff --git a/tests/service/data/SyntaxTree/Expression/Try with - Missing expr 03.fs.bsl b/tests/service/data/SyntaxTree/Expression/Try with - Missing expr 03.fs.bsl new file mode 100644 index 00000000000..0cd9ebc63c7 --- /dev/null +++ b/tests/service/data/SyntaxTree/Expression/Try with - Missing expr 03.fs.bsl @@ -0,0 +1,22 @@ +ImplFile + (ParsedImplFileInput + ("/root/Expression/Try with - Missing expr 03.fs", false, + QualifiedNameOfFile Module, [], [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Expr + (TryWith + (ArbitraryAfterError ("typedSequentialExprBlockR", (3,0--3,3)), + [], (3,0--3,3), Yes (3,0--3,3), Yes (3,3--3,3), + { TryKeyword = (3,0--3,3) + TryToWithRange = (3,0--3,3) + WithKeyword = (3,3--3,3) + WithToEndRange = (3,0--3,3) }), (3,0--3,3))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--3,3), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + CodeComments = [] }, set [])) + +(4,0)-(4,0) parse warning Possible incorrect indentation: this token is offside of context started at position (3:1). Try indenting this token further or using standard formatting conventions. +(4,0)-(4,0) parse error Incomplete structured construct at or before this point in expression +(3,0)-(3,3) parse error Unexpected end of input in 'try' expression. Expected 'try with ' or 'try finally '. diff --git a/tests/service/data/SyntaxTree/Expression/Try with - Missing expr 04.fs b/tests/service/data/SyntaxTree/Expression/Try with - Missing expr 04.fs new file mode 100644 index 00000000000..88b8986701c --- /dev/null +++ b/tests/service/data/SyntaxTree/Expression/Try with - Missing expr 04.fs @@ -0,0 +1,5 @@ +module Module + +try + +let _ = () diff --git a/tests/service/data/SyntaxTree/Expression/Try with - Missing expr 04.fs.bsl b/tests/service/data/SyntaxTree/Expression/Try with - Missing expr 04.fs.bsl new file mode 100644 index 00000000000..94ee31ce8d1 --- /dev/null +++ b/tests/service/data/SyntaxTree/Expression/Try with - Missing expr 04.fs.bsl @@ -0,0 +1,34 @@ +ImplFile + (ParsedImplFileInput + ("/root/Expression/Try with - Missing expr 04.fs", false, + QualifiedNameOfFile Module, [], [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Expr + (TryWith + (LetOrUse + (false, false, + [SynBinding + (None, Normal, false, false, [], + PreXmlDoc ((5,0), FSharp.Compiler.Xml.XmlDocCollector), + SynValData + (None, SynValInfo ([], SynArgInfo ([], false, None)), + None), Wild (5,4--5,5), None, + Const (Unit, (5,8--5,10)), (5,4--5,5), Yes (5,0--5,10), + { LeadingKeyword = Let (5,0--5,3) + InlineKeyword = None + EqualsRange = Some (5,6--5,7) })], + ArbitraryAfterError ("seqExpr", (5,10--5,10)), (5,0--5,10), + { InKeyword = None }), [], (3,0--5,10), Yes (3,0--3,3), + Yes (5,10--5,10), { TryKeyword = (3,0--3,3) + TryToWithRange = (3,0--5,10) + WithKeyword = (5,10--5,10) + WithToEndRange = (3,0--5,10) }), + (3,0--5,10))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--5,10), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + CodeComments = [] }, set [])) + +(5,0)-(5,3) parse error The block following this 'let' is unfinished. Every code block is an expression and must have a result. 'let' cannot be the final code element in a block. Consider giving this block an explicit result. +(6,0)-(6,0) parse error Incomplete structured construct at or before this point in expression. Expected 'finally', 'with' or other token. diff --git a/tests/service/data/SyntaxTree/Expression/Try with - Missing expr 05.fs b/tests/service/data/SyntaxTree/Expression/Try with - Missing expr 05.fs new file mode 100644 index 00000000000..c2a4f5ccf09 --- /dev/null +++ b/tests/service/data/SyntaxTree/Expression/Try with - Missing expr 05.fs @@ -0,0 +1,6 @@ +module Module + +try + +module Nested = + () diff --git a/tests/service/data/SyntaxTree/Expression/Try with - Missing expr 05.fs.bsl b/tests/service/data/SyntaxTree/Expression/Try with - Missing expr 05.fs.bsl new file mode 100644 index 00000000000..56b437e922d --- /dev/null +++ b/tests/service/data/SyntaxTree/Expression/Try with - Missing expr 05.fs.bsl @@ -0,0 +1,21 @@ +ImplFile + (ParsedImplFileInput + ("/root/Expression/Try with - Missing expr 05.fs", false, + QualifiedNameOfFile Module, [], [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Expr + (TryWith + (ArbitraryAfterError ("typedSequentialExprBlockR", (3,0--3,3)), + [], (3,0--3,3), Yes (3,0--3,3), Yes (3,3--3,3), + { TryKeyword = (3,0--3,3) + TryToWithRange = (3,0--3,3) + WithKeyword = (3,3--3,3) + WithToEndRange = (3,0--3,3) }), (3,0--3,3))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--3,3), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + CodeComments = [] }, set [])) + +(5,0)-(5,6) parse error Incomplete structured construct at or before this point in expression +(3,0)-(3,3) parse error Unexpected end of input in 'try' expression. Expected 'try with ' or 'try finally '. diff --git a/tests/service/data/SyntaxTree/Expression/Try with 01.fs b/tests/service/data/SyntaxTree/Expression/Try with 01.fs new file mode 100644 index 00000000000..cc5cc7c9638 --- /dev/null +++ b/tests/service/data/SyntaxTree/Expression/Try with 01.fs @@ -0,0 +1,4 @@ +module Module + +try () +with _ -> () diff --git a/tests/service/data/SyntaxTree/Expression/Try with 01.fs.bsl b/tests/service/data/SyntaxTree/Expression/Try with 01.fs.bsl new file mode 100644 index 00000000000..3435a66a380 --- /dev/null +++ b/tests/service/data/SyntaxTree/Expression/Try with 01.fs.bsl @@ -0,0 +1,22 @@ +ImplFile + (ParsedImplFileInput + ("/root/Expression/Try with 01.fs", false, QualifiedNameOfFile Module, [], + [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Expr + (TryWith + (Const (Unit, (3,4--3,6)), + [SynMatchClause + (Wild (4,5--4,6), None, Const (Unit, (4,10--4,12)), + (4,5--4,12), Yes, { ArrowRange = Some (4,7--4,9) + BarRange = None })], (3,0--4,12), + Yes (3,0--3,3), Yes (4,0--4,4), + { TryKeyword = (3,0--3,3) + TryToWithRange = (3,0--4,4) + WithKeyword = (4,0--4,4) + WithToEndRange = (4,0--4,12) }), (3,0--4,12))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--4,12), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/MatchClause/Missing expr 01.fs b/tests/service/data/SyntaxTree/MatchClause/Missing expr 01.fs new file mode 100644 index 00000000000..b054165672b --- /dev/null +++ b/tests/service/data/SyntaxTree/MatchClause/Missing expr 01.fs @@ -0,0 +1,4 @@ +module Module + +match () with +| diff --git a/tests/service/data/SyntaxTree/MatchClause/Missing expr 01.fs.bsl b/tests/service/data/SyntaxTree/MatchClause/Missing expr 01.fs.bsl new file mode 100644 index 00000000000..6f92c909aa0 --- /dev/null +++ b/tests/service/data/SyntaxTree/MatchClause/Missing expr 01.fs.bsl @@ -0,0 +1,17 @@ +ImplFile + (ParsedImplFileInput + ("/root/MatchClause/Missing expr 01.fs", false, QualifiedNameOfFile Module, + [], [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Expr + (Match + (Yes (3,0--3,13), Const (Unit, (3,6--3,8)), [], (3,0--4,1), + { MatchKeyword = (3,0--3,5) + WithKeyword = (3,9--3,13) }), (3,0--4,1))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--4,1), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + CodeComments = [] }, set [])) + +(5,0)-(5,0) parse error Incomplete structured construct at or before this point in expression diff --git a/tests/service/data/SyntaxTree/MatchClause/Missing expr 02.fs b/tests/service/data/SyntaxTree/MatchClause/Missing expr 02.fs new file mode 100644 index 00000000000..2d74f72d8c6 --- /dev/null +++ b/tests/service/data/SyntaxTree/MatchClause/Missing expr 02.fs @@ -0,0 +1,4 @@ +module Module + +match () with +| _ -> diff --git a/tests/service/data/SyntaxTree/MatchClause/Missing expr 02.fs.bsl b/tests/service/data/SyntaxTree/MatchClause/Missing expr 02.fs.bsl new file mode 100644 index 00000000000..be376814120 --- /dev/null +++ b/tests/service/data/SyntaxTree/MatchClause/Missing expr 02.fs.bsl @@ -0,0 +1,24 @@ +ImplFile + (ParsedImplFileInput + ("/root/MatchClause/Missing expr 02.fs", false, QualifiedNameOfFile Module, + [], [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Expr + (Match + (Yes (3,0--3,13), Const (Unit, (3,6--3,8)), + [SynMatchClause + (Wild (4,2--4,3), None, + ArbitraryAfterError + ("typedSequentialExprBlockR", (4,4--4,6)), (4,2--4,6), + Yes, { ArrowRange = Some (4,4--4,6) + BarRange = Some (4,0--4,1) })], (3,0--4,6), + { MatchKeyword = (3,0--3,5) + WithKeyword = (3,9--3,13) }), (3,0--4,6))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--4,6), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + CodeComments = [] }, set [])) + +(5,0)-(5,0) parse warning Possible incorrect indentation: this token is offside of context started at position (3:1). Try indenting this token further or using standard formatting conventions. +(5,0)-(5,0) parse error Incomplete structured construct at or before this point in pattern matching diff --git a/tests/service/data/SyntaxTree/MatchClause/Missing expr 03.fs b/tests/service/data/SyntaxTree/MatchClause/Missing expr 03.fs new file mode 100644 index 00000000000..752de227705 --- /dev/null +++ b/tests/service/data/SyntaxTree/MatchClause/Missing expr 03.fs @@ -0,0 +1,5 @@ +module Module + +match () with +| _ -> +| _ -> () diff --git a/tests/service/data/SyntaxTree/MatchClause/Missing expr 03.fs.bsl b/tests/service/data/SyntaxTree/MatchClause/Missing expr 03.fs.bsl new file mode 100644 index 00000000000..5d65ea914bd --- /dev/null +++ b/tests/service/data/SyntaxTree/MatchClause/Missing expr 03.fs.bsl @@ -0,0 +1,27 @@ +ImplFile + (ParsedImplFileInput + ("/root/MatchClause/Missing expr 03.fs", false, QualifiedNameOfFile Module, + [], [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Expr + (Match + (Yes (3,0--3,13), Const (Unit, (3,6--3,8)), + [SynMatchClause + (Wild (4,2--4,3), None, + ArbitraryAfterError + ("typedSequentialExprBlockR", (4,4--4,6)), (4,2--4,6), + Yes, { ArrowRange = Some (4,4--4,6) + BarRange = Some (4,0--4,1) }); + SynMatchClause + (Wild (5,2--5,3), None, Const (Unit, (5,7--5,9)), (5,2--5,9), + Yes, { ArrowRange = Some (5,4--5,6) + BarRange = Some (5,0--5,1) })], (3,0--5,9), + { MatchKeyword = (3,0--3,5) + WithKeyword = (3,9--3,13) }), (3,0--5,9))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--5,9), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + CodeComments = [] }, set [])) + +(5,0)-(5,1) parse error Unexpected symbol '|' in pattern matching diff --git a/tests/service/data/SyntaxTree/MatchClause/Missing expr 04.fs b/tests/service/data/SyntaxTree/MatchClause/Missing expr 04.fs new file mode 100644 index 00000000000..48305f92d1c --- /dev/null +++ b/tests/service/data/SyntaxTree/MatchClause/Missing expr 04.fs @@ -0,0 +1,5 @@ +module Module + +match () with +| _ when true -> +| _ -> () diff --git a/tests/service/data/SyntaxTree/MatchClause/Missing expr 04.fs.bsl b/tests/service/data/SyntaxTree/MatchClause/Missing expr 04.fs.bsl new file mode 100644 index 00000000000..777d997f288 --- /dev/null +++ b/tests/service/data/SyntaxTree/MatchClause/Missing expr 04.fs.bsl @@ -0,0 +1,27 @@ +ImplFile + (ParsedImplFileInput + ("/root/MatchClause/Missing expr 04.fs", false, QualifiedNameOfFile Module, + [], [], + [SynModuleOrNamespace + ([Module], false, NamedModule, + [Expr + (Match + (Yes (3,0--3,13), Const (Unit, (3,6--3,8)), + [SynMatchClause + (Wild (4,2--4,3), Some (Const (Bool true, (4,9--4,13))), + ArbitraryAfterError + ("typedSequentialExprBlockR", (4,14--4,16)), (4,2--4,16), + Yes, { ArrowRange = Some (4,14--4,16) + BarRange = Some (4,0--4,1) }); + SynMatchClause + (Wild (5,2--5,3), None, Const (Unit, (5,7--5,9)), (5,2--5,9), + Yes, { ArrowRange = Some (5,4--5,6) + BarRange = Some (5,0--5,1) })], (3,0--5,9), + { MatchKeyword = (3,0--3,5) + WithKeyword = (3,9--3,13) }), (3,0--5,9))], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, + (1,0--5,9), { LeadingKeyword = Module (1,0--1,6) })], (true, true), + { ConditionalDirectives = [] + CodeComments = [] }, set [])) + +(5,0)-(5,1) parse error Unexpected symbol '|' in pattern matching diff --git a/tests/service/data/SyntaxTree/MatchClause/RangeOfSingleSynMatchClauseWithMissingBody.fs.bsl b/tests/service/data/SyntaxTree/MatchClause/RangeOfSingleSynMatchClauseWithMissingBody.fs.bsl index a7d8193deca..fddbf9a3a18 100644 --- a/tests/service/data/SyntaxTree/MatchClause/RangeOfSingleSynMatchClauseWithMissingBody.fs.bsl +++ b/tests/service/data/SyntaxTree/MatchClause/RangeOfSingleSynMatchClauseWithMissingBody.fs.bsl @@ -28,15 +28,16 @@ ImplFile (3,4--4,16), { InKeyword = None }), [SynMatchClause (Named (SynIdent (ex, None), false, None, (6,2--6,4)), None, - ArbitraryAfterError ("patternClauses2", (6,4--6,4)), - (6,2--6,4), Yes, { ArrowRange = None - BarRange = Some (6,0--6,1) })], - (2,0--6,4), Yes (2,0--2,3), Yes (5,0--5,4), - { TryKeyword = (2,0--2,3) - TryToWithRange = (2,0--5,4) - WithKeyword = (5,0--5,4) - WithToEndRange = (5,0--6,4) }), (2,0--6,4))], PreXmlDocEmpty, - [], None, (2,0--7,0), { LeadingKeyword = None })], (true, true), + ArbitraryAfterError + ("typedSequentialExprBlockR", (6,5--6,7)), (6,2--6,7), + Yes, { ArrowRange = Some (6,5--6,7) + BarRange = Some (6,0--6,1) })], (2,0--6,7), + Yes (2,0--2,3), Yes (5,0--5,4), { TryKeyword = (2,0--2,3) + TryToWithRange = (2,0--5,4) + WithKeyword = (5,0--5,4) + WithToEndRange = (5,0--6,7) }), + (2,0--6,7))], PreXmlDocEmpty, [], None, (2,0--7,0), + { LeadingKeyword = None })], (true, true), { ConditionalDirectives = [] CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/MatchClause/RangeOfSingleSynMatchClauseWithMissingBodyAndWhenExpr.fs.bsl b/tests/service/data/SyntaxTree/MatchClause/RangeOfSingleSynMatchClauseWithMissingBodyAndWhenExpr.fs.bsl index 85459b23541..e9ac911ead1 100644 --- a/tests/service/data/SyntaxTree/MatchClause/RangeOfSingleSynMatchClauseWithMissingBodyAndWhenExpr.fs.bsl +++ b/tests/service/data/SyntaxTree/MatchClause/RangeOfSingleSynMatchClauseWithMissingBodyAndWhenExpr.fs.bsl @@ -37,14 +37,15 @@ ImplFile (NonAtomic, false, Ident isNull, Ident ex, (6,11--6,20)), (6,10--6,11), Some (6,20--6,21), (6,10--6,21))), - ArbitraryAfterError ("patternClauses2", (6,21--6,21)), - (6,2--6,21), Yes, { ArrowRange = None - BarRange = Some (6,0--6,1) })], - (2,0--6,21), Yes (2,0--2,3), Yes (5,0--5,4), + ArbitraryAfterError + ("typedSequentialExprBlockR", (6,22--6,24)), (6,2--6,24), + Yes, { ArrowRange = Some (6,22--6,24) + BarRange = Some (6,0--6,1) })], (2,0--6,24), + Yes (2,0--2,3), Yes (5,0--5,4), { TryKeyword = (2,0--2,3) TryToWithRange = (2,0--5,4) WithKeyword = (5,0--5,4) - WithToEndRange = (5,0--6,21) }), (2,0--6,21))], + WithToEndRange = (5,0--6,24) }), (2,0--6,24))], PreXmlDocEmpty, [], None, (2,0--7,0), { LeadingKeyword = None })], (true, true), { ConditionalDirectives = [] CodeComments = [] }, set []))