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.

[Cherry-picked fca7d06]
  • Loading branch information
odersky authored and WojciechMazur committed Jun 23, 2024
1 parent 30cd1f2 commit a96e975
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 a96e975

Please sign in to comment.