Skip to content

compiletime.erasedValue leaks to runtime #23406

Open
@odersky

Description

@odersky

Compiler version

3.7.2

Minimized example

inline def funny[T]: String =
  inline compiletime.erasedValue[T] match
    case x: String => x

@main def Test = funny[String]

Output

Runtime crash

java Test
Exception in thread "main" java.lang.NoSuchMethodError: 'java.lang.Object scala.compiletime.package$package$.erasedValue()'
	at test$package$.Test(test.scala:2)
	at Test.main(test.scala:5)

Expectation

Should be rejected at compile-time.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions