fun calc(x: List?): Int { // x is not-null only inside subList x?.subList(0, x.size - 1).get(x.size) return x!!.size }