Skip to content

Commit 5a6fbc2

Browse files
committed
Fix incorrect code in phase Constructors
`cls.copy` creates an unused new symbol. Instead, `cls.copySymDenotation` should be called.
1 parent 41388ee commit 5a6fbc2

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -251,9 +251,9 @@ class Constructors extends MiniPhase with IdentityDenotTransformer { thisPhase =
251251
// Drop accessors that are not retained from class scope
252252
if (dropped.nonEmpty) {
253253
val clsInfo = cls.classInfo
254-
cls.copy(
255-
info = clsInfo.derivedClassInfo(
256-
decls = clsInfo.decls.filteredScope(!dropped.contains(_))))
254+
val decls = clsInfo.decls.filteredScope(!dropped.contains(_))
255+
val clsInfo2 = clsInfo.derivedClassInfo(decls = decls)
256+
cls.copySymDenotation(info = clsInfo2).installAfter(thisPhase)
257257
// TODO: this happens to work only because Constructors is the last phase in group
258258
}
259259

0 commit comments

Comments
 (0)