@@ -193,59 +193,18 @@ object Types {
193
193
}
194
194
}
195
195
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
-
222
196
/** Is this type exactly Nothing (no vars, aliases, refinements etc allowed)? */
223
197
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
227
199
case _ => false
228
200
}
229
201
230
202
/** Is this type exactly Any (no vars, aliases, refinements etc allowed)? */
231
203
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
235
205
case _ => false
236
206
}
237
207
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
-
249
208
/** Is this type a (possibly aliased) singleton type? */
250
209
def isSingleton (implicit ctx : Context ) = dealias.isInstanceOf [SingletonType ]
251
210
@@ -2860,7 +2819,7 @@ object Types {
2860
2819
val dropDependencies = new ApproximatingTypeMap {
2861
2820
def apply (tp : Type ) = tp match {
2862
2821
case tp @ TermParamRef (thisLambdaType, _) =>
2863
- range(tp.bottomType , atVariance(1 )(apply(tp.underlying)))
2822
+ range(defn. NothingType , atVariance(1 )(apply(tp.underlying)))
2864
2823
case _ => mapOver(tp)
2865
2824
}
2866
2825
}
@@ -4177,7 +4136,7 @@ object Types {
4177
4136
case Range (infoLo : TypeBounds , infoHi : TypeBounds ) =>
4178
4137
assert(variance == 0 )
4179
4138
if (! infoLo.isAlias && ! infoHi.isAlias) propagate(infoLo, infoHi)
4180
- else range(tp.bottomType , tp.parent)
4139
+ else range(defn. NothingType , tp.parent)
4181
4140
case Range (infoLo, infoHi) =>
4182
4141
propagate(infoLo, infoHi)
4183
4142
case _ =>
@@ -4209,7 +4168,7 @@ object Types {
4209
4168
else tp.derivedTypeBounds(lo, hi)
4210
4169
4211
4170
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 )
4213
4172
else tp.derivedSuperType(thistp, supertp)
4214
4173
4215
4174
override protected def derivedAppliedType (tp : AppliedType , tycon : Type , args : List [Type ]): Type =
@@ -4246,7 +4205,7 @@ object Types {
4246
4205
if (distributeArgs(args, tp.typeParams))
4247
4206
range(tp.derivedAppliedType(tycon, loBuf.toList),
4248
4207
tp.derivedAppliedType(tycon, hiBuf.toList))
4249
- else range(tp.bottomType, tp.topType )
4208
+ else range(defn. NothingType , defn. AnyType )
4250
4209
// TODO: can we give a better bound than `topType`?
4251
4210
}
4252
4211
}
0 commit comments