Description
Compiler version
3.3.x
Minimized code
@nowarn("msg=unused")
private def summonImpl[A: Type](using Quotes): Expr[This[A]] =
import quotes.*
import quotes.reflect.{This as ThisTerm, *}
...
Output
False positive under -Wunused:imports
must be suppressed as shown.
Expectation
The false positive on the renamed import can be silenced by local @nowarn
, but requires using a brittle string.
Even if the message is unusually stable ("unused import"
), discovering and copy/pasting strings is an unhealthy workflow.
Parity with Scala 2 would require categories for lints cat=lint-unused-import
of some granularity, or possibly dotty message ids id=W100
. "Awesome warnings!"
In addition, top-level imports can't be annotated, so Scala 2 uses origin=quotes.reflect.This
.
If warnings are easy to silence, then they are easy to enable.
There is a discussion about the need for further parity in -Wconf
at #17635
This problem came up on discord via Alexandru Nedelcu Today at 11:47 AM