@@ -193,59 +193,18 @@ object Types {
193193 }
194194 }
195195
196- /** Returns true if the type is a phantom type
197- * - true if XYZ extends scala.Phantom and this type is upper bounded XYZ.Any
198- * - false otherwise
199- */
200- final def isPhantom (implicit ctx : Context ): Boolean = phantomLatticeType.exists
201-
202- /** Returns the top type of the lattice
203- * - XYX.Any if XYZ extends scala.Phantom and this type is upper bounded XYZ.Any
204- * - scala.Any otherwise
205- */
206- final def topType (implicit ctx : Context ): Type = {
207- val lattice = phantomLatticeType
208- if (lattice.exists) lattice.select(tpnme.Any )
209- else defn.AnyType
210- }
211-
212- /** Returns the bottom type of the lattice
213- * - XYZ.Nothing if XYZ extends scala.Phantom and this type is upper bounded XYZ.Any
214- * - scala.Nothing otherwise
215- */
216- final def bottomType (implicit ctx : Context ): Type = {
217- val lattice = phantomLatticeType
218- if (lattice.exists) lattice.select(tpnme.Nothing )
219- else defn.NothingType
220- }
221-
222196 /** Is this type exactly Nothing (no vars, aliases, refinements etc allowed)? */
223197 def isBottomType (implicit ctx : Context ): Boolean = this match {
224- case tp : TypeRef =>
225- val sym = tp.symbol
226- (sym eq defn.NothingClass ) || (sym eq defn.Phantom_NothingClass )
198+ case tp : TypeRef => tp.symbol eq defn.NothingClass
227199 case _ => false
228200 }
229201
230202 /** Is this type exactly Any (no vars, aliases, refinements etc allowed)? */
231203 def isTopType (implicit ctx : Context ): Boolean = this match {
232- case tp : TypeRef =>
233- val sym = tp.symbol
234- (sym eq defn.AnyClass ) || (sym eq defn.Phantom_AnyClass )
204+ case tp : TypeRef => tp.symbol eq defn.AnyClass
235205 case _ => false
236206 }
237207
238- /** Returns the type of the phantom lattice (i.e. the prefix of the phantom type)
239- * - XYZ if XYZ extends scala.Phantom and this type is upper bounded XYZ.Any
240- * - NoType otherwise
241- */
242- private final def phantomLatticeType (implicit ctx : Context ): Type = widen match {
243- case tp : ClassInfo if defn.isPhantomTerminalClass(tp.classSymbol) => tp.prefix
244- case tp : TypeProxy => tp.underlying.phantomLatticeType
245- case tp : AndOrType => tp.tp1.phantomLatticeType
246- case _ => NoType
247- }
248-
249208 /** Is this type a (possibly aliased) singleton type? */
250209 def isSingleton (implicit ctx : Context ) = dealias.isInstanceOf [SingletonType ]
251210
@@ -2860,7 +2819,7 @@ object Types {
28602819 val dropDependencies = new ApproximatingTypeMap {
28612820 def apply (tp : Type ) = tp match {
28622821 case tp @ TermParamRef (thisLambdaType, _) =>
2863- range(tp.bottomType , atVariance(1 )(apply(tp.underlying)))
2822+ range(defn. NothingType , atVariance(1 )(apply(tp.underlying)))
28642823 case _ => mapOver(tp)
28652824 }
28662825 }
@@ -4177,7 +4136,7 @@ object Types {
41774136 case Range (infoLo : TypeBounds , infoHi : TypeBounds ) =>
41784137 assert(variance == 0 )
41794138 if (! infoLo.isAlias && ! infoHi.isAlias) propagate(infoLo, infoHi)
4180- else range(tp.bottomType , tp.parent)
4139+ else range(defn. NothingType , tp.parent)
41814140 case Range (infoLo, infoHi) =>
41824141 propagate(infoLo, infoHi)
41834142 case _ =>
@@ -4209,7 +4168,7 @@ object Types {
42094168 else tp.derivedTypeBounds(lo, hi)
42104169
42114170 override protected def derivedSuperType (tp : SuperType , thistp : Type , supertp : Type ) =
4212- if (isRange(thistp) || isRange(supertp)) range(thistp.bottomType, thistp.topType )
4171+ if (isRange(thistp) || isRange(supertp)) range(defn. NothingType , defn. AnyType )
42134172 else tp.derivedSuperType(thistp, supertp)
42144173
42154174 override protected def derivedAppliedType (tp : AppliedType , tycon : Type , args : List [Type ]): Type =
@@ -4246,7 +4205,7 @@ object Types {
42464205 if (distributeArgs(args, tp.typeParams))
42474206 range(tp.derivedAppliedType(tycon, loBuf.toList),
42484207 tp.derivedAppliedType(tycon, hiBuf.toList))
4249- else range(tp.bottomType, tp.topType )
4208+ else range(defn. NothingType , defn. AnyType )
42504209 // TODO: can we give a better bound than `topType`?
42514210 }
42524211 }
0 commit comments