Closed
Description
For the scope of my Bachelor Project supervised by @anatoliykmetyuk,
we planned to add for dotty an equivalent lint warning as the -Xlint:private-shadow
of Scala 2.
It would warn about a private field or a class parameter that shadows a superclass field.
Here is a more concrete example from the Scala 2 issue ( scala/bug#4762 ) :
class Base(var x : Int):
def increment() =
x = x + 1
class Derived(x : Int) extends Base(x):
override def toString =
x.toString
val derived = new Derived(1)
println(derived.toString) // yields '1', as expected
derived.increment()
println(derived.toString) // still '1', probably unexpected