diff options
author | odersky <odersky@gmail.com> | 2014-07-19 13:13:55 +0200 |
---|---|---|
committer | odersky <odersky@gmail.com> | 2014-07-19 13:13:55 +0200 |
commit | 1f6f66787e99d5bd5dcf3a049fde4d47a40d733d (patch) | |
tree | 1204d224dc9d9b5f29c179b2fc2f0c215a4d207d | |
parent | e5aaa7185c8c6f116e1b8d6ed4e8ed9f49e22d55 (diff) | |
parent | 26d4ac090dbe0f661b62fa2a173b95482cd758e3 (diff) | |
download | dotty-1f6f66787e99d5bd5dcf3a049fde4d47a40d733d.tar.gz dotty-1f6f66787e99d5bd5dcf3a049fde4d47a40d733d.tar.bz2 dotty-1f6f66787e99d5bd5dcf3a049fde4d47a40d733d.zip |
Merge pull request #145 from dotty-staging/fix/#143
Fixed #143
-rw-r--r-- | src/dotty/tools/dotc/core/Types.scala | 10 | ||||
-rw-r--r-- | tests/pos/i143.scala | 14 |
2 files changed, 20 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) } diff --git a/tests/pos/i143.scala b/tests/pos/i143.scala new file mode 100644 index 000000000..8804b20ce --- /dev/null +++ b/tests/pos/i143.scala @@ -0,0 +1,14 @@ +package dotty.tools.dotc +package transform + +import dotty.tools.dotc.core.Denotations._ +import dotty.tools.dotc.core.Symbols._ +import dotty.tools.dotc.core.Contexts._ + +class TC5 extends AnyVal { + implicit val ctx: Context = ??? + + def candidates(mbr: SingleDenotation): Boolean = { + mbr.symbol.denot(ctx).exists + } +} |