Skip to content

erased is still considered a keyword even without -Yerased-terms #7944

Closed
@sjrd

Description

@sjrd

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.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions