Skip to content

Commit 250ce6f

Browse files
committed
Unconditionally copy non-package class denotations in erasure
Their base types change, so they should get new denotations.
1 parent 13c3210 commit 250ce6f

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

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

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -90,16 +90,17 @@ class Erasure extends Phase with DenotTransformer {
9090
newFlags = newFlags &~ Flags.Inline
9191
newAnnotations = newAnnotations.filterConserve(!_.isInstanceOf[BodyAnnotation])
9292
// TODO: define derivedSymDenotation?
93-
if (oldSymbol eq newSymbol)
94-
&& (oldOwner eq newOwner)
95-
&& (oldName eq newName)
96-
&& (oldInfo eq newInfo)
97-
&& (oldFlags == newFlags)
98-
&& (oldAnnotations eq newAnnotations)
93+
if ref.is(Flags.PackageClass)
94+
|| !ref.isClass // non-package classes are always copied since their base types change
95+
&& (oldSymbol eq newSymbol)
96+
&& (oldOwner eq newOwner)
97+
&& (oldName eq newName)
98+
&& (oldInfo eq newInfo)
99+
&& (oldFlags == newFlags)
100+
&& (oldAnnotations eq newAnnotations)
99101
then
100102
ref
101103
else
102-
assert(!ref.is(Flags.PackageClass), s"trans $ref @ ${ctx.phase} oldOwner = $oldOwner, newOwner = $newOwner, oldInfo = $oldInfo, newInfo = $newInfo ${oldOwner eq newOwner} ${oldInfo eq newInfo}")
103104
ref.copySymDenotation(
104105
symbol = newSymbol,
105106
owner = newOwner,

0 commit comments

Comments
 (0)