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:
@@ -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()
|
||||
}
|
||||
Reference in New Issue
Block a user