@@ -142,9 +142,12 @@ object Types {
142142 /** Is this type a value type? */
143143 final def isValueType : Boolean = this .isInstanceOf [ValueType ]
144144
145- /** Is the is value type or type lambda? */
145+ /** Is this a value type or a type lambda? */
146146 final def isValueTypeOrLambda : Boolean = isValueType || this .isInstanceOf [TypeLambda ]
147147
148+ /** Is this a value type or a wildcard? */
149+ final def isValueTypeOrWildcard : Boolean = isValueType || this .isInstanceOf [WildcardType ]
150+
148151 /** Does this type denote a stable reference (i.e. singleton type)? */
149152 final def isStable (implicit ctx : Context ): Boolean = stripTypeVar match {
150153 case tp : TermRef => tp.termSymbol.isStable && tp.prefix.isStable || tp.info.isStable
@@ -589,13 +592,14 @@ object Types {
589592
590593 def goRefined (tp : RefinedType ) = {
591594 val pdenot = go(tp.parent)
595+ val pinfo = pdenot.info
592596 val rinfo = tp.refinedInfo
593- if (name.isTypeName) { // simplified case that runs more efficiently
597+ if (name.isTypeName && ! pinfo. isInstanceOf [ ClassInfo ] ) { // simplified case that runs more efficiently
594598 val jointInfo =
595599 if (rinfo.isAlias) rinfo
596- else if (pdenot.info. isAlias) pdenot.info
597- else if (ctx.pendingMemberSearches.contains(name)) pdenot.info safe_& rinfo
598- else pdenot.info recoverable_& rinfo
600+ else if (pinfo. isAlias) pinfo
601+ else if (ctx.pendingMemberSearches.contains(name)) pinfo safe_& rinfo
602+ else pinfo recoverable_& rinfo
599603 pdenot.asSingleDenotation.derivedSingleDenotation(pdenot.symbol, jointInfo)
600604 } else {
601605 pdenot & (
@@ -1523,11 +1527,8 @@ object Types {
15231527 /** A marker trait for types that can be types of values or prototypes of value types */
15241528 trait ValueTypeOrProto extends TermType
15251529
1526- /** A marker trait for types that can be types of values or wildcards */
1527- trait ValueTypeOrWildcard extends TermType
1528-
15291530 /** A marker trait for types that can be types of values or that are higher-kinded */
1530- trait ValueType extends ValueTypeOrProto with ValueTypeOrWildcard
1531+ trait ValueType extends ValueTypeOrProto
15311532
15321533 /** A marker trait for types that are guaranteed to contain only a
15331534 * single non-null value (they might contain null in addition).
@@ -2479,8 +2480,8 @@ object Types {
24792480
24802481 object AndType {
24812482 def apply (tp1 : Type , tp2 : Type )(implicit ctx : Context ): AndType = {
2482- assert(tp1.isInstanceOf [ ValueTypeOrWildcard ] &&
2483- tp2.isInstanceOf [ ValueTypeOrWildcard ] , i " $tp1 & $tp2 / " + s " $tp1 & $tp2" )
2483+ assert(tp1.isValueTypeOrWildcard &&
2484+ tp2.isValueTypeOrWildcard , i " $tp1 & $tp2 / " + s " $tp1 & $tp2" )
24842485 unchecked(tp1, tp2)
24852486 }
24862487
@@ -2524,8 +2525,8 @@ object Types {
25242525 myBaseClasses
25252526 }
25262527
2527- assert(tp1.isInstanceOf [ ValueTypeOrWildcard ] &&
2528- tp2.isInstanceOf [ ValueTypeOrWildcard ] , s " $tp1 $tp2" )
2528+ assert(tp1.isValueTypeOrWildcard &&
2529+ tp2.isValueTypeOrWildcard , s " $tp1 $tp2" )
25292530
25302531 private [this ] var myJoin : Type = _
25312532 private [this ] var myJoinPeriod : Period = Nowhere
@@ -3477,7 +3478,7 @@ object Types {
34773478 if (selfTypeCache == null )
34783479 selfTypeCache = {
34793480 val given = cls.givenSelfType
3480- if (! given .exists ) appliedRef
3481+ if (! given .isValueType ) appliedRef
34813482 else if (cls is Module ) given
34823483 else if (ctx.erasedTypes) appliedRef
34833484 else AndType (given , appliedRef)
@@ -3756,7 +3757,7 @@ object Types {
37563757 object TryDynamicCallType extends FlexType
37573758
37583759 /** Wildcard type, possibly with bounds */
3759- abstract case class WildcardType (optBounds : Type ) extends CachedGroundType with ValueTypeOrWildcard {
3760+ abstract case class WildcardType (optBounds : Type ) extends CachedGroundType with TermType {
37603761 def derivedWildcardType (optBounds : Type )(implicit ctx : Context ) =
37613762 if (optBounds eq this .optBounds) this
37623763 else if (! optBounds.exists) WildcardType
0 commit comments