Skip to content

Commit 5c83a8c

Browse files
committed
Keep constructor proxies after erasure
It's awkward to delete all references to them. We should treat them like other symbols that are effectively erased.
1 parent f3a4263 commit 5c83a8c

File tree

3 files changed

+2
-5
lines changed

3 files changed

+2
-5
lines changed

compiler/src/dotty/tools/backend/jvm/BTypesFromSymbols.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ class BTypesFromSymbols[I <: DottyBackendInterface](val int: I) extends BTypes {
214214
private def definedClasses(sym: Symbol, phase: Phase) =
215215
if (sym.isDefinedInCurrentRun)
216216
atPhase(phase) {
217-
toDenot(sym).info.decls.filter(_.isClass)
217+
toDenot(sym).info.decls.filter(sym => sym.isClass && !sym.isEffectivelyErased)
218218
}
219219
else Nil
220220

compiler/src/dotty/tools/dotc/transform/Erasure.scala

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1048,8 +1048,6 @@ object Erasure {
10481048
cls.linkedClass.copySymDenotation(initFlags = EmptyFlags, info = NoType)
10491049
.installAfter(erasurePhase)
10501050
cls.registeredCompanion = NoSymbol
1051-
for mbr <- cls.info.decls do
1052-
if mbr.is(ConstructorProxy) then mbr.dropAfter(erasurePhase)
10531051

10541052
override def typedClassDef(cdef: untpd.TypeDef, cls: ClassSymbol)(using Context): Tree =
10551053
if cls.is(Flags.Erased) then erasedDef(cls)

compiler/src/dotty/tools/dotc/transform/TreeChecker.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -446,8 +446,7 @@ class TreeChecker extends Phase with SymTransformer {
446446
val decls = cls.classInfo.decls.toList.toSet.filter(isNonMagicalMember)
447447
val defined = impl.body.map(_.symbol)
448448

449-
def isAllowed(sym: Symbol): Boolean =
450-
sym.is(ConstructorProxy) && !ctx.phase.erasedTypes
449+
def isAllowed(sym: Symbol): Boolean = sym.is(ConstructorProxy)
451450

452451
val symbolsNotDefined = (decls -- defined - constr.symbol).filterNot(isAllowed)
453452

0 commit comments

Comments
 (0)