Skip to content

Commit 8ceaba7

Browse files
committed
Merge pull request #1038 from dotty-staging/fix-#1037
Fix #1037
2 parents ab1d30d + 2042adc commit 8ceaba7

File tree

6 files changed

+23
-8
lines changed

6 files changed

+23
-8
lines changed

src/dotty/tools/dotc/config/Config.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ object Config {
44

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

src/dotty/tools/dotc/core/SymDenotations.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1250,8 +1250,8 @@ object SymDenotations {
12501250
if (parentIsYounger) {
12511251
incremental.println(s"parents of $this are invalid; symbol id = ${symbol.id}, copying ...\n")
12521252
invalidateInheritedInfo()
1253-
firstRunId = ctx.runId
12541253
}
1254+
firstRunId = ctx.runId
12551255
this
12561256
}
12571257

@@ -1384,7 +1384,7 @@ object SymDenotations {
13841384
var fp = FingerPrint()
13851385
var e = info.decls.lastEntry
13861386
while (e != null) {
1387-
fp.include(e.sym.name)
1387+
fp.include(e.name)
13881388
e = e.prev
13891389
}
13901390
var ps = classParents

src/dotty/tools/dotc/core/Types.scala

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -406,14 +406,17 @@ object Types {
406406

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

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

417+
final def memberExcluding(name: Name, excluding: FlagSet)(implicit ctx: Context): Denotation =
418+
findMember(name, widenIfUnstable, excluding)
419+
417420
/** Find member of this type with given name and
418421
* produce a denotation that contains the type of the member
419422
* as seen from given prefix `pre`. Exclude all members that have

src/dotty/tools/dotc/transform/MixinOps.scala

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,14 @@ class MixinOps(cls: ClassSymbol, thisTransform: DenotTransformer)(implicit ctx:
3434
//sup.select(target)
3535
}
3636

37-
/** Is `sym` a member of implementing class `cls`? */
38-
def isCurrent(sym: Symbol) = cls.info.member(sym.name).hasAltWith(_.symbol == sym)
39-
37+
/** Is `sym` a member of implementing class `cls`?
38+
* The test is performed at phase `thisTransform`.
39+
*/
40+
def isCurrent(sym: Symbol) =
41+
ctx.atPhase(thisTransform) { implicit ctx =>
42+
cls.info.member(sym.name).hasAltWith(_.symbol == sym)
43+
}
44+
4045
def needsForwarder(meth: Symbol): Boolean = {
4146
lazy val overridenSymbols = meth.allOverriddenSymbols
4247
def needsDisambiguation = !overridenSymbols.forall(_ is Deferred)

tests/run/t7475b.check

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
2
22
2
3+
2
4+
2

tests/run/t7475b.scala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
trait A { private val x = 1 }
22
trait B { val x = 2 }
3+
trait C { val x: Int }
34
trait C1 extends B with A { println(x) }
45
trait C2 extends A with B { println(x) }
6+
trait C3 extends C with B { println(x) }
7+
trait C4 extends B with C { println(x) }
58

69
object Test {
710
def main(args: Array[String]): Unit = {
811
new C1 { }
912
new C2 { }
13+
new C3 { }
14+
new C4 { }
1015
}
1116
}

0 commit comments

Comments
 (0)