Skip to content

Commit

Permalink
Override operator detection logic in interactive mode
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
odersky committed Oct 29, 2023
1 parent 45fc82a commit fca7d06
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions compiler/src/dotty/tools/dotc/parsing/Parsers.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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 --------------------------------------- */

Expand Down

0 comments on commit fca7d06

Please sign in to comment.