Closed
Description
In this example, elem
is inferred to be of type Any
instead of type X
as in Scala 2:
object Test {
def foo[A <: X, B <: X, X](left: A, right: B): Unit = {
val elem = if (false) left else right
}
}
The issue is in TypeOps#approximateUnion
, we approximate a union of types using the intersection of the base classes of the types, but that's not correct when the types are bounded by abstract types.