Open prolativ opened 2 years ago
I think this is a duplicate of #8739, feel free to reopen if not
transparent inline def foo: Int | Boolean = 2
transparent inline def bar: Option[Int | Boolean] = Some(foo)
val x: Some[Int] = bar
The issue is that we are not refining the inferred type parameter of the Some.apply
method. It is similar to https://github.com/lampepfl/dotty/issues/8739.
Same issue with
transparent inline def bar(x: Int | Boolean): Option[Int | Boolean] = Some(x)
val x: Some[Int] = bar(2)
but this one has a workaround if we use Some[x.type](x)
Compiler version
3.2.0-RC1
Minimized code
Output
Expectation
After inlining the type of
x
should be known to be(X1, X2)
and the entire snippet should compile.