Skip to content

Commit 8ebaded

Browse files
committed
Add missing object access trace
1 parent 9c8850f commit 8ebaded

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ class CycleChecker(cache: Cache) {
105105
val res = op(using state2)
106106
res
107107

108-
def withPath[T](obj: Symbol)(op: State ?=> T): T =
109-
val state2 = this.copy(path = path :+ obj)
108+
def visitObject[T](dep: ObjectAccess)(op: State ?=> T): T =
109+
val state2 = this.copy(path = path :+ dep.symbol, trace = trace :+ dep)
110110
val res = op(using state2)
111111
res
112112

@@ -155,8 +155,8 @@ class CycleChecker(cache: Cache) {
155155
ObjectLeakDuringInit(obj, trace) :: Nil
156156
else
157157
val constr = obj.moduleClass.primaryConstructor
158-
state.withPath(obj) {
159-
check(StaticCall(constr.owner.asClass, constr)(dep.source))
158+
state.visitObject(dep) {
159+
check(StaticCall(constr.owner.asClass, constr)(constr.defTree))
160160
}
161161
}
162162

0 commit comments

Comments
 (0)