-
Notifications
You must be signed in to change notification settings - Fork 21
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
Lints should respect -Wmacros
#12072
Comments
shapeless.Lazy
is used for implicit derivation-Wmacros
|
fyi @milessabin |
I'd seen this and assumed the linter rule was trigger happy and disabled it. There's nothing I can do here because the structure is essential to the encoding of |
The error message was introduced by scala/scala#8590 |
volunteer to attempt to improve the situation? |
Maybe we can find a secret handshake to sidestep the warning? It would also be good not to warn if the method call is written by the user, not synthesized by the compiler: scala> implicit def f(x: => Int): Int = x
warning: 1 feature warning; for details, enable `:setting -feature` or `:replay -feature`
def f(x: => Int): Int
scala> { println("hi"); f(1) }
^
warning: Block result was adapted via implicit conversion (method f) taking a by-name parameter
hi
val res0: Int = 1 Alternatively, the shapeless macro could add a scala> { println("hi"); f(1) } : @annotation.nowarn("cat=lint-byname-implicit")
hi |
If anyone else is trying to figure out how to suppress just this one type of lint warning:
|
reproduction steps
using Scala
2.13.3
:Scastie showing the warning: https://scastie.scala-lang.org/r3Fnc5YcSzeA91CKs06EtQ
problem
Getting a warning:
But the warning applies to the code generated by
shapeless.Lazy
macro, not user-written code. This makes it mandatory to disable the-Xlint:byname-implicit
due to the massive amount of false positives whenever implicit derivation is used.The text was updated successfully, but these errors were encountered: