From 5000f5f7e874c63a2ad3b6090478d46ba05160ac Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Sat, 19 Jul 2014 11:31:50 +0200 Subject: Fixed #143 The problem was that TermRefWithSignatures did not take shadowed names into account when reconstituting themselves under a new prefix. --- src/dotty/tools/dotc/core/Types.scala | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/dotty/tools/dotc/core/Types.scala') 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) } -- cgit v1.2.3