Skip to content

Commit 552fffa

Browse files
committed
Preparations for changing of class hierarchy
1 parent 44cb461 commit 552fffa

File tree

4 files changed

+12
-19
lines changed

4 files changed

+12
-19
lines changed

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,9 @@ object Denotations {
179179
abstract class Denotation(_symbol: SymbolImpl, protected var myInfo: Type) extends PreDenotation with printing.Showable {
180180
type AsSeenFromResult <: Denotation
181181

182-
val symbol: Symbol = _symbol.fromSymbolImpl
182+
val symbol: Symbol =
183+
if _symbol == null then this.asInstanceOf[Symbol]
184+
else _symbol.fromSymbolImpl
183185

184186
/** The type info.
185187
* The info is an instance of TypeType iff this is a type denotation
@@ -573,7 +575,7 @@ object Denotations {
573575
abstract class SingleDenotation(_symbol: SymbolImpl, initInfo: Type) extends Denotation(_symbol, initInfo) {
574576
protected def newLikeThis(symbol: Symbol, info: Type, pre: Type): SingleDenotation
575577

576-
final def name(using Context): Name = symbol.name
578+
def name(using Context): Name = symbol.name
577579

578580
/** If this is not a SymDenotation: The prefix under which the denotation was constructed.
579581
* NoPrefix for SymDenotations.
@@ -773,7 +775,7 @@ object Denotations {
773775
assert(!d.is(Package), s"illegal transformation of package denotation by transformer $transformer")
774776
case _ =>
775777

776-
def escapeToNext = nextDefined.ensuring(_.validFor != Nowhere)
778+
def escapeToNext = nextDefined.ensuring(_.validFor != Nowhere, name)
777779

778780
def toNewRun =
779781
util.Stats.record("current.bringForward")

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ object Names {
2525
/** A common superclass of Name and Symbol. After bootstrap, this should be
2626
* just the type alias Name | Symbol
2727
*/
28-
abstract class Designator
28+
trait Designator
2929

3030
/** A name if either a term name or a type name. Term names can be simple
3131
* or derived. A simple term name is essentially an interned string stored

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ object SymDenotations {
3232
/** A sym-denotation represents the contents of a definition
3333
* during a period.
3434
*/
35-
class SymDenotation private[SymDenotations] (
35+
class SymDenotation private[core] (
3636
_symbol: SymbolImpl,
3737
final val _maybeOwner: SymbolImpl,
3838
final val name: Name,
@@ -543,7 +543,7 @@ object SymDenotations {
543543
final def isRealClass(using Context): Boolean = isClass && !is(Trait)
544544

545545
/** Cast to class denotation */
546-
final def asClass: ClassDenotation = asInstanceOf[ClassDenotation]
546+
def asClass: ClassDenotation = asInstanceOf[ClassDenotation]
547547

548548
/** is this symbol the result of an erroneous definition? */
549549
def isError: Boolean = false
@@ -2209,7 +2209,7 @@ object SymDenotations {
22092209

22102210
/** The contents of a class definition during a period
22112211
*/
2212-
class ClassDenotationImpl private[SymDenotations] (
2212+
class ClassDenotationImpl private[core] (
22132213
_symbol: SymbolImpl,
22142214
_maybeOwner: SymbolImpl,
22152215
name: Name,
@@ -2382,7 +2382,7 @@ object SymDenotations {
23822382
}
23832383
end PackageClassDenotation
23842384

2385-
class PackageClassDenotationImpl private[SymDenotations] (
2385+
class PackageClassDenotationImpl private[core] (
23862386
_symbol: SymbolImpl,
23872387
_maybeOwner: SymbolImpl,
23882388
name: Name,

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

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ import scala.annotation.internal.sharable
3636
import config.Printers.typr
3737
import annotation.targetName
3838

39-
object Symbols {
39+
object Symbols:
4040

4141
opaque type Symbol >: Null <: SymbolDecl = SymbolImpl
4242
opaque type ClassSymbol >: Null <: Symbol & ClassSymbolDecl = ClassSymbolImpl
@@ -102,19 +102,14 @@ object Symbols {
102102
def asTerm(using Context): TermSymbol
103103
def asType(using Context): TypeSymbol
104104

105-
@targetName("Symbol_isClass")
106105
def isClass: Boolean
107-
108-
@targetName("Symbol_asClass")
109106
def asClass: ClassSymbol
110107

111108
def isPrivate(using Context): Boolean
112109
def isPatternBound(using Context): Boolean
113110

114-
@targetName("Symbol_isStatic")
115111
def isStatic(using Context): Boolean
116112

117-
@targetName("Symbol_name")
118113
def name(using Context): ThisName
119114
def signature(using Context): Signature
120115

@@ -305,10 +300,8 @@ object Symbols {
305300
asInstanceOf[TypeSymbol]
306301
}
307302

308-
@targetName("Symbol_isClass")
309303
final def isClass: Boolean = isInstanceOf[ClassSymbol]
310304

311-
@targetName("Symbol_asClass")
312305
final def asClass: ClassSymbol = asInstanceOf[ClassSymbol]
313306

314307
/** Test whether symbol is private. This
@@ -333,7 +326,6 @@ object Symbols {
333326
Signature.NotAMethod
334327

335328
/** Special cased here, because it may be used on naked symbols in substituters */
336-
@targetName("Symbol_isStatic")
337329
final def isStatic(using Context): Boolean =
338330
lastDenot != null && lastDenot.initial.isStatic
339331

@@ -390,7 +382,6 @@ object Symbols {
390382
def filter(p: Symbol => Boolean): Symbol = if (p(this)) this else NoSymbol
391383

392384
/** The current name of this symbol */
393-
@targetName("Symbol_name")
394385
final def name(using Context): ThisName = denot.name.asInstanceOf[ThisName]
395386

396387
/** The source or class file from which this class or
@@ -1048,4 +1039,4 @@ object Symbols {
10481039
}
10491040

10501041
def requiredMethodRef(path: PreName)(using Context): TermRef = requiredMethod(path).termRef
1051-
}
1042+
end Symbols

0 commit comments

Comments
 (0)