@@ -377,7 +377,7 @@ object Parsers {
377377 false
378378 }
379379
380- def errorTermTree : Literal = atSpan(in.offset) { Literal (Constant (null )) }
380+ def errorTermTree ( start : Offset ) : Literal = atSpan(start, in.offset, in.offset) { Literal (Constant (null )) }
381381
382382 private var inFunReturnType = false
383383 private def fromWithinReturnType [T ](body : => T ): T = {
@@ -1931,7 +1931,7 @@ object Parsers {
19311931 PolyFunction (tparams, body)
19321932 else {
19331933 syntaxError(" Implementation restriction: polymorphic function literals must have a value parameter" , arrowOffset)
1934- errorTermTree
1934+ errorTermTree(arrowOffset)
19351935 }
19361936 }
19371937 case _ =>
@@ -2298,8 +2298,9 @@ object Parsers {
22982298 in.nextToken()
22992299 simpleExpr(location)
23002300 else
2301+ val start = in.lastOffset
23012302 syntaxErrorOrIncomplete(IllegalStartSimpleExpr (tokenString(in.token)), expectedOffset)
2302- errorTermTree
2303+ errorTermTree(start)
23032304 }
23042305 simpleExprRest(t, location, canApply)
23052306 }
@@ -2738,8 +2739,9 @@ object Parsers {
27382739 case _ =>
27392740 if (isLiteral) literal(inPattern = true )
27402741 else {
2742+ val start = in.lastOffset
27412743 syntaxErrorOrIncomplete(IllegalStartOfSimplePattern (), expectedOffset)
2742- errorTermTree
2744+ errorTermTree(start)
27432745 }
27442746 }
27452747
@@ -3314,8 +3316,9 @@ object Parsers {
33143316 }
33153317 val rhs2 =
33163318 if rhs.isEmpty && ! isAllIds then
3319+ val start = in.lastOffset
33173320 syntaxError(ExpectedTokenButFound (EQUALS , in.token), Span (in.lastOffset))
3318- errorTermTree
3321+ errorTermTree(start)
33193322 else
33203323 rhs
33213324 PatDef (mods, lhs, tpt, rhs2)
@@ -3483,11 +3486,12 @@ object Parsers {
34833486 case GIVEN =>
34843487 givenDef(start, mods, atSpan(in.skipToken()) { Mod .Given () })
34853488 case _ =>
3489+ val start = in.lastOffset
34863490 syntaxErrorOrIncomplete(ExpectedStartOfTopLevelDefinition ())
34873491 mods.annotations match {
34883492 case head :: Nil => head
34893493 case Nil => EmptyTree
3490- case all => Block (all, errorTermTree)
3494+ case all => Block (all, errorTermTree(start) )
34913495 }
34923496 }
34933497
0 commit comments