Skip to content

Commit 9c7d920

Browse files
committed
Run ignoredDeferred less often
RefChecks would invoke ignoreDeferred each time we hit an abstract member in a base class of a checked class, which means almost all of the time. ignoreDeferred would in turn do time travel to post-erasure. This causes inefficiencies because of compiler-context switches. It also exposed the problem in i8425 that was fixed by the last commit. The concrete failure for i8425 does go away with the change in this commit. However, the fix in the last commit is still necessary since explicit outer/erasure races are a general problem that could come back.
1 parent aeac2f6 commit 9c7d920

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

compiler/src/dotty/tools/dotc/typer/RefChecks.scala

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ object RefChecks {
472472
}
473473
}
474474

475-
def ignoreDeferred(mbr: Symbol) =
475+
def ignoreDeferred(mbr: Symbol) =
476476
mbr.isType
477477
|| mbr.isSuperAccessor // not yet synthesized
478478
|| ShortcutImplicits.isImplicitShortcut(mbr) // only synthesized when referenced, see Note in ShortcutImplicits
@@ -620,15 +620,16 @@ object RefChecks {
620620
// (3) is violated but not (2).
621621
def checkNoAbstractDecls(bc: Symbol): Unit = {
622622
for (decl <- bc.info.decls)
623-
if (decl.is(Deferred) && !ignoreDeferred(decl)) {
623+
if (decl.is(Deferred)) {
624624
val impl = decl.matchingMember(clazz.thisType)
625-
if (impl == NoSymbol || (decl.owner isSubClass impl.owner)) {
625+
if (impl == NoSymbol || decl.owner.isSubClass(impl.owner))
626+
&& !ignoreDeferred(decl)
627+
then
626628
val impl1 = clazz.thisType.nonPrivateMember(decl.name) // DEBUG
627629
ctx.log(i"${impl1}: ${impl1.info}") // DEBUG
628630
ctx.log(i"${clazz.thisType.memberInfo(decl)}") // DEBUG
629631
abstractClassError(false, "there is a deferred declaration of " + infoString(decl) +
630632
" which is not implemented in a subclass" + err.abstractVarMessage(decl))
631-
}
632633
}
633634
if (bc.asClass.superClass.is(Abstract))
634635
checkNoAbstractDecls(bc.asClass.superClass)

0 commit comments

Comments
 (0)