class Inv(val x: X) fun test_0(list: List, b: Boolean) { val x = list.mapNotNull { if (b) Inv(it) else null }.first().x }