Skip to content

Commit 7dbda25

Browse files
committed
Address review comments
1 parent 68c762a commit 7dbda25

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -337,15 +337,15 @@ object Scanners {
337337

338338
/** A leading symbolic or backquoted identifier is treated as an infix operator if
339339
* - it does not follow a blank line, and
340-
* - it is followed on the same line by at least one ' '
341-
* and a token that can start an expression.
340+
* - it is followed by at least one whitespace character and a
341+
* token that can start an expression.
342342
* If a leading infix operator is found and the source version is `3.0-migration`, emit a change warning.
343343
*/
344344
def isLeadingInfixOperator(inConditional: Boolean = true) =
345345
allowLeadingInfixOperators
346346
&& ( token == BACKQUOTED_IDENT
347347
|| token == IDENTIFIER && isOperatorPart(name(name.length - 1)))
348-
&& ch <= ' '
348+
&& isWhitespace(ch)
349349
&& !pastBlankLine
350350
&& {
351351
val lookahead = LookaheadScanner()

compiler/src/dotty/tools/dotc/util/Chars.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ object Chars {
5252

5353
/** Is character a whitespace character (but not a new line)? */
5454
def isWhitespace(c: Char): Boolean =
55-
c == ' ' || c == '\t' || c == CR
55+
c == ' ' || c == '\t' || c == CR || c == LF
5656

5757
/** Can character form part of a doc comment variable $xxx? */
5858
def isVarPart(c: Char): Boolean =

0 commit comments

Comments
 (0)