interface A interface B fun T.foo() where T: A, T: B {} fun test(a: Any) { if (a is A && a is B) { a.foo() } }