FIR2IR: Fix smart-cast approximation implicit receiver

Previously, it was always cast to the first type of smart cast variants list
independently of callee symbol that might be present in the member scope
of a different type
This commit is contained in:
Denis.Zharkov
2021-01-26 10:28:07 +03:00
parent d9f45fdf9e
commit b1b89e6f5f
11 changed files with 64 additions and 5 deletions
@@ -0,0 +1,17 @@
interface Bound
interface CompilerPhase<in X1 : Bound, Y1>
private class CompositePhase<X2 : Bound, Y2>(
val foo: String
) : CompilerPhase<X2, Y2>
@Suppress("UNCHECKED_CAST")
fun <X3 : Bound, Y3> CompilerPhase<X3, Y3>.bar(): String {
this as CompilerPhase<X3, Any?>
val ok = if (this is CompositePhase<X3, *>) foo + "K" else "fail"
return ok
}
fun box(): String {
return CompositePhase<Bound, Int>("O").bar()
}