Skip to content

Commit 99d8be8

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 d9b3004 commit 99d8be8

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
|| mbr.is(JavaDefined) && hasJavaErasedOverriding(mbr)
@@ -619,15 +619,16 @@ object RefChecks {
619619
// (3) is violated but not (2).
620620
def checkNoAbstractDecls(bc: Symbol): Unit = {
621621
for (decl <- bc.info.decls)
622-
if (decl.is(Deferred) && !ignoreDeferred(decl)) {
622+
if (decl.is(Deferred)) {
623623
val impl = decl.matchingMember(clazz.thisType)
624-
if (impl == NoSymbol || (decl.owner isSubClass impl.owner)) {
624+
if (impl == NoSymbol || decl.owner.isSubClass(impl.owner))
625+
&& !ignoreDeferred(decl)
626+
then
625627
val impl1 = clazz.thisType.nonPrivateMember(decl.name) // DEBUG
626628
ctx.log(i"${impl1}: ${impl1.info}") // DEBUG
627629
ctx.log(i"${clazz.thisType.memberInfo(decl)}") // DEBUG
628630
abstractClassError(false, "there is a deferred declaration of " + infoString(decl) +
629631
" which is not implemented in a subclass" + err.abstractVarMessage(decl))
630-
}
631632
}
632633
if (bc.asClass.superClass.is(Abstract))
633634
checkNoAbstractDecls(bc.asClass.superClass)

0 commit comments

Comments
 (0)