Closed
Description
Compiler version
3.3.0
Minimized code
import scala.annotation.*
class A:
def foo: Int = 1
class B extends A:
@targetName("foo") private[this] def bla: Int = 2
@main def Test =
val b = new B
println(b.foo)
Output
Exception in thread "main" java.lang.IllegalAccessError: tried to access method B.foo()I from class targetName$package$
at targetName$package$.Test(targetName.scala:10)
at Test.main(targetName.scala:8)
Expectation
A compilation error, similar to what one gets when trying to define a private def that shadows a public one.