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