Closed
Description
Compiler version
Does not compile on 3.4.0 (or 3.0.0, 3.1.0, 3.2.0, 3.3.0)
Does compile in 2.13.12
Minimized code
sealed trait InIntersection[I, A] {
type R // Remaining types in the intersection Int
}
object InIntersection {
implicit def derived[A, R0]: InIntersection[A & R0, A] = new InIntersection[A & R0, A] {
type R = R0
}
}
implicitly[InIntersection[Int & String, Int]]
Output
[error] No given instance of type IntersectionBug$_.this.InIntersection[Int & String, Int] was found for parameter e of method implicitly in object Predef.
[error] I found:
[error]
[error] this.InIntersection.derived[A, R0]
[error]
[error] But method derived in object InIntersection does not match type IntersectionBug$_.this.InIntersection[Int & String, Int].
[error] implicitly[InIntersection[Int & String, Int]]
[error] ^
Error compiling project (Scala 3.4.0, JVM (17))
Compilation failed
Expectation
I would expect it to compile. It does compile with scala 2.13.12 (if I change the &
to with
).