Skip to content
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

@implicitNotFound should emit a compile error when used with non-compile-time constants #10424

Closed
hmemcpy opened this issue Jul 24, 2017 · 3 comments · Fixed by scala/scala#9336
Assignees
Milestone

Comments

@hmemcpy
Copy link

hmemcpy commented Jul 24, 2017

I tried adding an @implicitNotFound annotation on a type, and IntelliJ was helpful enough to offer a multiline default with the .stripMargin trick:

@implicitNotFound(
"""Some
    |multiline
    |text
""".stripMargin)

Unfortunately, even though this code compiled fine, the annotation didn't work, I was not able to see the custom message.

Removing the stripMargin code, and turning it into a string literal solved the issue.

I believe this should be treated as a compile-time error, too easy to make this mistake.

@lrytz
Copy link
Member

lrytz commented Jul 25, 2017

This would be best implemented by fixing #7041

@som-snytt
Copy link

Also #7411 for better and more uniform composition.

@SethTisue SethTisue added this to the 2.13.6 milestone Jan 29, 2021
@SethTisue SethTisue self-assigned this Jan 29, 2021
@SethTisue
Copy link
Member

SethTisue commented Jan 29, 2021

Milestoned for 2.13.6 since, as we discovered at scala/scala#9336, we need to make compiler changes, re-STARR, and then change the annotations to extend @ConstantAnnotation. (And although we can do additional re-STARRs between releases, we prefer not to.)

breadcrumb/note to self

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants