open class Foo { fun foo() { if (this is Bar) { consume(this) } } } class Bar : Foo() fun consume(obj: Bar) {}