Box/unbox nullable inline class values with null check
When we have a nullable inline class value with non-null underlying type, corresponding value in unboxed representation is nullable. E.g.: inline class Str(val value: String) fun test(s: Str?) = listOf(s) Here 'test(s: Str?)' accepts nullable 'java.lang.String' as a parameter. When boxing/unboxing nullable values of such inline classes, take care of nulls. #KT-26052 Fixed Target versions 1.3-M2
This commit is contained in:
+25
@@ -9918,6 +9918,16 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/inlineClasses"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JS_IR, true);
|
||||
}
|
||||
|
||||
@TestMetadata("boxNullableValueOfInlineClassWithNonNullUnderlyingType.kt")
|
||||
public void testBoxNullableValueOfInlineClassWithNonNullUnderlyingType() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/boxNullableValueOfInlineClassWithNonNullUnderlyingType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("boxNullableValueOfInlineClassWithPrimitiveUnderlyingType.kt")
|
||||
public void testBoxNullableValueOfInlineClassWithPrimitiveUnderlyingType() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/boxNullableValueOfInlineClassWithPrimitiveUnderlyingType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInlineClassesWithOperatorsGetSet.kt")
|
||||
public void testBoxUnboxInlineClassesWithOperatorsGetSet() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/boxUnboxInlineClassesWithOperatorsGetSet.kt");
|
||||
@@ -10048,6 +10058,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/emptyConstructorForInlineClass.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("equalityForBoxesOfNullableValuesOfInlineClass.kt")
|
||||
public void testEqualityForBoxesOfNullableValuesOfInlineClass() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/equalityForBoxesOfNullableValuesOfInlineClass.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineClassAsLastExpressionInInLambda.kt")
|
||||
public void testInlineClassAsLastExpressionInInLambda() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/inlineClassAsLastExpressionInInLambda.kt");
|
||||
@@ -10148,6 +10163,16 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/UIntArraySortExample.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("unboxNullableValueOfInlineClassWithNonNullUnderlyingType.kt")
|
||||
public void testUnboxNullableValueOfInlineClassWithNonNullUnderlyingType() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/unboxNullableValueOfInlineClassWithNonNullUnderlyingType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("unboxNullableValueOfInlineClassWithPrimitiveUnderlyingType.kt")
|
||||
public void testUnboxNullableValueOfInlineClassWithPrimitiveUnderlyingType() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/unboxNullableValueOfInlineClassWithPrimitiveUnderlyingType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("unboxReceiverOnCallingMethodFromInlineClass.kt")
|
||||
public void testUnboxReceiverOnCallingMethodFromInlineClass() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/unboxReceiverOnCallingMethodFromInlineClass.kt");
|
||||
|
||||
+25
@@ -10968,6 +10968,16 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/inlineClasses"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JS, true);
|
||||
}
|
||||
|
||||
@TestMetadata("boxNullableValueOfInlineClassWithNonNullUnderlyingType.kt")
|
||||
public void testBoxNullableValueOfInlineClassWithNonNullUnderlyingType() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/boxNullableValueOfInlineClassWithNonNullUnderlyingType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("boxNullableValueOfInlineClassWithPrimitiveUnderlyingType.kt")
|
||||
public void testBoxNullableValueOfInlineClassWithPrimitiveUnderlyingType() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/boxNullableValueOfInlineClassWithPrimitiveUnderlyingType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInlineClassesWithOperatorsGetSet.kt")
|
||||
public void testBoxUnboxInlineClassesWithOperatorsGetSet() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/boxUnboxInlineClassesWithOperatorsGetSet.kt");
|
||||
@@ -11098,6 +11108,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/emptyConstructorForInlineClass.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("equalityForBoxesOfNullableValuesOfInlineClass.kt")
|
||||
public void testEqualityForBoxesOfNullableValuesOfInlineClass() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/equalityForBoxesOfNullableValuesOfInlineClass.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineClassAsLastExpressionInInLambda.kt")
|
||||
public void testInlineClassAsLastExpressionInInLambda() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/inlineClassAsLastExpressionInInLambda.kt");
|
||||
@@ -11198,6 +11213,16 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/UIntArraySortExample.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("unboxNullableValueOfInlineClassWithNonNullUnderlyingType.kt")
|
||||
public void testUnboxNullableValueOfInlineClassWithNonNullUnderlyingType() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/unboxNullableValueOfInlineClassWithNonNullUnderlyingType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("unboxNullableValueOfInlineClassWithPrimitiveUnderlyingType.kt")
|
||||
public void testUnboxNullableValueOfInlineClassWithPrimitiveUnderlyingType() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/unboxNullableValueOfInlineClassWithPrimitiveUnderlyingType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("unboxReceiverOnCallingMethodFromInlineClass.kt")
|
||||
public void testUnboxReceiverOnCallingMethodFromInlineClass() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/unboxReceiverOnCallingMethodFromInlineClass.kt");
|
||||
|
||||
Reference in New Issue
Block a user