abstract class A { abstract protected fun T.foo() fun bar(x: T?) { if (x != null) { x.foo() } } }