class C {
private[C] def f = 42
}
class D extends C {
override def f = 17 // incorrectly disallowed by Scala 2
//override def f = super.f // correctly disallowed by Scala 3
}
object Test extends App {
println {
new D().f
}
}
The example from the linked ticket should align with Scala 3:
package s1 {
object O {
class A {
private[s1] def f1(): Int = 1
private[O] def f2(): Int = 2
private[A] def f3(): Int = 3
}
}
}
package s2 {
class B extends s1.O.A {
override def f1() = 11 // allowed
override def f2() = 12 // allowed
override def f3() = 13 // disallowed
// ./a.scala:15: error: method f3 overrides nothing
// override def f3() = 12
// ^
// one error found
}
}
Problem
Qualified private members are inherited, even if they are not accessible.
Reproduction steps
Scala version: 2.13.11
The example from the linked ticket should align with Scala 3:
Problem
Qualified private members are inherited, even if they are not accessible.
Follow-up to https://github.com/scala/bug/issues/2568 Follow-up to https://github.com/lampepfl/dotty/issues/10440