Skip to content

Commit

Permalink
Analyze end markers when looking ahead
Browse files Browse the repository at this point in the history
Lookahead also has to replace and end marker with a normal identifier.

Fixes scala#13134
  • Loading branch information
odersky committed Jul 23, 2021
1 parent cc47c56 commit acde7f5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions compiler/src/dotty/tools/dotc/parsing/Scanners.scala
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,7 @@ object Scanners {
prev.copyFrom(this)
lastOffset = lastCharOffset
fetchToken()
if token == END && !isEndMarker then token = IDENTIFIER
}

def reset() = {
Expand Down
10 changes: 10 additions & 0 deletions tests/pos/i13134.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
def test =
{
val end = 0
assert(~end == -1) //Not found: ~
}

{
val end = false
assert(!end) // postfix operator `end` needs to be enabled
} // by making the implicit value scala.language.postfixOps visible.

0 comments on commit acde7f5

Please sign in to comment.