@@ -1536,19 +1536,24 @@ object Types {
1536
1536
/** A selection of the same kind, but with potentially a differet prefix.
1537
1537
* The following normalizations are performed for type selections T#A:
1538
1538
*
1539
- * 1. If Config.splitProjections is true:
1539
+ * T#A --> B if A is bound to an alias `= B` in T
1540
1540
*
1541
- * (S & T)#A --> S#A & T#A
1541
+ * (S & T)#A --> S#A if T does not have a member namd A
1542
+ * --> T#A if S does not have a member namd A
1543
+ * --> S#A & T#A otherwise
1542
1544
* (S | T)#A --> S#A | T#A
1543
- *
1544
- * 2. If A is bound to an alias `= B` in T
1545
- *
1546
- * T#A --> B
1547
1545
*/
1548
1546
def derivedSelect (prefix : Type )(implicit ctx : Context ): Type =
1549
1547
if (prefix eq this .prefix) this
1550
- else {
1551
- if (Config .splitProjections && isType)
1548
+ else if (isType) {
1549
+ val res = prefix.lookupRefined(name)
1550
+ if (res.exists) res
1551
+ else if (name == tpnme.hkApply && prefix.classNotLambda)
1552
+ // After substitution we might end up with a type like
1553
+ // `C { type hk$0 = T0; ...; type hk$n = Tn } # $Apply`
1554
+ // where C is a class. In that case we eta expand `C`.
1555
+ derivedSelect(prefix.EtaExpandCore (this .prefix.typeConstructor.typeParams))
1556
+ else if (Config .splitProjections)
1552
1557
prefix match {
1553
1558
case prefix : AndType =>
1554
1559
def isMissing (tp : Type ) = tp match {
@@ -1566,16 +1571,11 @@ object Types {
1566
1571
val derived2 = derivedSelect(prefix.tp2)
1567
1572
return prefix.derivedOrType(derived1, derived2)
1568
1573
case _ =>
1574
+ newLikeThis(prefix)
1569
1575
}
1570
- val res = prefix.lookupRefined(name)
1571
- if (res.exists) res
1572
- else if (name == tpnme.hkApply && prefix.classNotLambda) {
1573
- // After substitution we might end up with a type like
1574
- // `C { type hk$0 = T0; ...; type hk$n = Tn } # $Apply`
1575
- // where C is a class. In that case we eta expand `C`.
1576
- derivedSelect(prefix.EtaExpandCore (this .prefix.typeConstructor.typeParams))
1577
- } else newLikeThis(prefix)
1576
+ else newLikeThis(prefix)
1578
1577
}
1578
+ else newLikeThis(prefix)
1579
1579
1580
1580
/** Create a NamedType of the same kind as this type, but with a new prefix.
1581
1581
*/
@@ -2804,7 +2804,7 @@ object Types {
2804
2804
}
2805
2805
2806
2806
override def toString =
2807
- if (lo eq hi) s " TypeAlias( $lo) " else s " TypeBounds( $lo, $hi) "
2807
+ if (lo eq hi) s " TypeAlias( $lo, $variance ) " else s " TypeBounds( $lo, $hi) "
2808
2808
}
2809
2809
2810
2810
class RealTypeBounds (lo : Type , hi : Type ) extends TypeBounds (lo, hi) {
0 commit comments