From fca7d0611058f2e9368ee688c4b7fe084b913e64 Mon Sep 17 00:00:00 2001 From: odersky Date: Sun, 29 Oct 2023 17:29:40 +0100 Subject: [PATCH] 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. --- compiler/src/dotty/tools/dotc/parsing/Parsers.scala | 2 ++ 1 file changed, 2 insertions(+) diff --git a/compiler/src/dotty/tools/dotc/parsing/Parsers.scala b/compiler/src/dotty/tools/dotc/parsing/Parsers.scala index e989b67becd8..48653ad96197 100644 --- a/compiler/src/dotty/tools/dotc/parsing/Parsers.scala +++ b/compiler/src/dotty/tools/dotc/parsing/Parsers.scala @@ -997,6 +997,8 @@ object Parsers { leadingOperandTokens.contains(in.lookahead.token) || in.postfixOpsEnabled || in.lookahead.token == COLONop + || in.lookahead.token == EOF // important for REPL completions + || ctx.mode.is(Mode.Interactive) // in interactive mode the next tokens might be missing /* --------- OPERAND/OPERATOR STACK --------------------------------------- */