Closed
Description
Compiler version
3.1.2
Minimized code
In this example, the inline accessors of B.x
generated by f2
override the ones generated by f1
for A.x
class A:
private var x = 0
inline def f1(): Int =
x += 1;
x
class B extends A:
private var x = 0
inline def f2(): Int =
x += 1
x
@main def test: Unit =
val b = new B
println(b.f1())
println(b.f2())
Output
1
2
Expectation
Inline accessors should be final to not allow them to be overridden intentionally or accidentally.