Closed
Description
The error message produced when you override an abstract var with a val is unclear,
For example:
abstract class A {
var x : Int
}
class B extends A {
val x = 2
}
produces the error:
error.scala:5: error: class B needs to be abstract, since variable x in class A of type Int is not defined
(Note that variables need to be initialized to be defined)
class B extends A {
^
It wuold be more obvious if this produced the same error as overriding a concrete var with a val, e.g.
abstract class A {
var x = 1
}
class B extends A {
override val x = 2
}
with the error message:
error.scala:6: error: error overriding variable x in class A of type Int;
value x cannot override a mutable variable
override val x = 2
^