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 message creates undue warning #9763
Comments
Imported From: https://issues.scala-lang.org/browse/SI-9763?orig=1 |
@som-snytt said: in case it didn't get an issue. |
@milessabin said: |
@som-snytt said: $ scala -Xlint
Welcome to Scala 2.11.8 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_60).
Type in expressions for evaluation. Or try :help.
scala> import annotation._
import annotation._
scala> @implicitNotFound("No ${A}" + " at all") class C[A]
<console>:14: warning: possible missing interpolator: detected an interpolated expression
@implicitNotFound("No ${A}" + " at all") class C[A]
^
defined class C
scala> :quit
$ scalam -Xlint
Welcome to Scala 2.12.0-M4 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_60).
Type in expressions for evaluation. Or try :help.
scala> import annotation._
import annotation._
scala> @implicitNotFound("No ${A}" + " at all") class C[A]
defined class C
scala> :pa
// Entering paste mode (ctrl-D to finish)
object A
@implicitNotFound("No ${A}" + " at all") class C[A]
// Exiting paste mode, now interpreting.
<console>:15: warning: possible missing interpolator: detected an interpolated expression
@implicitNotFound("No ${A}" + " at all") class C[A]
^
defined object A
defined class C
It still warns if there is a value with the name of your type param. |
@milessabin said: |
@som-snytt said: It occurs to me that one fix for the other ticket is, if the "expected type" is an interpolated string (there is no such notion now), then apply an appropriate interpolator. A macro interpolator should be allowed to guide interpretation of holes (such as type args) (no such notion either). |
@milessabin said: |
@etorreborre said: |
@SethTisue said: |
@paulp said: |
Closing with the caveat there are two issues with the annotation:
The interpolation here is legal and resonable but warns for reason 2:
|
The following code creates a spurious warning (because of the concatenated string):
The warning disappears if we write
In my original code I broke the message in 2 because it was too long.
The text was updated successfully, but these errors were encountered: