Skip to content

Commit 7c88a80

Browse files
committed
Make ClassDenotation a trait
1 parent d14c89b commit 7c88a80

File tree

1 file changed

+6
-20
lines changed

1 file changed

+6
-20
lines changed

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

Lines changed: 6 additions & 20 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 PackageClassDenotation(symbol, owner, name, initFlags, initInfo, initPrivateWithin)
43-
else new ClassDenotation(symbol, owner, name, initFlags, initInfo, initPrivateWithin)
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
4444
else new SymDenotation(symbol, owner, name, initFlags, initInfo, initPrivateWithin)
4545
result.validFor = stablePeriod
4646
result
@@ -1278,14 +1278,7 @@ object SymDenotations {
12781278

12791279
/** The contents of a class definition during a period
12801280
*/
1281-
class ClassDenotation private[SymDenotations] (
1282-
symbol: Symbol,
1283-
maybeOwner: Symbol,
1284-
name: Name,
1285-
initFlags: FlagSet,
1286-
initInfo: Type,
1287-
initPrivateWithin: Symbol)
1288-
extends SymDenotation(symbol, maybeOwner, name, initFlags, initInfo, initPrivateWithin) {
1281+
trait ClassDenotation extends SymDenotation {
12891282

12901283
import util.LRUCache
12911284

@@ -1351,8 +1344,8 @@ object SymDenotations {
13511344

13521345
// ----- denotation fields and accessors ------------------------------
13531346

1354-
if (initFlags is (Module, butNot = Package))
1355-
assert(name.is(ModuleClassName), s"module naming inconsistency: ${name.debugString}")
1347+
//if (initFlags is (Module, butNot = Package))
1348+
// assert(name.is(ModuleClassName), s"module naming inconsistency: ${name.debugString}")
13561349

13571350
/** The symbol asserted to have type ClassSymbol */
13581351
def classSymbol: ClassSymbol = symbol.asInstanceOf[ClassSymbol]
@@ -1804,14 +1797,7 @@ object SymDenotations {
18041797
/** The denotation of a package class.
18051798
* It overrides ClassDenotation to take account of package objects when looking for members
18061799
*/
1807-
final class PackageClassDenotation private[SymDenotations] (
1808-
symbol: Symbol,
1809-
ownerIfExists: Symbol,
1810-
name: Name,
1811-
initFlags: FlagSet,
1812-
initInfo: Type,
1813-
initPrivateWithin: Symbol)
1814-
extends ClassDenotation(symbol, ownerIfExists, name, initFlags, initInfo, initPrivateWithin) {
1800+
trait PackageClassDenotation extends ClassDenotation {
18151801

18161802
private[this] var packageObjCache: SymDenotation = _
18171803
private[this] var packageObjRunId: RunId = NoRunId

0 commit comments

Comments
 (0)