Skip to content

Commit

Permalink
Merge pull request #13378 from griggt/fix-13310
Browse files Browse the repository at this point in the history
Fix #13310: Parse empty Java compilation units as EmptyTree
  • Loading branch information
griggt authored Aug 25, 2021
2 parents 9e06f24 + fbea0ff commit ce0e25c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion compiler/src/dotty/tools/dotc/parsing/JavaParsers.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1013,7 +1013,9 @@ object JavaParsers {
}
val unit = atSpan(start) { PackageDef(pkg, buf.toList) }
accept(EOF)
unit
unit match
case PackageDef(Ident(nme.EMPTY_PACKAGE), Nil) => EmptyTree
case _ => unit
}
}

Expand Down
2 changes: 2 additions & 0 deletions tests/pos/i13310.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// The entire contents of this file is intentionally commented out
// public class i13310 {}

0 comments on commit ce0e25c

Please sign in to comment.