Skip to content

Commit

Permalink
Fix backting if ending with operator part
Browse files Browse the repository at this point in the history
  • Loading branch information
adpi2 committed May 30, 2023
1 parent d11dce4 commit c7a3eb5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion compiler/src/dotty/tools/dotc/parsing/Parsers.scala
Original file line number Diff line number Diff line change
Expand Up @@ -793,7 +793,8 @@ object Parsers {
patchOver(source, Span(startClosing, endClosing), "")
if colonRequired then
// add backticks around operator and add colon
if lastSaved.isOperator then
if lastSaved.token == IDENTIFIER &&
(Chars.isOperatorPart(lastSaved.name.last) || lastSaved.name.last == '_') then
patch(Span(lastSaved.offset, lastSaved.offset + lastSaved.name.length), s"`${lastSaved.name}` :")
else patch(Span(lastOffsetSaved), ":")
else
Expand Down

0 comments on commit c7a3eb5

Please sign in to comment.