@@ -1174,7 +1174,7 @@ object Types {
1174
1174
tycon.parents.map(_.subst(tycon.typeSymbol.typeParams, args))
1175
1175
case tp : TypeRef =>
1176
1176
if (tp.info.isInstanceOf [TempClassInfo ]) {
1177
- tp.reloadDenot ()
1177
+ tp.recomputeDenot ()
1178
1178
assert(! tp.info.isInstanceOf [TempClassInfo ])
1179
1179
}
1180
1180
tp.info.parents
@@ -1633,7 +1633,7 @@ object Types {
1633
1633
1634
1634
def finish (d : Denotation ) = {
1635
1635
if (ctx.typerState.ephemeral)
1636
- record(" ephemeral cache miss: loadDenot " )
1636
+ record(" ephemeral cache miss: memberDenot " )
1637
1637
else if (d.exists)
1638
1638
// Avoid storing NoDenotations in the cache - we will not be able to recover from
1639
1639
// them. The situation might arise that a type has NoDenotation in some later
@@ -1648,13 +1648,13 @@ object Types {
1648
1648
case name : Name =>
1649
1649
val sym = lastSymbol
1650
1650
val allowPrivate = sym == null || (sym == NoSymbol ) || sym.lastKnownDenotation.flagsUNSAFE.is(Private )
1651
- finish(loadDenot (name, allowPrivate))
1651
+ finish(memberDenot (name, allowPrivate))
1652
1652
case sym : Symbol =>
1653
1653
val symd = sym.lastKnownDenotation
1654
1654
if (symd.validFor.runId != ctx.runId && ! ctx.stillValid(symd))
1655
- finish(loadDenot (symd.initial.name, allowPrivate = false ))
1655
+ finish(memberDenot (symd.initial.name, allowPrivate = false ))
1656
1656
else if (infoDependsOnPrefix(symd, prefix))
1657
- finish(loadDenot (symd.initial.name, allowPrivate = symd.is(Private )))
1657
+ finish(memberDenot (symd.initial.name, allowPrivate = symd.is(Private )))
1658
1658
else
1659
1659
finish(symd.current)
1660
1660
}
@@ -1669,13 +1669,7 @@ object Types {
1669
1669
else lastd match {
1670
1670
case lastd : SymDenotation =>
1671
1671
if (ctx.stillValid(lastd)) finish(lastd.current)
1672
- else
1673
- try finish(loadDenot(lastd.initial.name, allowPrivate = false ))
1674
- catch {
1675
- case ex : AssertionError =>
1676
- println(i " assertion failed while $this . $lastd . ${lastd.validFor} ${lastd.flagsUNSAFE}" )
1677
- throw ex
1678
- }
1672
+ else finish(memberDenot(lastd.initial.name, allowPrivate = false ))
1679
1673
case _ =>
1680
1674
fromDesignator
1681
1675
}
@@ -1684,27 +1678,6 @@ object Types {
1684
1678
finally ctx.typerState.ephemeral |= savedEphemeral
1685
1679
}
1686
1680
1687
- private def loadDenot (name : Name , allowPrivate : Boolean )(implicit ctx : Context ): Denotation = {
1688
- var d = memberDenot(prefix, name, allowPrivate)
1689
- if (! d.exists && ctx.mode.is(Mode .Interactive ))
1690
- d = memberDenot(prefix, name, true )
1691
- if (! d.exists && ctx.phaseId > FirstPhaseId && lastDenotation.isInstanceOf [SymDenotation ])
1692
- // name has changed; try load in earlier phase and make current
1693
- d = loadDenot(name, allowPrivate)(ctx.withPhase(ctx.phaseId - 1 )).current
1694
- if (d.isOverloaded)
1695
- d = disambiguate(d)
1696
- d
1697
- }
1698
-
1699
- /** Reload denotation by computing the member with the reference's name as seen
1700
- * from the reference's prefix.
1701
- */
1702
- def reloadDenot ()(implicit ctx : Context ) =
1703
- setDenot(loadDenot(name, allowPrivate = ! symbol.exists || symbol.is(Private )))
1704
-
1705
- private def memberDenot (prefix : Type , name : Name , allowPrivate : Boolean )(implicit ctx : Context ): Denotation =
1706
- if (allowPrivate) prefix.member(name) else prefix.nonPrivateMember(name)
1707
-
1708
1681
private def disambiguate (d : Denotation )(implicit ctx : Context ): Denotation = {
1709
1682
val sig = currentSignature
1710
1683
// if (ctx.isAfterTyper) println(i"overloaded $this / $d / sig = $sig") // DEBUG
@@ -1720,6 +1693,27 @@ object Types {
1720
1693
else d
1721
1694
}
1722
1695
1696
+ private def memberDenot (name : Name , allowPrivate : Boolean )(implicit ctx : Context ): Denotation = {
1697
+ var d = memberDenot(prefix, name, allowPrivate)
1698
+ if (! d.exists && ctx.mode.is(Mode .Interactive ))
1699
+ d = memberDenot(prefix, name, true )
1700
+ if (! d.exists && ctx.phaseId > FirstPhaseId && lastDenotation.isInstanceOf [SymDenotation ])
1701
+ // name has changed; try load in earlier phase and make current
1702
+ d = memberDenot(name, allowPrivate)(ctx.withPhase(ctx.phaseId - 1 )).current
1703
+ if (d.isOverloaded)
1704
+ d = disambiguate(d)
1705
+ d
1706
+ }
1707
+
1708
+ private def memberDenot (prefix : Type , name : Name , allowPrivate : Boolean )(implicit ctx : Context ): Denotation =
1709
+ if (allowPrivate) prefix.member(name) else prefix.nonPrivateMember(name)
1710
+
1711
+ /** Reload denotation by computing the member with the reference's name as seen
1712
+ * from the reference's prefix.
1713
+ */
1714
+ def recomputeDenot ()(implicit ctx : Context ) =
1715
+ setDenot(memberDenot(name, allowPrivate = ! symbol.exists || symbol.is(Private )))
1716
+
1723
1717
private def setDenot (denot : Denotation )(implicit ctx : Context ): Unit = {
1724
1718
if (ctx.isAfterTyper)
1725
1719
assert(! denot.isOverloaded, this )
@@ -3745,7 +3739,7 @@ object Types {
3745
3739
def apply (tp : Type ): Type
3746
3740
3747
3741
protected def derivedSelect (tp : NamedType , pre : Type ): Type =
3748
- tp.derivedSelect(pre) match {
3742
+ tp.derivedSelect(pre) match {
3749
3743
case tp : TypeArgRef if variance != 0 =>
3750
3744
val tp1 = tp.underlying
3751
3745
if (variance > 0 ) tp1.hiBound else tp1.loBound
0 commit comments