aboutsummaryrefslogtreecommitdiff
path: root/compiler/src/dotty/tools/dotc/core/Types.scala
diff options
context:
space:
mode:
authorGuillaume Martres <smarter@ubuntu.com>2017-03-16 15:02:10 +0100
committerGuillaume Martres <smarter@ubuntu.com>2017-03-16 15:02:10 +0100
commitddb8098b0f063bebe13f42387944508b7493859b (patch)
treeb9787e502d0c8ca2741a694433224112427a488f /compiler/src/dotty/tools/dotc/core/Types.scala
parent1821944511457d6f212b3d577101242ef9e77984 (diff)
downloaddotty-ddb8098b0f063bebe13f42387944508b7493859b.tar.gz
dotty-ddb8098b0f063bebe13f42387944508b7493859b.tar.bz2
dotty-ddb8098b0f063bebe13f42387944508b7493859b.zip
Allow going from non-priv to priv denot when run changes
Diffstat (limited to 'compiler/src/dotty/tools/dotc/core/Types.scala')
-rw-r--r--compiler/src/dotty/tools/dotc/core/Types.scala17
1 files changed, 6 insertions, 11 deletions
diff --git a/compiler/src/dotty/tools/dotc/core/Types.scala b/compiler/src/dotty/tools/dotc/core/Types.scala
index fa1b6dda6..6c27e53f6 100644
--- a/compiler/src/dotty/tools/dotc/core/Types.scala
+++ b/compiler/src/dotty/tools/dotc/core/Types.scala
@@ -1482,7 +1482,7 @@ object Types {
/** A member of `prefix` (disambiguated by `d.signature`) or, if none was found, `d.current`. */
private def recomputeMember(d: SymDenotation)(implicit ctx: Context): Denotation =
- asMemberOf(prefix) match {
+ asMemberOf(prefix, allowPrivate = d.is(Private)) match {
case NoDenotation => d.current
case newd: SingleDenotation => newd
case newd =>
@@ -1573,7 +1573,7 @@ object Types {
TermRef.withSig(prefix, name.asTermName, sig)
protected def loadDenot(implicit ctx: Context): Denotation = {
- val d = asMemberOf(prefix)
+ val d = asMemberOf(prefix, allowPrivate = true)
if (d.exists || ctx.phaseId == FirstPhaseId || !lastDenotation.isInstanceOf[SymDenotation])
d
else { // name has changed; try load in earlier phase and make current
@@ -1583,15 +1583,10 @@ object Types {
}
}
- protected def asMemberOf(prefix: Type)(implicit ctx: Context): Denotation =
+ protected def asMemberOf(prefix: Type, allowPrivate: Boolean)(implicit ctx: Context): Denotation =
if (name.isShadowedName) prefix.nonPrivateMember(name.revertShadowed)
- else lastDenotation match {
- case d: SymDenotation if !d.is(Private) =>
- // We shouldn't go from a non-private denotation to a private one
- prefix.nonPrivateMember(name)
- case _ =>
- prefix.member(name)
- }
+ else if (!allowPrivate) prefix.nonPrivateMember(name)
+ else prefix.member(name)
/** (1) Reduce a type-ref `W # X` or `W { ... } # U`, where `W` is a wildcard type
* to an (unbounded) wildcard type.
@@ -1791,7 +1786,7 @@ object Types {
val candidate = TermRef.withSig(prefix, name, sig)
if (symbol.exists && !candidate.symbol.exists) { // recompute from previous symbol
val ownSym = symbol
- val newd = asMemberOf(prefix)
+ val newd = asMemberOf(prefix, allowPrivate = ownSym.is(Private))
candidate.withDenot(newd.suchThat(_.signature == ownSym.signature))
}
else candidate