interface T { fun foo(): Int } interface U: T fun test(t: T): Int { return if (t is U) t.foo() + 1 else t.foo() }