Skip to content

Commit eda9146

Browse files
oderskyWojciechMazur
authored andcommitted
Override operator detection logic in interactive mode
In interactive mode the token after an operator might not yet exist, so we should disregard that info when deciding whether we see an infix operator or not. [Cherry-picked fca7d06]
1 parent d1c4ff9 commit eda9146

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -997,6 +997,8 @@ object Parsers {
997997
leadingOperandTokens.contains(in.lookahead.token)
998998
|| in.postfixOpsEnabled
999999
|| in.lookahead.token == COLONop
1000+
|| in.lookahead.token == EOF // important for REPL completions
1001+
|| ctx.mode.is(Mode.Interactive) // in interactive mode the next tokens might be missing
10001002

10011003
/* --------- OPERAND/OPERATOR STACK --------------------------------------- */
10021004

0 commit comments

Comments
 (0)