@@ -1174,7 +1174,7 @@ object Types {
11741174 tycon.parents.map(_.subst(tycon.typeSymbol.typeParams, args))
11751175 case tp : TypeRef =>
11761176 if (tp.info.isInstanceOf [TempClassInfo ]) {
1177- tp.reloadDenot ()
1177+ tp.recomputeDenot ()
11781178 assert(! tp.info.isInstanceOf [TempClassInfo ])
11791179 }
11801180 tp.info.parents
@@ -1633,7 +1633,7 @@ object Types {
16331633
16341634 def finish (d : Denotation ) = {
16351635 if (ctx.typerState.ephemeral)
1636- record(" ephemeral cache miss: loadDenot " )
1636+ record(" ephemeral cache miss: memberDenot " )
16371637 else if (d.exists)
16381638 // Avoid storing NoDenotations in the cache - we will not be able to recover from
16391639 // them. The situation might arise that a type has NoDenotation in some later
@@ -1648,13 +1648,13 @@ object Types {
16481648 case name : Name =>
16491649 val sym = lastSymbol
16501650 val allowPrivate = sym == null || (sym == NoSymbol ) || sym.lastKnownDenotation.flagsUNSAFE.is(Private )
1651- finish(loadDenot (name, allowPrivate))
1651+ finish(memberDenot (name, allowPrivate))
16521652 case sym : Symbol =>
16531653 val symd = sym.lastKnownDenotation
16541654 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 ))
16561656 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 )))
16581658 else
16591659 finish(symd.current)
16601660 }
@@ -1669,13 +1669,7 @@ object Types {
16691669 else lastd match {
16701670 case lastd : SymDenotation =>
16711671 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 ))
16791673 case _ =>
16801674 fromDesignator
16811675 }
@@ -1684,27 +1678,6 @@ object Types {
16841678 finally ctx.typerState.ephemeral |= savedEphemeral
16851679 }
16861680
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-
17081681 private def disambiguate (d : Denotation )(implicit ctx : Context ): Denotation = {
17091682 val sig = currentSignature
17101683 // if (ctx.isAfterTyper) println(i"overloaded $this / $d / sig = $sig") // DEBUG
@@ -1720,6 +1693,27 @@ object Types {
17201693 else d
17211694 }
17221695
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+
17231717 private def setDenot (denot : Denotation )(implicit ctx : Context ): Unit = {
17241718 if (ctx.isAfterTyper)
17251719 assert(! denot.isOverloaded, this )
@@ -3745,7 +3739,7 @@ object Types {
37453739 def apply (tp : Type ): Type
37463740
37473741 protected def derivedSelect (tp : NamedType , pre : Type ): Type =
3748- tp.derivedSelect(pre) match {
3742+ tp.derivedSelect(pre) match {
37493743 case tp : TypeArgRef if variance != 0 =>
37503744 val tp1 = tp.underlying
37513745 if (variance > 0 ) tp1.hiBound else tp1.loBound
0 commit comments