Skip to content

Commit be9512c

Browse files
committed
Re-allow prefix operators after a leading infix operator
1 parent e75a527 commit be9512c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -355,8 +355,9 @@ object Scanners {
355355
// force a NEWLINE a after current token if it is on its own line
356356
lookahead.nextToken()
357357
(canStartExprTokens.contains(lookahead.token)
358-
|| lookahead.token == NEWLINE && canStartExprTokens.contains(lookahead.next.token)
359-
) && !lookahead.isOperator
358+
|| lookahead.token == NEWLINE && canStartExprTokens.contains(lookahead.next.token))
359+
&&
360+
(!lookahead.isOperator || nme.raw.isUnary(lookahead.name))
360361
}
361362
&& {
362363
if migrateTo3 then

0 commit comments

Comments
 (0)