File tree 1 file changed +9
-2
lines changed
compiler/src/dotty/tools/dotc/typer 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -80,12 +80,17 @@ class FrontEnd extends Phase {
80
80
typr.println(" typed: " + unit.source)
81
81
record(" retained untyped trees" , unit.untpdTree.treeSize)
82
82
record(" retained typed trees after typer" , unit.tpdTree.treeSize)
83
- if unit.isJava then
84
- JavaChecks .check(unit.tpdTree)
85
83
catch
86
84
case ex : CompilationUnit .SuspendException =>
87
85
}
88
86
87
+ def javaCheck (using Context ): Unit = monitor(" checking java" ) {
88
+ val unit = ctx.compilationUnit
89
+ if unit.isJava then
90
+ JavaChecks .check(unit.tpdTree)
91
+ }
92
+
93
+
89
94
private def firstTopLevelDef (trees : List [tpd.Tree ])(using Context ): Symbol = trees match {
90
95
case PackageDef (_, defs) :: _ => firstTopLevelDef(defs)
91
96
case Import (_, _) :: defs => firstTopLevelDef(defs)
@@ -115,6 +120,8 @@ class FrontEnd extends Phase {
115
120
116
121
unitContexts.foreach(typeCheck(using _))
117
122
record(" total trees after typer" , ast.Trees .ntrees)
123
+ unitContexts.foreach(javaCheck(using _)) // after typechecking to avoid cycles
124
+
118
125
val newUnits = unitContexts.map(_.compilationUnit).filterNot(discardAfterTyper)
119
126
val suspendedUnits = ctx.run.suspendedUnits
120
127
if newUnits.isEmpty && suspendedUnits.nonEmpty && ! ctx.reporter.errorsReported then
You can’t perform that action at this time.
0 commit comments