Skip to content
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
Fix Symbol.info remapping in TreeTypeMap
Previously, the map would first copy and remap the outermost symbols,
then inner declarations, then ddeclarations of those declarations etc.,
so if an outer symbol referred to a more nested one, that reference was
not remapped, causing issues later.
  • Loading branch information
jchyb committed Jun 26, 2025
commit e57d743430f583336fa4ce6e9159717f4843b55f
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