interface Bound interface CompilerPhase private class CompositePhase( val foo: String ) : CompilerPhase @Suppress("UNCHECKED_CAST") fun CompilerPhase.bar(): String { this as CompilerPhase val ok = if (this is CompositePhase) foo + "K" else "fail" return ok } fun box(): String { return CompositePhase("O").bar() }