Skip to content

Fix #1037 #1038

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 5 commits into from
Jan 23, 2016
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
2 changes: 1 addition & 1 deletion src/dotty/tools/dotc/config/Config.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ object Config {

final val cacheMembersNamed = true
final val cacheAsSeenFrom = true
final val useFingerPrints = true
final val useFingerPrints = true // note: it currently seems to be slightly faster not to use them! my junit test: 548s without, 560s with.
final val cacheMemberNames = true
final val cacheImplicitScopes = true

Expand Down
4 changes: 2 additions & 2 deletions src/dotty/tools/dotc/core/SymDenotations.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1250,8 +1250,8 @@ object SymDenotations {
if (parentIsYounger) {
incremental.println(s"parents of $this are invalid; symbol id = ${symbol.id}, copying ...\n")
invalidateInheritedInfo()
firstRunId = ctx.runId
}
firstRunId = ctx.runId
this
}

Expand Down Expand Up @@ -1384,7 +1384,7 @@ object SymDenotations {
var fp = FingerPrint()
var e = info.decls.lastEntry
while (e != null) {
fp.include(e.sym.name)
fp.include(e.name)
e = e.prev
}
var ps = classParents
Expand Down
7 changes: 5 additions & 2 deletions src/dotty/tools/dotc/core/Types.scala
Original file line number Diff line number Diff line change
Expand Up @@ -406,14 +406,17 @@ object Types {

/** The member of this type with the given name */
final def member(name: Name)(implicit ctx: Context): Denotation = /*>|>*/ track("member") /*<|<*/ {
findMember(name, widenIfUnstable, EmptyFlags)
memberExcluding(name, EmptyFlags)
}

/** The non-private member of this type with the given name. */
final def nonPrivateMember(name: Name)(implicit ctx: Context): Denotation = track("nonPrivateMember") {
findMember(name, widenIfUnstable, Flags.Private)
memberExcluding(name, Flags.Private)
}

final def memberExcluding(name: Name, excluding: FlagSet)(implicit ctx: Context): Denotation =
findMember(name, widenIfUnstable, excluding)

/** Find member of this type with given name and
* produce a denotation that contains the type of the member
* as seen from given prefix `pre`. Exclude all members that have
Expand Down
11 changes: 8 additions & 3 deletions src/dotty/tools/dotc/transform/MixinOps.scala
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,14 @@ class MixinOps(cls: ClassSymbol, thisTransform: DenotTransformer)(implicit ctx:
//sup.select(target)
}

/** Is `sym` a member of implementing class `cls`? */
def isCurrent(sym: Symbol) = cls.info.member(sym.name).hasAltWith(_.symbol == sym)

/** Is `sym` a member of implementing class `cls`?
* The test is performed at phase `thisTransform`.
*/
def isCurrent(sym: Symbol) =
ctx.atPhase(thisTransform) { implicit ctx =>
cls.info.member(sym.name).hasAltWith(_.symbol == sym)
}

def needsForwarder(meth: Symbol): Boolean = {
lazy val overridenSymbols = meth.allOverriddenSymbols
def needsDisambiguation = !overridenSymbols.forall(_ is Deferred)
Expand Down
2 changes: 2 additions & 0 deletions tests/run/t7475b.check
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
2
2
2
2
5 changes: 5 additions & 0 deletions tests/run/t7475b.scala
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
trait A { private val x = 1 }
trait B { val x = 2 }
trait C { val x: Int }
trait C1 extends B with A { println(x) }
trait C2 extends A with B { println(x) }
trait C3 extends C with B { println(x) }
trait C4 extends B with C { println(x) }

object Test {
def main(args: Array[String]): Unit = {
new C1 { }
new C2 { }
new C3 { }
new C4 { }
}
}