I don't know for sure if it will box them or not, but I would guess it would. My comment about performance was because the you are probably doing a null check in the else case which wouldn't exist with a regular
val v = if() {} else {}
construct. So it would look like
val v = (if(bool) {trueResult} else {null}) ?: {falseResult}