Closed
Description
Minimized code
object Test {
inline def foo: String = scala.compiletime.error(s"")
def main(args: Array[String]): Unit = println(foo)
}
Output
Compiles but throws an exception at runtime:
Exception in thread "main" scala.NotImplementedError: an implementation is missing
at scala.Predef$.$qmark$qmark$qmark(Predef.scala:347)
at Test$.main(Test.scala:4)
at Test.main(Test.scala)
Expectation
In the original code println(foo)
shouldn't compile (and doesn't if you remove the s
from the definition of foo
). If using s
in the error
string isn't allowed, I'd expect the compiler to tell me that instead of throwing an exception at runtime.