@@ -230,7 +230,7 @@ object Types {
230230 */
231231 private final def phantomLatticeType (implicit ctx : Context ): Type = widen match {
232232 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
234234 case tp : AndOrType => tp.tp1.phantomLatticeType
235235 case _ => NoType
236236 }
@@ -822,9 +822,7 @@ object Types {
822822 (this eq thisResult) != (that eq thatResult) && (thisResult matchesLoosely thatResult)
823823 }
824824
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. */
828826 final def baseType (base : Symbol )(implicit ctx : Context ): Type = /* ctx.traceIndented(s"$this baseType $base")*/ /* >|>*/ track(" base type" ) /* <|<*/ {
829827 base.denot match {
830828 case classd : ClassDenotation => classd.baseTypeOf(this )
@@ -843,7 +841,7 @@ object Types {
843841 * which may end up calling `&` again, in most cases this should be safe
844842 * but because of F-bounded types, this can result in an infinite loop
845843 * (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.
847845 */
848846 def safe_& (that : Type )(implicit ctx : Context ): Type = (this , that) match {
849847 case (TypeBounds (lo1, hi1), TypeBounds (lo2, hi2)) => TypeBounds (OrType (lo1, lo2), AndType (hi1, hi2))
@@ -1020,7 +1018,7 @@ object Types {
10201018
10211019 /** If this is a (possibly aliased, annotated, and/or parameterized) reference to
10221020 * 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.
10241022 */
10251023 def underlyingClassRef (refinementOK : Boolean )(implicit ctx : Context ): Type = dealias match {
10261024 case tp : TypeRef =>
@@ -1477,7 +1475,7 @@ object Types {
14771475
14781476 /** Implementations of this trait cache the results of `narrow`. */
14791477 trait NarrowCached extends Type {
1480- private var myNarrow : TermRef = null
1478+ private [ this ] var myNarrow : TermRef = null
14811479 override def narrow (implicit ctx : Context ): TermRef = {
14821480 if (myNarrow eq null ) myNarrow = super .narrow
14831481 myNarrow
@@ -1817,9 +1815,6 @@ object Types {
18171815 }
18181816 }
18191817
1820- def isClassParam (implicit ctx : Context ) = // @!!! test flag combination instead?
1821- symbol.is(TypeParam ) && symbol.owner.isClass
1822-
18231818 /** A selection of the same kind, but with potentially a different prefix.
18241819 * The following normalizations are performed for type selections T#A:
18251820 *
@@ -1836,7 +1831,9 @@ object Types {
18361831 if (prefix eq this .prefix) this
18371832 else if (prefix.isBottomType) prefix
18381833 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)
18401837 if (res.exists) res
18411838 else if (Config .splitProjections)
18421839 prefix match {
@@ -2225,8 +2222,8 @@ object Types {
22252222 }
22262223
22272224 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
22302227 def ref (implicit ctx : Context ) = {
22312228 if (computed) assert(myRef != null )
22322229 else {
@@ -2588,7 +2585,7 @@ object Types {
25882585 final def isTypeLambda = isInstanceOf [TypeLambda ]
25892586 final def isHigherKinded = isInstanceOf [TypeProxy ]
25902587
2591- private var myParamRefs : List [ParamRefType ] = null
2588+ private [ this ] var myParamRefs : List [ParamRefType ] = null
25922589
25932590 def paramRefs : List [ParamRefType ] = {
25942591 if (myParamRefs == null ) myParamRefs = paramNames.indices.toList.map(newParamRef)
@@ -2683,8 +2680,8 @@ object Types {
26832680 }
26842681 else resType
26852682
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
26882685
26892686 private def depStatus (initial : DependencyStatus , tp : Type )(implicit ctx : Context ): DependencyStatus = {
26902687 def combine (x : DependencyStatus , y : DependencyStatus ) = {
@@ -3074,8 +3071,8 @@ object Types {
30743071 abstract case class AppliedType (tycon : Type , args : List [Type ])
30753072 extends CachedProxyType with ValueType {
30763073
3077- private var validSuper : Period = Nowhere
3078- private var cachedSuper : Type = _
3074+ private [ this ] var validSuper : Period = Nowhere
3075+ private [ this ] var cachedSuper : Type = _
30793076
30803077 override def underlying (implicit ctx : Context ): Type = tycon
30813078
@@ -3289,7 +3286,7 @@ object Types {
32893286
32903287 def withName (name : Name ): this .type = { myRepr = name; this }
32913288
3292- private var myRepr : Name = null
3289+ private [ this ] var myRepr : Name = null
32933290 def repr (implicit ctx : Context ): Name = {
32943291 if (myRepr == null ) myRepr = SkolemName .fresh()
32953292 myRepr
@@ -3415,8 +3412,8 @@ object Types {
34153412 decls : Scope ,
34163413 selfInfo : DotClass /* should be: Type | Symbol */ ) extends CachedGroundType with TypeType {
34173414
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
34203417
34213418 /** The self type of a class is the conjunction of
34223419 * - the explicit self type if given (or the info of a given self symbol), and
@@ -3449,7 +3446,7 @@ object Types {
34493446 def symbolicTypeRef (implicit ctx : Context ): TypeRef = TypeRef (prefix, cls)
34503447
34513448 // cached because baseType needs parents
3452- private var parentsCache : List [Type ] = null
3449+ private [ this ] var parentsCache : List [Type ] = null
34533450
34543451 override def parents (implicit ctx : Context ): List [Type ] = {
34553452 if (parentsCache == null )
@@ -3975,8 +3972,7 @@ object Types {
39753972 }
39763973
39773974 /** 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.
39803976 */
39813977 def tryWiden (tp : NamedType , pre : Type ): Type =
39823978 pre.member(tp.name) match {
@@ -4008,7 +4004,7 @@ object Types {
40084004 else pre match {
40094005 case Range (preLo, preHi) =>
40104006 val forwarded =
4011- if (tp.isClassParam ) tp.argForParam(preHi)
4007+ if (tp.symbol.is( ClassTypeParam ) ) tp.argForParam(preHi)
40124008 else tryWiden(tp, preHi)
40134009 forwarded.orElse(
40144010 range(super .derivedSelect(tp, preLo), super .derivedSelect(tp, preHi)))
0 commit comments