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) {
299
299
*/
300
300
private def needsProtectedAccessor (sym : Symbol , pos : Position )(implicit ctx : Context ): Boolean = {
301
301
val clazz = currentClass
302
- val host = hostForAccessorOf(sym, clazz)
303
302
def accessibleThroughSubclassing =
304
303
validCurrentClass && clazz.classInfo.selfType.derivesFrom(sym.owner) && ! clazz.is(Trait )
305
304
@@ -311,7 +310,13 @@ class SuperAccessors(thisPhase: DenotTransformer) {
311
310
&& (sym.enclosingPackageClass != currentClass.enclosingPackageClass)
312
311
&& (sym.enclosingPackageClass == sym.accessBoundary(sym.enclosingPackageClass))
313
312
)
313
+
314
+ if (! isCandidate)
315
+ return false
316
+
317
+ val host = hostForAccessorOf(sym, clazz)
314
318
val hostSelfType = host.classInfo.selfType
319
+
315
320
def isSelfType = ! (host.appliedRef <:< hostSelfType) && {
316
321
if (hostSelfType.typeSymbol.is(JavaDefined ))
317
322
ctx.restrictionError(
@@ -326,7 +331,7 @@ class SuperAccessors(thisPhase: DenotTransformer) {
326
331
)
327
332
true
328
333
}
329
- isCandidate && ! host.is(Package ) && ! isSelfType && ! isJavaProtected
334
+ ! host.is(Package ) && ! isSelfType && ! isJavaProtected
330
335
}
331
336
332
337
/** Return the innermost enclosing class C of referencingClass for which either
You can’t perform that action at this time.
0 commit comments