bug
bug copied to clipboard
Overridden methods with wider access don't have it applied in specialized versions
Given a protected[this] method and a subtype overriding its declaration to make access public, the widening of access isn't applied to the specialized declarations.
trait QuitePrivate[@specialized(Int) +K] {
protected[this] def hasK(k :K) :Boolean
}
trait MoreOpen extends QuitePrivate[Int] {
override def hasK(k :Int) :Boolean
}
object Playground extends App {
def check(guy :MoreOpen) = guy.hasK(42)
}
Error:(13, 33) method hasK$mcI$sp in trait MoreOpen cannot be accessed in MoreOpen
Access to protected method hasK$mcI$sp not permitted because
enclosing object Playground is not a subclass of
trait MoreOpen where target is defined
def check(guy :MoreOpen) = guy.hasK(42)
BTW - I know the specialization is an experimental and not fullly integrated feature of the language. Should I keep reporting bugs I find in this area, or is it just burdening you with stuff that's likely to go out of the window and be rewritten completely?
Imported From: https://issues.scala-lang.org/browse/SI-10211?orig=1 Reporter: Marcin Mościcki (mmoscicki) Affected Versions: 2.11.8
@SethTisue said: The bug reports are valuable as documentation for future wanderers in the hallways of JIRA. But yeah, I'm going to tag this as "community" which means unless a volunteer appears, it's unlikely to get fixed.
Marcin Mościcki (mmoscicki) said: Ok, thx. Never worked on a compiler before, but if you suspect it's something really easy and could point me in the right direction, and there is some general intro for contributors, maybe I could give it a try?
abstract trait MoreOpen extends Object with sandbox.Test#QuitePrivate$mcI$sp {
override def hasK(k: Int): Boolean;
<specialized> protected[this] def hasK$mcI$sp(k: Int): Boolean = MoreOpen.this.hasK(k)
};
The main problem seems to be that the hasK$mcI$sp method should also as public?