Closed
Description
Compiler version
Affects 3.0.0
to 3.1.2-RC1
.
Does not affect 2.13.8
.
Minimized code
trait A {
private val ? = ""
def a = ?
}
@main def run(): Unit = println(new A {}.a)
Output
null
Expectation
This program should print an empty line, not null
.
Observations: the problem does not occur when
?
is renamed to an alphanumeric identifier (!)?
is a definition instead of a valueA
is a class instead of a trait?
is protected or public
The ?
can be replaced with any other symbol e.g. *
, |||
, ... (all of those will trigger the same problem)
When replacing ""
by e.g. 1
, the program prints 0
which confirms that it is a problem related to initialization.