Code snippet
val map = mutableMapOf<String, String>()
map.computeIfAbsent(key) { calcValue(it) }
with calcValue signature:
fun calcValue(key: String): String?
compiles with error:
Type mismatch: inferred type is String? but String was expected
But it is acceptable for mappingFunction to return null in Map.computeIfAbsent.
Is this a bug? Or am I doing something wrong?