Files
kotlin-fork/compiler/testData/codegen/box/smartCasts/complexImplicitReceiver.kt
T
Denis.Zharkov b1b89e6f5f 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
2021-01-29 10:50:22 +03:00

18 lines
434 B
Kotlin
Vendored

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()
}