New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't access protected member of another instance of super class #9890
Comments
Imported From: https://issues.scala-lang.org/browse/SI-9890?orig=1 |
@som-snytt said: By contrast, object X {
trait A { protected[X] def callMe(): Unit }
trait B extends A { protected def a: A ; final override protected[X] def callMe(): Unit = a.callMe() }
} |
Jonathan Schuchart (j.schuchart) said: trait A {
protected def callMe(): Unit
def runOther(a: A): Unit = a.callMe()
}
trait SubA extends A {
callMe()
} Why would the combination of the two as outlined above not work as well? Where is the difference to |
@som-snytt said: |
Jonathan Schuchart (j.schuchart) said: |
I have the following layout of code which does not compile but according to the spec for protected should:
The compiler gives me an error
According to the spec:
The protected modifier applies to class member definitions. Protected members
of a class can be accessed from within
– the template of the defining class,
– all templates that have the defining class as a base class,
– the companion module of any of those classes.
Especially the second point should apply here but the compiler seems to treat
callMe
asprotected[this]
The text was updated successfully, but these errors were encountered: