Skip to content

Commit

Permalink
Merge pull request #13048 from griggt/fix-13046
Browse files Browse the repository at this point in the history
Fix #13046: `override` is a valid identifier in Java, not a keyword
  • Loading branch information
smarter authored Jul 11, 2021
2 parents 7627583 + 9f346d3 commit a4eb717
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/parsing/JavaTokens.scala
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ object JavaTokens extends TokensCommon {

final val javaOnlyKeywords: TokenSet = tokenRange(INSTANCEOF, ASSERT)
final val sharedKeywords: BitSet = BitSet( IF, FOR, ELSE, THIS, NULL, NEW, SUPER, ABSTRACT, FINAL, PRIVATE, PROTECTED,
OVERRIDE, EXTENDS, TRUE, FALSE, CLASS, IMPORT, PACKAGE, DO, THROW, TRY, CATCH, FINALLY, WHILE, RETURN )
EXTENDS, TRUE, FALSE, CLASS, IMPORT, PACKAGE, DO, THROW, TRY, CATCH, FINALLY, WHILE, RETURN )
final val primTypes: TokenSet = tokenRange(VOID, DOUBLE)
final val keywords: BitSet = sharedKeywords | javaOnlyKeywords | primTypes

Expand Down
3 changes: 3 additions & 0 deletions tests/pos/i13046/A.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
interface A {
public boolean override();
}
3 changes: 3 additions & 0 deletions tests/pos/i13046/B.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
class B extends A {
override def `override`: Boolean = true
}

0 comments on commit a4eb717

Please sign in to comment.