-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Compiler AssertionError when joining alternatives over intersection types #7965
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I was able to reproduce this issue (both on class Has[A]
trait ZLayer[-RIn, +E, +ROut <: Has[_]] {
def >>>[E1 >: E, ROut2 <: Has[_]](that: ZLayer[ROut, E1, ROut2]): ZLayer[RIn, E1, ROut2]
def ++[E1 >: E, RIn2, ROut1 >: ROut <: Has[_], ROut2 <: Has[_]](that: ZLayer[RIn2, E1, ROut2]): ZLayer[RIn with RIn2, E1, ROut1 with ROut2]
}
object ZLayer {
type NoDeps[+E, +B <: Has[_]] = ZLayer[Any, E, B]
}
type ServiceA = Has[ServiceA.Service]
object ServiceA {
trait Service
val live: ZLayer.NoDeps[Nothing, ServiceA] = ???
}
type ServiceB = Has[ServiceB.Service]
object ServiceB {
trait Service
val live: ZLayer.NoDeps[Nothing, ServiceB] = ???
}
type ServiceC = Has[ServiceC.Service]
object ServiceC {
trait Service
val live: ZLayer.NoDeps[Nothing, ServiceC] = ???
}
type ServiceD = Has[ServiceD.Service]
object ServiceD {
trait Service
val live: ZLayer.NoDeps[ServiceC, ServiceD with ServiceC] = ???
}
val combined =
ServiceA.live >>>
(ServiceB.live ++ (ServiceC.live >>> ServiceD.live)) I this would help, I can create a PR adding a reproducing test to |
Thanks for the minimization! I've minimized it further to: class Has[A]
trait X
trait Y
trait Z
class Test {
val x: Has[X] | (Has[Y] & Has[Z])
def foo[T <: Has[_]](has: T): T = has
foo(x)
} |
Allow that the base type of a join may be a conjunction.
Fix #7965: Deal with AndTypes in joins
@odersky Thanks for your work on this! I will update to the latest nightly tomorrow and report back. |
@odersky Thanks for the prompt fix! |
Just wanted to follow up on this. Sorry for the delay, got slowed down a little bit with the issue with publishing nightlies. With this change we were able to resolve the issue and restore Dotty support. However, we are seeing some type inference regression in Dotty versus Scala 2 here that I will open another ticket for momentarily. Thanks again! |
minimized code
I have not yet attempted minimization. This is an
AssertionError
deep in the compiler related to intersection types; no information is available on where the failure occurred.The bug can currently be reproduced on
https://github.com/jdegoes/zio
by running:Compilation output
expectation
I expect this code to compile in Dotty, as it does in Scala 2.11, 2.12, and 2.13.
The text was updated successfully, but these errors were encountered: