File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
compiler/src/dotty/tools/dotc/transform Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -299,7 +299,6 @@ class SuperAccessors(thisPhase: DenotTransformer) {
299299 */
300300 private def needsProtectedAccessor (sym : Symbol , pos : Position )(implicit ctx : Context ): Boolean = {
301301 val clazz = currentClass
302- val host = hostForAccessorOf(sym, clazz)
303302 def accessibleThroughSubclassing =
304303 validCurrentClass && clazz.classInfo.selfType.derivesFrom(sym.owner) && ! clazz.is(Trait )
305304
@@ -311,7 +310,13 @@ class SuperAccessors(thisPhase: DenotTransformer) {
311310 && (sym.enclosingPackageClass != currentClass.enclosingPackageClass)
312311 && (sym.enclosingPackageClass == sym.accessBoundary(sym.enclosingPackageClass))
313312 )
313+
314+ if (! isCandidate)
315+ return false
316+
317+ val host = hostForAccessorOf(sym, clazz)
314318 val hostSelfType = host.classInfo.selfType
319+
315320 def isSelfType = ! (host.appliedRef <:< hostSelfType) && {
316321 if (hostSelfType.typeSymbol.is(JavaDefined ))
317322 ctx.restrictionError(
@@ -326,7 +331,7 @@ class SuperAccessors(thisPhase: DenotTransformer) {
326331 )
327332 true
328333 }
329- isCandidate && ! host.is(Package ) && ! isSelfType && ! isJavaProtected
334+ ! host.is(Package ) && ! isSelfType && ! isJavaProtected
330335 }
331336
332337 /** Return the innermost enclosing class C of referencingClass for which either
You can’t perform that action at this time.
0 commit comments