Closed
Description
minimized code
package hello
object HelloWorld {
def main(args: Array[String]): Unit =
println(erased(5))
def erased(x: Int): Any = x
}
Compilation output:
[error] -- [E018] Syntax Error: hello.scala:5:12
[error] 5 | println(erased(5))
[error] | ^^^^^^
[error] | expression expected but erased found
[error] -- [E040] Syntax Error: hello.scala:7:6
[error] 7 | def erased(x: Int): Any = x
[error] | ^^^^^^
[error] | an identifier expected, but 'erased' found
[error] two errors found
expectation
I expect the above program to compile and run, given that I don't pass the -Yerased-terms
argument.
See also: the recent PR #7906.