diff options
author | Martin Odersky <odersky@gmail.com> | 2014-07-19 11:31:50 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2014-07-19 11:31:54 +0200 |
commit | 5000f5f7e874c63a2ad3b6090478d46ba05160ac (patch) | |
tree | bfc1e542962fe4675e0e57918cca2ce7af995076 /src | |
parent | 9e1759f34dcfa90f688ef560c90f209dcb9b1374 (diff) | |
download | dotty-5000f5f7e874c63a2ad3b6090478d46ba05160ac.tar.gz dotty-5000f5f7e874c63a2ad3b6090478d46ba05160ac.tar.bz2 dotty-5000f5f7e874c63a2ad3b6090478d46ba05160ac.zip |
Fixed #143
The problem was that TermRefWithSignatures did not take shadowed names into account
when reconstituting themselves under a new prefix.
Diffstat (limited to 'src')
-rw-r--r-- | src/dotty/tools/dotc/core/Types.scala | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala index 289515ae1..2cf4516cd 100644 --- a/src/dotty/tools/dotc/core/Types.scala +++ b/src/dotty/tools/dotc/core/Types.scala @@ -1166,9 +1166,7 @@ object Types { TermRef.withSig(prefix, name.asTermName, sig) protected def loadDenot(implicit ctx: Context): Denotation = { - val d = - if (name.isInheritedName) prefix.nonPrivateMember(name.revertInherited) - else prefix.member(name) + val d = asMemberOf(prefix) if (d.exists || ctx.phaseId == FirstPhaseId || !lastDenotation.isInstanceOf[SymDenotation]) d else { // name has changed; try load in earlier phase and make current @@ -1178,6 +1176,10 @@ object Types { } } + protected def asMemberOf(prefix: Type)(implicit ctx: Context) = + if (name.isInheritedName) prefix.nonPrivateMember(name.revertInherited) + else prefix.member(name) + def symbol(implicit ctx: Context): Symbol = { val now = ctx.period if (checkedPeriod == now || @@ -1289,7 +1291,7 @@ object Types { sig != Signature.OverloadedSignature && symbol.exists) { val ownSym = symbol - TermRef(prefix, name).withDenot(prefix.member(name).disambiguate(_ eq ownSym)) + TermRef(prefix, name).withDenot(asMemberOf(prefix).disambiguate(_ eq ownSym)) } else TermRef.withSig(prefix, name, sig) } |