Hi!
I discovered an issue after migration to Scala 2.12.4. It is possibly a bug in scalac but I'm not sure.
Here's minimal example:
From build.sbt:
scalaVersion := "2.12.4"
scalacOptions ++= Seq("-Ywarn-unused", "-Xfatal-warnings")
val circeVersion = "0.8.0"
libraryDependencies ++= Seq(
"io.circe" %% "circe-core",
"io.circe" %% "circe-generic",
"io.circe" %% "circe-parser"
).map(_ % circeVersion)
Test.scala:
object Test extends App {
import java.time.Instant
import io.circe.generic.auto._
import io.circe.syntax._
private implicit val instantEncoder: io.circe.Encoder[Instant] =
io.circe.Encoder.encodeLong.contramap(_.toEpochMilli)
case class A(prop: Instant)
println(A(Instant.now()).asJson)
}
Like this it fails to compile:
private val instantEncoder in object Test is never used
If you comment out instantEncoder it fails also:
could not find implicit value for parameter encoder: io.circe.Encoder[Test.A]
And it compiles fine with Scala 2.12.3.
I've also ran into this issue.
This can be worked around in the meantime by annotating the offending declaration with silent or by change its visibility from private to private[NameOfEnclosingType].
We are also running into this issue, would love to help but don't know even where to start looking
We are running into that issue for an implicit parameter, don't want to introduce silent for this tbh
implicit def dataChangeEventEncoder[T](implicit enc: Encoder[T]) = semiauto.deriveEncoder[DataChangeEvent[T]]
Any info on this or a link to somewhere where there is more discussion?
Edit: Just found these issues:
https://github.com/scala/bug/issues/10599
https://github.com/scala/bug/issues/10571
TL;DR: Use the compiler flag -Ywarn-macros:after
Most helpful comment
Any info on this or a link to somewhere where there is more discussion?
Edit: Just found these issues:
https://github.com/scala/bug/issues/10599
https://github.com/scala/bug/issues/10571
TL;DR: Use the compiler flag
-Ywarn-macros:after