Skip to content

Commit cbc4fa9

Browse files
committed
Fix scala#4393 WIP
Min tests: `try { ??? } catch {}` (can be scripted) and `try { ??? } catch {`.
1 parent 18fa15e commit cbc4fa9

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

compiler/src/dotty/tools/dotc/parsing/Parsers.scala

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -245,8 +245,8 @@ object Parsers {
245245
ctx.deprecationWarning(msg, source atPos Position(offset))
246246

247247
/** Issue an error at current offset taht input is incomplete */
248-
def incompleteInputError(msg: => Message) =
249-
ctx.incompleteInputError(msg, source atPos Position(in.offset))
248+
def incompleteInputError(msg: => Message, pos: Position = Position(in.offset)) =
249+
ctx.incompleteInputError(msg, source atPos pos)
250250

251251
/** If at end of file, issue an incompleteInputError.
252252
* Otherwise issue a syntax error and skip to next safe point.
@@ -1162,7 +1162,10 @@ object Parsers {
11621162
if (in.token == CATCH) {
11631163
val pos = in.offset
11641164
in.nextToken()
1165-
(expr(), pos)
1165+
accept(LBRACE)
1166+
val res = (expr(), pos)
1167+
accept(RBRACE)
1168+
res
11661169
} else (EmptyTree, -1)
11671170

11681171
handler match {

0 commit comments

Comments
 (0)