JVM_IR: use nullability when boxing/unboxing inline class types

Given inline class V(Any?), a coercion from (Object, V) to (Object, V?)
is boxing.

In theory, the same issue in the old backend can be fixed by making
`KotlinTypeMapper.mapUnderlyingTypeOfInlineClassType` use
`computeExpandedTypeForInlineClass`, but for some reason this breaks a
lot of stuff.

 #KT-48430 Fixed
This commit is contained in:
pyos
2021-08-30 12:27:40 +02:00
committed by teamcityserver
parent d4a8c51637
commit 5e4f022c59
11 changed files with 95 additions and 43 deletions
@@ -0,0 +1,10 @@
// IGNORE_BACKEND: JVM
abstract class C<T> {
fun foo(v: T?, x: (T) -> Any?) = v?.let { x(it) }
}
inline class V(val value: Any?)
class D : C<V>()
fun box() = D().foo(V("OK")) { it.value } as String