Skip to content

Commit bcf39c4

Browse files
committed
Fix context for init check
Otherwise, the symbol denotations are not update to date: some synthetic members are missing, thus static method resolution produces incorrect result.
1 parent 14100f7 commit bcf39c4

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

compiler/src/dotty/tools/dotc/transform/init/Checker.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,11 @@ class Checker extends Phase {
3030
super.isEnabled && ctx.settings.YcheckInit.value
3131

3232
override def runOn(units: List[CompilationUnit])(using Context): List[CompilationUnit] =
33+
val checkCtx = ctx.fresh.setPhase(this.start)
3334
Semantic.withInitialState {
3435
val traverser = new InitTreeTraverser()
3536
units.foreach { unit => traverser.traverse(unit.tpdTree) }
37+
given Context = checkCtx
3638
Semantic.check()
3739
super.runOn(units)
3840
}

0 commit comments

Comments
 (0)