Closed fdietze closed 5 years ago
Ok, I fixed the primary problem and in principle this warning could now be silenced like this:
@JSGlobal("$crisp": @silent)
but unfortunately ScalaJS compiler doesn't like it because "$crisp": @silent
is not a string literal for it. Maybe it's worth opening an issue in ScalaJS.
Here's a workaround you can employ:
object JSNames {
@silent("possible missing interpolator")
final val Crisp = "$crisp"
}
@js.native
@JSGlobal(JSNames.Crisp)
object crisp extends js.Object
Ok, I'm closing this as the primary problem in silencer has been fixed and released in 1.4.2.
I ran into a similar issue today @ghik using the latest release 1.4.3:
[warn] /home/projects/..../App.scala:9:10: discarded non-Unit value
[warn] @silent @react class App extends Component {
[warn] ^
[warn] one warning found
If this looks like an issue to you, I'd be happy to work on a PR, although annotations and macros are my least understood part of scala. If you can point me to a range of lines though I'd love to work on it.
@zakpatterson It doesn't work because the suppression range in this case is the class itself, without its own annotations. Sure, this probably can be fixed by making @silent
also apply to "neighbouring" annotations that come after it. File an issue if you want.
In the meantime, please also check if this works: @(react@silent)
Thanks for that @ghik , I gave that a try, but the @react
macro annotation generates a companion object for App
in my example, which doesn't get generated, or is not accessible, given your suggested annotation.
I can open a new issue, or we can just broaden the scope of this #32. It seems very similar.
I have this piece of code:
@JSGlobal
is expecting a string literal. But the compiler raises the warning:possible missing interpolator
. I was not able to suppress it using@silent
.