@@ -187,11 +187,11 @@ class SuperAccessors(thisTransformer: DenotTransformer) {
187187 }
188188 val protectedAccessor = clazz.info.decl(accName).suchThat(_.signature == accType.signature).symbol orElse {
189189 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)
191191 val code = polyDefDef(newAcc, trefs => vrefss => {
192192 val (receiver :: _) :: tail = vrefss
193193 val base = receiver.select(sym).appliedToTypes(trefs)
194- (base /: vrefss )(Apply (_, _))
194+ (base /: tail )(Apply (_, _))
195195 })
196196 ctx.debuglog(" created protected accessor: " + code)
197197 accDefs(clazz) += code
@@ -300,9 +300,8 @@ class SuperAccessors(thisTransformer: DenotTransformer) {
300300 private def needsProtectedAccessor (sym : Symbol , pos : Position )(implicit ctx : Context ): Boolean = {
301301 val clazz = currentClass
302302 val host = hostForAccessorOf(sym, clazz)
303- val selfType = host.classInfo.selfType
304303 def accessibleThroughSubclassing =
305- validCurrentClass && (selfType <:< sym.owner.typeRef) && ! clazz.is(Trait )
304+ validCurrentClass && (clazz.classInfo. selfType <:< sym.owner.typeRef) && ! clazz.is(Trait )
306305
307306 val isCandidate = (
308307 sym.is(Protected )
@@ -312,9 +311,11 @@ class SuperAccessors(thisTransformer: DenotTransformer) {
312311 && (sym.enclosingPackageClass != currentClass.enclosingPackageClass)
313312 && (sym.enclosingPackageClass == sym.accessBoundary(sym.enclosingPackageClass))
314313 )
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)
318319 true
319320 }
320321 def isJavaProtected = host.is(Trait ) && sym.is(JavaDefined ) && {
0 commit comments