Open
Description
I've checked other opened issues and it doesn't seem there's one like this (if that's the case, sorry and please close this).
Also I'm not sure since when the issue appears because we have excluded the unused import warnings in our projects. The minimizer, though, I tried with 3.7.1-RC1 and 3.nightly.
Compiler version
3.nightly
Minimized code
//> using scala 3.nightly
//> using dep com.github.plokhotnyuk.jsoniter-scala::jsoniter-scala-core:2.36.0
//> using dep io.github.kitlangton::neotype-jsoniter:0.3.24
//> using options -Wunused:imports
import com.github.plokhotnyuk.jsoniter_scala.core.*
import com.github.plokhotnyuk.jsoniter_scala.macros.*
import neotype.*
import neotype.interop.jsoniter.given
type Bar = Bar.Type
object Bar extends Newtype[Long]
case class Foo(bar: Bar, bars: List[Bar]) derives ConfiguredJsonValueCodec
object JsonExample:
def main(args: Array[String]): Unit =
val foo = Foo(Bar(42), List(Bar(1), Bar(2)))
val jsonString = writeToString(foo)
println(s"Serialized JSON: $jsonString")
val parsedFoo = readFromString[Foo](jsonString)
println(s"Deserialized object: $parsedFoo")
Output
[warn] ./issue.sc:9:33
[warn] unused import
[warn] import neotype.interop.jsoniter.given
[warn]
Expectation
No warn is emitted as this import is needed by Jsoniter derives.
The import, when removed as suggested by the compiler, makes the compilation fail:
[error] ./issue.sc:14:51
[error] No implicit 'com.github.plokhotnyuk.jsoniter_scala.core.JsonValueCodec[_ >: scala.Nothing <: scala.Any]' defined for 'issue$_.this.Bar.Type'.
[error] case class Foo(bar: Bar, bars: List[Bar]) derives ConfiguredJsonValueCodec
[error]