Skip to content

compiletime.error with s-interpolator crashes at runtime #8362

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
travisbrown opened this issue Feb 23, 2020 · 1 comment
Closed

compiletime.error with s-interpolator crashes at runtime #8362

travisbrown opened this issue Feb 23, 2020 · 1 comment
Labels
good first issue Perfect for someone who wants to get started contributing itype:bug

Comments

@travisbrown
Copy link
Contributor

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.

@nicolasstucki
Copy link
Contributor

@anatoliykmetyuk anatoliykmetyuk added the good first issue Perfect for someone who wants to get started contributing label Feb 25, 2020
Uko added a commit to Uko/dotty that referenced this issue Feb 26, 2020
…ined because of a non-literal string parameter
Uko added a commit to Uko/dotty that referenced this issue Feb 26, 2020
…ined because of a non-literal string parameter
Uko added a commit to Uko/dotty that referenced this issue Feb 26, 2020
…ined because of a non-literal string parameter
nicolasstucki added a commit that referenced this issue Feb 27, 2020
Fix #8362: Fail compilation if a compile time error can't be inlined because of a non-literal string parameter
odersky added a commit to dotty-staging/dotty that referenced this issue Mar 30, 2020
If a creator expression is tried, we want to make sure we see a "not found" message,
so that we fall back in this case to reporting the original select failure. To this
purpose

 - we check for stable path prefixes after doing the selection proper
 - we recognize leading not found messages also if they are following by other messages
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Perfect for someone who wants to get started contributing itype:bug
Projects
None yet
Development

No branches or pull requests

3 participants