Skip to content

Fixed #143 #145

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 19, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions src/dotty/tools/dotc/core/Types.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 ||
Expand Down Expand Up @@ -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)
}
Expand Down
14 changes: 14 additions & 0 deletions tests/pos/i143.scala
Original file line number Diff line number Diff line change
@@ -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
}
}