You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Following up on #7965 we resolved the assertion error but are still seeing some regressions in type inference versus Scala 2. Relatively minimized example below.
minimized code
objectExampleextendsApp {
traitHas[A]
traitZIO[-R] {
defprovideLayer[R0, R1<:Has[_]](
layer: ZLayer[R0, R1]
)(implicitev: R1<:<R):ZIO[R0] =???
}
traitZLayer[-RIn, +ROut<:Has[_]] {
def++[RIn2, ROut1>:ROut<:Has[_], ROut2<:Has[_]](
that: ZLayer[RIn2, ROut2]
):ZLayer[RInwithRIn2, ROut1withROut2] =???
}
traitRandomServicetraitSizedServicetypeRandom=Has[RandomService]
typeSized=Has[SizedService]
defrandom:ZLayer[Random, Random] =???defsized:ZLayer[Any, Sized] =???lazyvalzio:ZIO[RandomwithSized] =???// Okay on Scala 2, does not compile on Dottylazyvaleliminated:ZIO[Random] =
zio.provideLayer(random ++ sized)
// Compiles on Dotty with an explicit type annotationlazyvaleliminated2:ZIO[Random] =
zio.provideLayer[Random, RandomwithSized](random ++ sized)
println("It compiles!")
}
Cannot prove that Example.Has[?>:Example.RandomService&Example.SizedService<:Example.RandomService|Example.SizedService
] <:<Example.Random&Example.Sized..
Ifound:
<:<.refl[Nothing]
But method refl in object<:< does not matchtypeExample.Has[?>:Example.RandomService&Example.SizedService<:Example.RandomService|Example.SizedService
] <:< (Example.Random&Example.Sized).
expectation
I would have expected this to compile without an explicit type annotation as it does on Scala 2.
Following up on #7965 we resolved the assertion error but are still seeing some regressions in type inference versus Scala 2. Relatively minimized example below.
minimized code
https://scastie.scala-lang.org/q88sfaKXTmiTJ6Iu1umiqw
Compilation output
expectation
I would have expected this to compile without an explicit type annotation as it does on Scala 2.
Copying @jdegoes.
The text was updated successfully, but these errors were encountered: