2.13.3 by-name implicit linting error?

I upgraded from 2.13.2 -> 2.13.3 this morning. Didn’t change any scalacOptions and am now flooded with the following warning/error:

“Block result was adapted via implicit conversion (method apply) taking a by-name parameter”

Here is one example among many where the warning is raised:

implicit val encoder: io.circe.Encoder[Foo] = io.circe.generic.deriveEncoder[Foo]

which calls into:

  final def deriveDecoder[A](implicit decode: Lazy[DerivedDecoder[A]]): Decoder[A] = decode.value

I’m not 100% sure what this warning is even trying to warn me about but there doesn’t appear to be a by-name implicit there. As a side note, the SIP that introduced by-name implicits is still marked as pending on the scala site: https://docs.scala-lang.org/sips/byname-implicits.html despite it being implemented in 2.13.

2 Likes

Not really an answer to your question, but as there are probably macros involved it’s likely that one of those macros generates code that triggers the warning.

When adapting the result expression of a block with
an implicit conversion that takes a by-name parameter,
only the result expression is adapted; one may incorrectly
think the whole block (as an arg) receives by-name
evaluation semantics.

By-name implicit conversions have always been possible, and that is what this lint is warning about. The “by-name implicits” feature is about by-name implicit parameters which should influence divergence checking if I’m not mistaken.

I’m not sure why you get the warning in 2.13.3 but not in 2.13.2. I guess the good news is that 2.13.3 also has a feature for silencing warnings.

Someone reported the same issue as you: https://github.com/scala/bug/issues/12072

2 Likes