Skip to content

Commit 67312da

Browse files
Run all java checks after typechecking
1 parent 34a2fea commit 67312da

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

compiler/src/dotty/tools/dotc/typer/FrontEnd.scala

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,13 @@ class FrontEnd extends Phase {
8686
case ex: CompilationUnit.SuspendException =>
8787
}
8888

89+
def javaCheck(using Context): Unit = monitor("checking java") {
90+
val unit = ctx.compilationUnit
91+
if unit.isJava then
92+
JavaChecks.check(unit.tpdTree)
93+
}
94+
95+
8996
private def firstTopLevelDef(trees: List[tpd.Tree])(using Context): Symbol = trees match {
9097
case PackageDef(_, defs) :: _ => firstTopLevelDef(defs)
9198
case Import(_, _) :: defs => firstTopLevelDef(defs)
@@ -115,6 +122,8 @@ class FrontEnd extends Phase {
115122

116123
unitContexts.foreach(typeCheck(using _))
117124
record("total trees after typer", ast.Trees.ntrees)
125+
unitContexts.foreach(javaCheck(using _)) // after typechecking to avoid cycles
126+
118127
val newUnits = unitContexts.map(_.compilationUnit).filterNot(discardAfterTyper)
119128
val suspendedUnits = ctx.run.suspendedUnits
120129
if newUnits.isEmpty && suspendedUnits.nonEmpty && !ctx.reporter.errorsReported then

0 commit comments

Comments
 (0)