Skip to content

Fix Symbol.info remapping in TreeTypeMap #23432

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions compiler/src/dotty/tools/dotc/ast/TreeTypeMap.scala
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,11 @@ class TreeTypeMap(
val tmap1 = tmap.withMappedSyms(
origCls(cls).typeParams ::: origDcls,
cls.typeParams ::: mappedDcls)
mapped.foreach { sym =>
// outer Symbols can reference nested ones in info,
// so we remap that once again with the updated TreeTypeMap
sym.info = tmap1.mapType(sym.info)
}
origDcls.lazyZip(mappedDcls).foreach(cls.asClass.replace)
tmap1
}
Expand Down
28 changes: 28 additions & 0 deletions tests/run/i23279.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
inline def simpleInlineWrap(f: => Any): Unit = f

@main def Test(): Unit = {
simpleInlineWrap {
object lifecycle {
object Lifecycle {
trait FromZIO
}
}
object defn {
val Lifecycle: lifecycle.Lifecycle.type = lifecycle.Lifecycle
}
val xa: defn.Lifecycle.type = defn.Lifecycle
}

// more nested case
simpleInlineWrap {
object lifecycle {
object Lifecycle {
object FromZIO
}
}
object defn {
val Lifecycle: lifecycle.Lifecycle.type = lifecycle.Lifecycle
}
val xa: defn.Lifecycle.FromZIO.type = defn.Lifecycle.FromZIO
}
}
Loading