Skip to content

Commit 4600a11

Browse files
committed
Make ClassDenotation a trait (reverted from commit 7c88a80)
1 parent a87bc1b commit 4600a11

File tree

1 file changed

+20
-6
lines changed

1 file changed

+20
-6
lines changed

compiler/src/dotty/tools/dotc/core/SymDenotations.scala

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ trait SymDenotations { this: Context =>
3939
initPrivateWithin: Symbol = NoSymbol)(implicit ctx: Context): SymDenotation = {
4040
val result =
4141
if (symbol.isClass)
42-
if (initFlags is Package) new SymDenotation(symbol, owner, name, initFlags, initInfo, initPrivateWithin) with PackageClassDenotation
43-
else new SymDenotation(symbol, owner, name, initFlags, initInfo, initPrivateWithin) with ClassDenotation
42+
if (initFlags is Package) new PackageClassDenotation(symbol, owner, name, initFlags, initInfo, initPrivateWithin)
43+
else new ClassDenotation(symbol, owner, name, initFlags, initInfo, initPrivateWithin)
4444
else new SymDenotation(symbol, owner, name, initFlags, initInfo, initPrivateWithin)
4545
result.validFor = stablePeriod
4646
result
@@ -1282,7 +1282,14 @@ object SymDenotations {
12821282

12831283
/** The contents of a class definition during a period
12841284
*/
1285-
trait ClassDenotation extends SymDenotation {
1285+
class ClassDenotation private[SymDenotations] (
1286+
symbol: Symbol,
1287+
maybeOwner: Symbol,
1288+
name: Name,
1289+
initFlags: FlagSet,
1290+
initInfo: Type,
1291+
initPrivateWithin: Symbol)
1292+
extends SymDenotation(symbol, maybeOwner, name, initFlags, initInfo, initPrivateWithin) {
12861293

12871294
import util.LRUCache
12881295

@@ -1350,8 +1357,8 @@ object SymDenotations {
13501357

13511358
// ----- denotation fields and accessors ------------------------------
13521359

1353-
//if (initFlags is (Module, butNot = Package))
1354-
// assert(name.is(ModuleClassName), s"module naming inconsistency: ${name.debugString}")
1360+
if (initFlags is (Module, butNot = Package))
1361+
assert(name.is(ModuleClassName), s"module naming inconsistency: ${name.debugString}")
13551362

13561363
/** The symbol asserted to have type ClassSymbol */
13571364
def classSymbol: ClassSymbol = symbol.asInstanceOf[ClassSymbol]
@@ -1803,7 +1810,14 @@ object SymDenotations {
18031810
/** The denotation of a package class.
18041811
* It overrides ClassDenotation to take account of package objects when looking for members
18051812
*/
1806-
trait PackageClassDenotation extends ClassDenotation {
1813+
final class PackageClassDenotation private[SymDenotations] (
1814+
symbol: Symbol,
1815+
ownerIfExists: Symbol,
1816+
name: Name,
1817+
initFlags: FlagSet,
1818+
initInfo: Type,
1819+
initPrivateWithin: Symbol)
1820+
extends ClassDenotation(symbol, ownerIfExists, name, initFlags, initInfo, initPrivateWithin) {
18071821

18081822
private[this] var packageObjCache: SymDenotation = _
18091823
private[this] var packageObjRunId: RunId = NoRunId

0 commit comments

Comments
 (0)