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