@@ -187,11 +187,11 @@ class SuperAccessors(thisTransformer: DenotTransformer) {
187
187
}
188
188
val protectedAccessor = clazz.info.decl(accName).suchThat(_.signature == accType.signature).symbol orElse {
189
189
val newAcc = ctx.newSymbol(
190
- clazz, accName, Artifact , accType, coord = sel.pos).enteredAfter(thisTransformer)
190
+ clazz, accName, Artifact | Method , accType, coord = sel.pos).enteredAfter(thisTransformer)
191
191
val code = polyDefDef(newAcc, trefs => vrefss => {
192
192
val (receiver :: _) :: tail = vrefss
193
193
val base = receiver.select(sym).appliedToTypes(trefs)
194
- (base /: vrefss )(Apply (_, _))
194
+ (base /: tail )(Apply (_, _))
195
195
})
196
196
ctx.debuglog(" created protected accessor: " + code)
197
197
accDefs(clazz) += code
@@ -300,9 +300,8 @@ class SuperAccessors(thisTransformer: DenotTransformer) {
300
300
private def needsProtectedAccessor (sym : Symbol , pos : Position )(implicit ctx : Context ): Boolean = {
301
301
val clazz = currentClass
302
302
val host = hostForAccessorOf(sym, clazz)
303
- val selfType = host.classInfo.selfType
304
303
def accessibleThroughSubclassing =
305
- validCurrentClass && (selfType <:< sym.owner.typeRef) && ! clazz.is(Trait )
304
+ validCurrentClass && (clazz.classInfo. selfType <:< sym.owner.typeRef) && ! clazz.is(Trait )
306
305
307
306
val isCandidate = (
308
307
sym.is(Protected )
@@ -312,9 +311,11 @@ class SuperAccessors(thisTransformer: DenotTransformer) {
312
311
&& (sym.enclosingPackageClass != currentClass.enclosingPackageClass)
313
312
&& (sym.enclosingPackageClass == sym.accessBoundary(sym.enclosingPackageClass))
314
313
)
315
- def isSelfType = ! (host.typeRef <:< selfType) && {
316
- if (selfType.typeSymbol.is(JavaDefined ))
317
- ctx.restrictionError(s " cannot accesses protected $sym from within $clazz with self type $selfType" , pos)
314
+ val hostSelfType = host.classInfo.selfType
315
+ def isSelfType = ! (host.typeRef <:< hostSelfType) && {
316
+ if (hostSelfType.typeSymbol.is(JavaDefined ))
317
+ ctx.restrictionError(
318
+ s " cannot accesses protected $sym from within $clazz with host self type $hostSelfType" , pos)
318
319
true
319
320
}
320
321
def isJavaProtected = host.is(Trait ) && sym.is(JavaDefined ) && {
0 commit comments