File tree Expand file tree Collapse file tree 2 files changed +13
-3
lines changed
compiler/src/dotty/tools/dotc/parsing Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -377,8 +377,8 @@ object Scanners {
377377 && {
378378 // Is current lexeme assumed to start an expression?
379379 // This is the case if the lexime is one of the tokens that
380- // starts an expression. Furthermore, if the previous token is
381- // in backticks, the lexeme may not be a binary operator.
380+ // starts an expression or it is a COLONEOL. Furthermore, if
381+ // the previous token is in backticks, the lexeme may not be a binary operator.
382382 // I.e. in
383383 //
384384 // a
@@ -388,7 +388,7 @@ object Scanners {
388388 // in backticks and is a binary operator. Hence, `x` is not classified as a
389389 // leading infix operator.
390390 def assumeStartsExpr (lexeme : TokenData ) =
391- canStartExprTokens.contains(lexeme.token)
391+ ( canStartExprTokens.contains(lexeme.token) || lexeme.token == COLONEOL )
392392 && (! lexeme.isOperator || nme.raw.isUnary(lexeme.name))
393393 val lookahead = LookaheadScanner ()
394394 lookahead.allowLeadingInfixOperators = false
Original file line number Diff line number Diff line change 1+ import language .experimental .fewerBraces
2+ @ main def runTest (): Unit =
3+ val arr = Array (1 ,2 ,3 )
4+ if
5+ arr.isEmpty
6+ || :
7+ val first = arr(0 )
8+ first != 1
9+ then println(" invalid arr" )
10+ else println(" valid arr" )
You can’t perform that action at this time.
0 commit comments