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
@@ -13176,6 +13176,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes
runTest("compiler/testData/codegen/box/inlineClasses/boxImplDoesNotExecuteInitBlock.kt");
}
@TestMetadata("boxNullableForFakeOverride.kt")
public void testBoxNullableForFakeOverride() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/boxNullableForFakeOverride.kt");
}
@TestMetadata("boxNullableValueOfInlineClassWithNonNullUnderlyingType.kt")
public void testBoxNullableValueOfInlineClassWithNonNullUnderlyingType() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/boxNullableValueOfInlineClassWithNonNullUnderlyingType.kt");
@@ -12582,6 +12582,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
runTest("compiler/testData/codegen/box/inlineClasses/boxImplDoesNotExecuteInitBlock.kt");
}
@TestMetadata("boxNullableForFakeOverride.kt")
public void testBoxNullableForFakeOverride() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/boxNullableForFakeOverride.kt");
}
@TestMetadata("boxNullableValueOfInlineClassWithNonNullUnderlyingType.kt")
public void testBoxNullableValueOfInlineClassWithNonNullUnderlyingType() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/boxNullableValueOfInlineClassWithNonNullUnderlyingType.kt");
@@ -12647,6 +12647,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
runTest("compiler/testData/codegen/box/inlineClasses/boxImplDoesNotExecuteInitBlock.kt");
}
@TestMetadata("boxNullableForFakeOverride.kt")
public void testBoxNullableForFakeOverride() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/boxNullableForFakeOverride.kt");
}
@TestMetadata("boxNullableValueOfInlineClassWithNonNullUnderlyingType.kt")
public void testBoxNullableValueOfInlineClassWithNonNullUnderlyingType() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/boxNullableValueOfInlineClassWithNonNullUnderlyingType.kt");
@@ -6727,6 +6727,11 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest
runTest("compiler/testData/codegen/box/inlineClasses/boxImplDoesNotExecuteInitBlock.kt");
}
@TestMetadata("boxNullableForFakeOverride.kt")
public void testBoxNullableForFakeOverride() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/boxNullableForFakeOverride.kt");
}
@TestMetadata("boxNullableValueOfInlineClassWithNonNullUnderlyingType.kt")
public void testBoxNullableValueOfInlineClassWithNonNullUnderlyingType() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/boxNullableValueOfInlineClassWithNonNullUnderlyingType.kt");