Skip to content

Commit 61306bd

Browse files
committed
Improve names of phantom classes in defn.
1 parent 41944a6 commit 61306bd

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -976,8 +976,8 @@ class Definitions {
976976

977977
cls
978978
}
979-
lazy val PhantomAny = PhantomClass.unforcedDecls.find(_.name eq tpnme.Any).asClass
980-
lazy val PhantomNothing = PhantomClass.unforcedDecls.find(_.name eq tpnme.Nothing).asClass
979+
lazy val PhantomAnyClass = PhantomClass.unforcedDecls.find(_.name eq tpnme.Any).asClass
980+
lazy val PhantomNothingClass = PhantomClass.unforcedDecls.find(_.name eq tpnme.Nothing).asClass
981981
lazy val PhantomAssume = PhantomClass.unforcedDecls.find(_.name eq nme.assume_)
982982

983983
lazy val ErasedPhantomClass = ctx.requiredClass("dotty.runtime.ErasedPhantom")

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -654,7 +654,7 @@ object SymDenotations {
654654
/** Is this symbol a class references to which that are supertypes of null? */
655655
final def isNullableClass(implicit ctx: Context): Boolean = {
656656
isClass && !isValueClass && !(this is ModuleClass) &&
657-
symbol != defn.NothingClass && symbol != defn.PhantomAny && symbol != defn.PhantomNothing
657+
symbol != defn.NothingClass && symbol != defn.PhantomAnyClass && symbol != defn.PhantomNothingClass
658658
}
659659

660660
/** Is this definition accessible as a member of tree with type `pre`?

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,11 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling {
6767
myNullClass
6868
}
6969
def PhantomAnyClass = {
70-
if (myPhantomAnyClass == null) myPhantomAnyClass = defn.PhantomAny
70+
if (myPhantomAnyClass == null) myPhantomAnyClass = defn.PhantomAnyClass
7171
myPhantomAnyClass
7272
}
7373
def PhantomNothingClass = {
74-
if (myPhantomNothingClass == null) myPhantomNothingClass = defn.PhantomNothing
74+
if (myPhantomNothingClass == null) myPhantomNothingClass = defn.PhantomNothingClass
7575
myPhantomNothingClass
7676
}
7777
def ObjectClass = {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ class TypeErasure(isJava: Boolean, semiEraseVCs: Boolean, isConstructor: Boolean
364364
else if (semiEraseVCs && isDerivedValueClass(sym)) eraseDerivedValueClassRef(tp)
365365
else if (sym == defn.ArrayClass) apply(tp.appliedTo(TypeBounds.empty)) // i966 shows that we can hit a raw Array type.
366366
else if (defn.isSyntheticFunctionClass(sym)) defn.erasedFunctionType(sym)
367-
else if ((tp.symbol eq defn.PhantomAny) || (tp.symbol eq defn.PhantomNothing)) defn.ErasedPhantomType
367+
else if ((tp.symbol eq defn.PhantomAnyClass) || (tp.symbol eq defn.PhantomNothingClass)) defn.ErasedPhantomType
368368
else eraseNormalClassRef(tp)
369369
case tp: RefinedType =>
370370
val parent = tp.parent
@@ -507,7 +507,7 @@ class TypeErasure(isJava: Boolean, semiEraseVCs: Boolean, isConstructor: Boolean
507507
}
508508
if (defn.isSyntheticFunctionClass(sym))
509509
sigName(defn.erasedFunctionType(sym))
510-
else if ((tp.symbol eq defn.PhantomAny) || (tp.symbol eq defn.PhantomNothing))
510+
else if ((tp.symbol eq defn.PhantomAnyClass) || (tp.symbol eq defn.PhantomNothingClass))
511511
sigName(defn.ErasedPhantomType)
512512
else
513513
normalizeClass(sym.asClass).fullName.asTypeName

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ object Types {
208208

209209
/** If the symbol is of the class scala.Phantom.Any or scala.Phantom.Nothing */
210210
private def isPhantomClass(sym: Symbol)(implicit ctx: Context): Boolean =
211-
(sym eq defn.PhantomAny) || (sym eq defn.PhantomNothing)
211+
(sym eq defn.PhantomAnyClass) || (sym eq defn.PhantomNothingClass)
212212

213213
/** Is this type guaranteed not to have `null` as a value?
214214
* For the moment this is only true for modules, but it could

0 commit comments

Comments
 (0)