@@ -1482,7 +1482,7 @@ object Types {
1482
1482
1483
1483
/** A member of `prefix` (disambiguated by `d.signature`) or, if none was found, `d.current`. */
1484
1484
private def recomputeMember (d : SymDenotation )(implicit ctx : Context ): Denotation =
1485
- asMemberOf(prefix) match {
1485
+ asMemberOf(prefix, allowPrivate = d.is( Private ) ) match {
1486
1486
case NoDenotation => d.current
1487
1487
case newd : SingleDenotation => newd
1488
1488
case newd =>
@@ -1573,7 +1573,7 @@ object Types {
1573
1573
TermRef .withSig(prefix, name.asTermName, sig)
1574
1574
1575
1575
protected def loadDenot (implicit ctx : Context ): Denotation = {
1576
- val d = asMemberOf(prefix)
1576
+ val d = asMemberOf(prefix, allowPrivate = true )
1577
1577
if (d.exists || ctx.phaseId == FirstPhaseId || ! lastDenotation.isInstanceOf [SymDenotation ])
1578
1578
d
1579
1579
else { // name has changed; try load in earlier phase and make current
@@ -1583,15 +1583,10 @@ object Types {
1583
1583
}
1584
1584
}
1585
1585
1586
- protected def asMemberOf (prefix : Type )(implicit ctx : Context ): Denotation =
1586
+ protected def asMemberOf (prefix : Type , allowPrivate : Boolean )(implicit ctx : Context ): Denotation =
1587
1587
if (name.isShadowedName) prefix.nonPrivateMember(name.revertShadowed)
1588
- else lastDenotation match {
1589
- case d : SymDenotation if ! d.is(Private ) =>
1590
- // We shouldn't go from a non-private denotation to a private one
1591
- prefix.nonPrivateMember(name)
1592
- case _ =>
1593
- prefix.member(name)
1594
- }
1588
+ else if (! allowPrivate) prefix.nonPrivateMember(name)
1589
+ else prefix.member(name)
1595
1590
1596
1591
/** (1) Reduce a type-ref `W # X` or `W { ... } # U`, where `W` is a wildcard type
1597
1592
* to an (unbounded) wildcard type.
@@ -1791,7 +1786,7 @@ object Types {
1791
1786
val candidate = TermRef .withSig(prefix, name, sig)
1792
1787
if (symbol.exists && ! candidate.symbol.exists) { // recompute from previous symbol
1793
1788
val ownSym = symbol
1794
- val newd = asMemberOf(prefix)
1789
+ val newd = asMemberOf(prefix, allowPrivate = ownSym.is( Private ) )
1795
1790
candidate.withDenot(newd.suchThat(_.signature == ownSym.signature))
1796
1791
}
1797
1792
else candidate
0 commit comments