File tree 2 files changed +13
-3
lines changed
compiler/src/dotty/tools/dotc/parsing
2 files changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -377,8 +377,8 @@ object Scanners {
377
377
&& {
378
378
// Is current lexeme assumed to start an expression?
379
379
// 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.
382
382
// I.e. in
383
383
//
384
384
// a
@@ -388,7 +388,7 @@ object Scanners {
388
388
// in backticks and is a binary operator. Hence, `x` is not classified as a
389
389
// leading infix operator.
390
390
def assumeStartsExpr (lexeme : TokenData ) =
391
- canStartExprTokens.contains(lexeme.token)
391
+ ( canStartExprTokens.contains(lexeme.token) || lexeme.token == COLONEOL )
392
392
&& (! lexeme.isOperator || nme.raw.isUnary(lexeme.name))
393
393
val lookahead = LookaheadScanner ()
394
394
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