@@ -1631,8 +1631,10 @@ object SymDenotations {
1631
1631
case _ : TypeErasure .ErasedValueType => false
1632
1632
case tp : TypeRef if tp.symbol.isClass => true
1633
1633
case tp : TypeVar => tp.inst.exists && inCache(tp.inst)
1634
- case tp : TypeProxy => inCache(tp.underlying)
1635
- case tp : AndOrType => inCache(tp.tp1) && inCache(tp.tp2)
1634
+ // case tp: TypeProxy => inCache(tp.underlying) // disabled, can re-enable insyead of last two lines for performance testing
1635
+ // case tp: AndOrType => inCache(tp.tp1) && inCache(tp.tp2)
1636
+ case tp : TypeProxy => isCachable(tp.underlying, btrCache)
1637
+ case tp : AndOrType => isCachable(tp.tp1, btrCache) && isCachable(tp.tp2, btrCache)
1636
1638
case _ => true
1637
1639
}
1638
1640
}
@@ -1643,16 +1645,33 @@ object SymDenotations {
1643
1645
Stats .record(s " computeBaseType, ${tp.getClass}" )
1644
1646
}
1645
1647
if (symbol.isStatic && tp.derivesFrom(symbol) && symbol.typeParams.isEmpty)
1646
- symbol.appliedRef
1648
+ symbol.typeRef
1647
1649
else tp match {
1648
- case tp : RefType =>
1649
- val subcls = tp.symbol
1650
- if (subcls eq symbol)
1651
- tp
1652
- else subcls.denot match {
1653
- case cdenot : ClassDenotation =>
1654
- if (cdenot.baseClassSet contains symbol) foldGlb(NoType , tp.parentsNEW)
1655
- else NoType
1650
+ case tp @ TypeRef (prefix, _) =>
1651
+ val subsym = tp.symbol
1652
+ if (subsym eq symbol) tp
1653
+ else subsym.denot match {
1654
+ case clsd : ClassDenotation =>
1655
+ val owner = clsd.owner
1656
+ val isOwnThis = prefix match {
1657
+ case prefix : ThisType => prefix.cls eq owner
1658
+ case NoPrefix => true
1659
+ case _ => false
1660
+ }
1661
+ if (isOwnThis)
1662
+ if (clsd.baseClassSet.contains(symbol)) foldGlb(NoType , clsd.classParentsNEW)
1663
+ else NoType
1664
+ else
1665
+ baseTypeOf(clsd.typeRef).asSeenFrom(prefix, owner)
1666
+ case _ =>
1667
+ baseTypeOf(tp.superType)
1668
+ }
1669
+ case tp @ AppliedType (tycon, args) =>
1670
+ val subsym = tycon.typeSymbol
1671
+ if (subsym eq symbol) tp
1672
+ else subsym.denot match {
1673
+ case clsd : ClassDenotation =>
1674
+ baseTypeOf(tycon).subst(clsd.typeParams, args)
1656
1675
case _ =>
1657
1676
baseTypeOf(tp.superType)
1658
1677
}
@@ -1671,7 +1690,7 @@ object SymDenotations {
1671
1690
1672
1691
/* >|>*/ ctx.debugTraceIndented(s " $tp.baseType( $this) " ) /* <|<*/ {
1673
1692
Stats .record(" baseTypeOf" )
1674
- tp match {
1693
+ tp.stripTypeVar match { // @!!! dealias?
1675
1694
case tp : CachedType =>
1676
1695
val btrCache = baseTypeCache
1677
1696
try {
@@ -1695,7 +1714,7 @@ object SymDenotations {
1695
1714
btrCache.put(tp, null )
1696
1715
throw ex
1697
1716
}
1698
- case _ =>
1717
+ case tp =>
1699
1718
computeBaseTypeOf(tp)
1700
1719
}
1701
1720
}
0 commit comments