fun test1(x: String?): Int { return when { EQEQ(arg0 = x, arg1 = null) -> 0 else -> x.() } } fun test2(x: T): Int { return when { EQEQ(arg0 = x, arg1 = null) -> 0 else -> x.() } } inline fun test3(x: Any): Int { return when { x !is T -> 0 else -> x /*as (T & Any) */.() } } inline fun test4(x: Any?): Int { return when { x !is T -> 0 else -> x /*as T */.() } } fun test5(x: T, fn: Function1) { when { EQEQ(arg0 = x, arg1 = null).not() -> fn.invoke(p1 = x) } }