Open
Description
Compiler version
3.2.1, 3.2.2-RC1, 3.3.1-RC4
Minimized code
Runnable: https://scastie.scala-lang.org/9rXw6Hg8RRSmRkk1b4NemA
case class ZIO[-R, +E, +A]()
object ZIO {
val interrupt: ZIO[Any, Nothing, Nothing] = ZIO()
}
inline def fromHas[R, E, A](z: ZIO[R, E, A]): String = {
compiletime.codeOf(identity(z))
}
@main def main: Unit = {
println(fromHas(ZIO.interrupt))
}
Output
identity[ZIO[Any, Any, Any]](ZIO.interrupt)
Expectation
identity[ZIO[Any, Nothing, Nothing]](ZIO.interrupt)
Expected the type E
and A
parameters of ZIO.interrupt
to be preserved, instead of widened all the way to Any
, as in Scala 2.
Note: only covariant parameters were widened - contravariant R
parameter was not widened from Any
to Nothing
.
This code is a minimized version of real library code in https://github.com/izumi/izumi which we're trying to port to Scala 3