@@ -1601,17 +1601,7 @@ object SymDenotations {
1601
1601
end children
1602
1602
}
1603
1603
1604
- /** The contents of a class definition during a period
1605
- */
1606
- class ClassDenotation private [SymDenotations ] (
1607
- symbol : Symbol ,
1608
- maybeOwner : Symbol ,
1609
- name : Name ,
1610
- initFlags : FlagSet ,
1611
- initInfo : Type ,
1612
- initPrivateWithin : Symbol )
1613
- extends SymDenotation (symbol, maybeOwner, name, initFlags, initInfo, initPrivateWithin) {
1614
-
1604
+ trait ClassDenotation extends SymDenotation :
1615
1605
import util .EqHashMap
1616
1606
1617
1607
// ----- caches -------------------------------------------------------
@@ -1687,7 +1677,7 @@ object SymDenotations {
1687
1677
1688
1678
// ----- denotation fields and accessors ------------------------------
1689
1679
1690
- if (initFlags .is(Module , butNot = Package ))
1680
+ if (flagsUNSAFE .is(Module , butNot = Package ))
1691
1681
assert(name.is(ModuleClassName ), s " module naming inconsistency: ${name.debugString}" )
1692
1682
1693
1683
/** The symbol asserted to have type ClassSymbol */
@@ -2213,19 +2203,24 @@ object SymDenotations {
2213
2203
override def nestingLevel (using Context ) =
2214
2204
if myNestingLevel == - 1 then myNestingLevel = owner.nestingLevel + 1
2215
2205
myNestingLevel
2216
- }
2206
+ end ClassDenotation
2217
2207
2218
- /** The denotation of a package class.
2219
- * It overrides ClassDenotation to take account of package objects when looking for members
2208
+ /** The contents of a class definition during a period
2220
2209
*/
2221
- final class PackageClassDenotation private [SymDenotations ] (
2210
+ class ClassDenotationImpl private [SymDenotations ] (
2222
2211
symbol : Symbol ,
2223
- ownerIfExists : Symbol ,
2212
+ maybeOwner : Symbol ,
2224
2213
name : Name ,
2225
2214
initFlags : FlagSet ,
2226
2215
initInfo : Type ,
2227
2216
initPrivateWithin : Symbol )
2228
- extends ClassDenotation (symbol, ownerIfExists, name, initFlags, initInfo, initPrivateWithin) {
2217
+ extends SymDenotation (symbol, maybeOwner, name, initFlags, initInfo, initPrivateWithin),
2218
+ ClassDenotation
2219
+
2220
+ /** The denotation of a package class.
2221
+ * It overrides ClassDenotation to take account of package objects when looking for members
2222
+ */
2223
+ trait PackageClassDenotation extends ClassDenotation :
2229
2224
2230
2225
private var packageObjsCache : List [ClassDenotation ] = _
2231
2226
private var packageObjsRunId : RunId = NoRunId
@@ -2383,7 +2378,18 @@ object SymDenotations {
2383
2378
if (sym.defRunId != ctx.runId && sym.isClass && sym.asClass.assocFile == file)
2384
2379
scope.unlink(sym, sym.lastKnownDenotation.name)
2385
2380
}
2386
- }
2381
+ end PackageClassDenotation
2382
+
2383
+ class PackageClassDenotationImpl private [SymDenotations ] (
2384
+ symbol : Symbol ,
2385
+ ownerIfExists : Symbol ,
2386
+ name : Name ,
2387
+ initFlags : FlagSet ,
2388
+ initInfo : Type ,
2389
+ initPrivateWithin : Symbol )
2390
+ extends
2391
+ ClassDenotationImpl (symbol, ownerIfExists, name, initFlags, initInfo, initPrivateWithin),
2392
+ PackageClassDenotation
2387
2393
2388
2394
@ sharable object NoDenotation
2389
2395
extends SymDenotation (NoSymbol , NoSymbol , " <none>" .toTermName, Permanent , NoType ) {
@@ -2428,8 +2434,8 @@ object SymDenotations {
2428
2434
initPrivateWithin : Symbol = NoSymbol )(using Context ): SymDenotation = {
2429
2435
val result =
2430
2436
if (symbol.isClass)
2431
- if (initFlags.is(Package )) new PackageClassDenotation (symbol, owner, name, initFlags, initInfo, initPrivateWithin)
2432
- else new ClassDenotation (symbol, owner, name, initFlags, initInfo, initPrivateWithin)
2437
+ if (initFlags.is(Package )) new PackageClassDenotationImpl (symbol, owner, name, initFlags, initInfo, initPrivateWithin)
2438
+ else new ClassDenotationImpl (symbol, owner, name, initFlags, initInfo, initPrivateWithin)
2433
2439
else new SymDenotation (symbol, owner, name, initFlags, initInfo, initPrivateWithin)
2434
2440
result.validFor = currentStablePeriod
2435
2441
result
0 commit comments