@@ -230,7 +230,7 @@ object Types {
230
230
*/
231
231
private final def phantomLatticeType (implicit ctx : Context ): Type = widen match {
232
232
case tp : ClassInfo if defn.isPhantomTerminalClass(tp.classSymbol) => tp.prefix
233
- case tp : TypeProxy if tp.superType ne this => tp.underlying.phantomLatticeType // ??? guard needed ???
233
+ case tp : TypeProxy => tp.underlying.phantomLatticeType
234
234
case tp : AndOrType => tp.tp1.phantomLatticeType
235
235
case _ => NoType
236
236
}
@@ -822,9 +822,7 @@ object Types {
822
822
(this eq thisResult) != (that eq thatResult) && (thisResult matchesLoosely thatResult)
823
823
}
824
824
825
- /** The basetype TypeRef of this type with given class symbol,
826
- * but without including any type arguments
827
- */
825
+ /** The basetype of this type with given class symbol, NoType is `base` is not a class. */
828
826
final def baseType (base : Symbol )(implicit ctx : Context ): Type = /* ctx.traceIndented(s"$this baseType $base")*/ /* >|>*/ track(" base type" ) /* <|<*/ {
829
827
base.denot match {
830
828
case classd : ClassDenotation => classd.baseTypeOf(this )
@@ -843,7 +841,7 @@ object Types {
843
841
* which may end up calling `&` again, in most cases this should be safe
844
842
* but because of F-bounded types, this can result in an infinite loop
845
843
* (which will be masked unless `-Yno-deep-subtypes` is enabled).
846
- * pos/i536 demonstrates that the infinite loop can also invole lower bounds.wait
844
+ * pos/i536 demonstrates that the infinite loop can also involve lower bounds.
847
845
*/
848
846
def safe_& (that : Type )(implicit ctx : Context ): Type = (this , that) match {
849
847
case (TypeBounds (lo1, hi1), TypeBounds (lo2, hi2)) => TypeBounds (OrType (lo1, lo2), AndType (hi1, hi2))
@@ -1020,7 +1018,7 @@ object Types {
1020
1018
1021
1019
/** If this is a (possibly aliased, annotated, and/or parameterized) reference to
1022
1020
* a class, the class type ref, otherwise NoType.
1023
- * @param refinementOK If `true` we also skip non-parameter refinements.
1021
+ * @param refinementOK If `true` we also skip refinements.
1024
1022
*/
1025
1023
def underlyingClassRef (refinementOK : Boolean )(implicit ctx : Context ): Type = dealias match {
1026
1024
case tp : TypeRef =>
@@ -1477,7 +1475,7 @@ object Types {
1477
1475
1478
1476
/** Implementations of this trait cache the results of `narrow`. */
1479
1477
trait NarrowCached extends Type {
1480
- private var myNarrow : TermRef = null
1478
+ private [ this ] var myNarrow : TermRef = null
1481
1479
override def narrow (implicit ctx : Context ): TermRef = {
1482
1480
if (myNarrow eq null ) myNarrow = super .narrow
1483
1481
myNarrow
@@ -1817,9 +1815,6 @@ object Types {
1817
1815
}
1818
1816
}
1819
1817
1820
- def isClassParam (implicit ctx : Context ) = // @!!! test flag combination instead?
1821
- symbol.is(TypeParam ) && symbol.owner.isClass
1822
-
1823
1818
/** A selection of the same kind, but with potentially a different prefix.
1824
1819
* The following normalizations are performed for type selections T#A:
1825
1820
*
@@ -1836,7 +1831,9 @@ object Types {
1836
1831
if (prefix eq this .prefix) this
1837
1832
else if (prefix.isBottomType) prefix
1838
1833
else if (isType) {
1839
- val res = if (isClassParam) argForParam(prefix) else prefix.lookupRefined(name)
1834
+ val res =
1835
+ if (symbol.is(ClassTypeParam )) argForParam(prefix)
1836
+ else prefix.lookupRefined(name)
1840
1837
if (res.exists) res
1841
1838
else if (Config .splitProjections)
1842
1839
prefix match {
@@ -2225,8 +2222,8 @@ object Types {
2225
2222
}
2226
2223
2227
2224
case class LazyRef (private var refFn : Context => Type ) extends UncachedProxyType with ValueType {
2228
- private var myRef : Type = null
2229
- private var computed = false
2225
+ private [ this ] var myRef : Type = null
2226
+ private [ this ] var computed = false
2230
2227
def ref (implicit ctx : Context ) = {
2231
2228
if (computed) assert(myRef != null )
2232
2229
else {
@@ -2588,7 +2585,7 @@ object Types {
2588
2585
final def isTypeLambda = isInstanceOf [TypeLambda ]
2589
2586
final def isHigherKinded = isInstanceOf [TypeProxy ]
2590
2587
2591
- private var myParamRefs : List [ParamRefType ] = null
2588
+ private [ this ] var myParamRefs : List [ParamRefType ] = null
2592
2589
2593
2590
def paramRefs : List [ParamRefType ] = {
2594
2591
if (myParamRefs == null ) myParamRefs = paramNames.indices.toList.map(newParamRef)
@@ -2683,8 +2680,8 @@ object Types {
2683
2680
}
2684
2681
else resType
2685
2682
2686
- private var myDependencyStatus : DependencyStatus = Unknown
2687
- private var myParamDependencyStatus : DependencyStatus = Unknown
2683
+ private [ this ] var myDependencyStatus : DependencyStatus = Unknown
2684
+ private [ this ] var myParamDependencyStatus : DependencyStatus = Unknown
2688
2685
2689
2686
private def depStatus (initial : DependencyStatus , tp : Type )(implicit ctx : Context ): DependencyStatus = {
2690
2687
def combine (x : DependencyStatus , y : DependencyStatus ) = {
@@ -3074,8 +3071,8 @@ object Types {
3074
3071
abstract case class AppliedType (tycon : Type , args : List [Type ])
3075
3072
extends CachedProxyType with ValueType {
3076
3073
3077
- private var validSuper : Period = Nowhere
3078
- private var cachedSuper : Type = _
3074
+ private [ this ] var validSuper : Period = Nowhere
3075
+ private [ this ] var cachedSuper : Type = _
3079
3076
3080
3077
override def underlying (implicit ctx : Context ): Type = tycon
3081
3078
@@ -3289,7 +3286,7 @@ object Types {
3289
3286
3290
3287
def withName (name : Name ): this .type = { myRepr = name; this }
3291
3288
3292
- private var myRepr : Name = null
3289
+ private [ this ] var myRepr : Name = null
3293
3290
def repr (implicit ctx : Context ): Name = {
3294
3291
if (myRepr == null ) myRepr = SkolemName .fresh()
3295
3292
myRepr
@@ -3415,8 +3412,8 @@ object Types {
3415
3412
decls : Scope ,
3416
3413
selfInfo : DotClass /* should be: Type | Symbol */ ) extends CachedGroundType with TypeType {
3417
3414
3418
- private var selfTypeCache : Type = null
3419
- private var appliedRefCache : Type = null
3415
+ private [ this ] var selfTypeCache : Type = null
3416
+ private [ this ] var appliedRefCache : Type = null
3420
3417
3421
3418
/** The self type of a class is the conjunction of
3422
3419
* - the explicit self type if given (or the info of a given self symbol), and
@@ -3449,7 +3446,7 @@ object Types {
3449
3446
def symbolicTypeRef (implicit ctx : Context ): TypeRef = TypeRef (prefix, cls)
3450
3447
3451
3448
// cached because baseType needs parents
3452
- private var parentsCache : List [Type ] = null
3449
+ private [ this ] var parentsCache : List [Type ] = null
3453
3450
3454
3451
override def parents (implicit ctx : Context ): List [Type ] = {
3455
3452
if (parentsCache == null )
@@ -3975,8 +3972,7 @@ object Types {
3975
3972
}
3976
3973
3977
3974
/** Try to widen a named type to its info relative to given prefix `pre`, where possible.
3978
- * The possible cases are listed inline in the code. Return `default` if no widening is
3979
- * possible.
3975
+ * The possible cases are listed inline in the code.
3980
3976
*/
3981
3977
def tryWiden (tp : NamedType , pre : Type ): Type =
3982
3978
pre.member(tp.name) match {
@@ -4008,7 +4004,7 @@ object Types {
4008
4004
else pre match {
4009
4005
case Range (preLo, preHi) =>
4010
4006
val forwarded =
4011
- if (tp.isClassParam ) tp.argForParam(preHi)
4007
+ if (tp.symbol.is( ClassTypeParam ) ) tp.argForParam(preHi)
4012
4008
else tryWiden(tp, preHi)
4013
4009
forwarded.orElse(
4014
4010
range(super .derivedSelect(tp, preLo), super .derivedSelect(tp, preHi)))
0 commit comments