aboutsummaryrefslogtreecommitdiff
path: root/compiler/src
diff options
context:
space:
mode:
authorodersky <odersky@gmail.com>2017-03-16 17:21:29 +0100
committerGitHub <noreply@github.com>2017-03-16 17:21:29 +0100
commit2325863c216e2bf4f7ad0f366bb80ef866ff6b79 (patch)
tree0f81c248ada56ff94c4e27d27fe606f3a144b468 /compiler/src
parentef55ec03e8e91402c33b09993906ec7ac34ae9b5 (diff)
parentddb8098b0f063bebe13f42387944508b7493859b (diff)
downloaddotty-2325863c216e2bf4f7ad0f366bb80ef866ff6b79.tar.gz
dotty-2325863c216e2bf4f7ad0f366bb80ef866ff6b79.tar.bz2
dotty-2325863c216e2bf4f7ad0f366bb80ef866ff6b79.zip
Merge pull request #2106 from dotty-staging/fix/param-forwarder-access-take-2
Alternative fix for #2099: avoid loading a private member when recomputing a NamedType denot
Diffstat (limited to 'compiler/src')
-rw-r--r--compiler/src/dotty/tools/dotc/core/Types.scala10
1 files changed, 5 insertions, 5 deletions
diff --git a/compiler/src/dotty/tools/dotc/core/Types.scala b/compiler/src/dotty/tools/dotc/core/Types.scala
index abc496ec0..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,11 +1583,11 @@ 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 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.
*
@@ -1786,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