-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Regression call outer class super method from inner class #9225
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
Comments
Ok. Does not matter if |
The unimplemented method is @FabioPinheiro To troubleshoot it's generallty better to have self-contained test cases instead of the REPL. Less moving parts that way. To be sure, this problem is present also in the self-contained test: trait A {
val s = "same val in A"
def f: String = s
}
class B extends A {
class C {
def call_f_in_A: String = B.super[A].f
}
}
object Test extends App {
val b = new B
val c = new b.C
c.call_f_in_A // AbstractMethodError
} |
OK. I will do that If I open any other ticket. |
@odersky I'm not sure if that was or not a question for me. Forgot to mention on the ticket. trait A {
private val s = "same val in A"
def f: String = s
}
class B extends A {
class C {
val A$$s = "This will be called and it shouldn't"
def call_f_in_A: String = B.super[A].f
}
}
object Test extends App {
val b = new B
val c = new b.C
println(c.call_f_in_A) // It will print "This will be called and it shouldn't"
} From my limited knowledge of reading the output from each phase. If we define trait A {
def s = "same val in A"
def f: String = s
}
class B extends A {
class C {
val s = "This will be called and it shouldn't"
def call_f_in_A: String = B.super[A].f
}
} Before the byte code generation, we have A() extends Object {
def s(): String = "same val in A"
def f(): String = this.s()
}
...
class B$C extends Object {
...
private val s: String
def s(): String = this.s
def call_f_in_A(): String = B.super[A].f()
} The body of the method If we define A extends Object {
def $init$(): Unit =
{
()
}
def s(): String
protected def initial$s(): String =
{
"same val in A"
}
def f(): String = this.s()
} Here the method |
Yes, but that still begs the question why an (abstract) |
Closes scala#9225 Closes scala#10437
Uh oh!
There was an error while loading. Please reload this page.
Minimized code
Output
Expectation
It should compile.
I had the impression this was working one week ago.Maybe it was long ago or I'm just mistaken.The text was updated successfully, but these errors were encountered: