// ISSUE: KT-62863 fun materialize(): K = null!! interface Foo { fun foo() } abstract class Bar { abstract fun bar() } fun Foo.extFoo() {} fun Bar.extBar() {} fun test_1(x: Any) { x as Bar x as Foo x.foo() x.bar() x.extFoo() x.extBar() } fun test_2(x: Any) { x as Bar? x as Foo? x!!.foo() x!!.bar() x!!.extFoo() x!!.extBar() } fun test_3(x: Any) { x as Bar? x as Foo? (x ?: materialize()).foo() (x ?: materialize()).bar() (x ?: materialize()).extFoo() (x ?: materialize()).extBar() }