KT-27524 Don't box (some) inline classes in suspend fun return
If an inline class is mapped to a reference type (or an array), it's Ok to treat JVM view on a suspend function as returning a value of corresponding inline class (although in reality it returns 'Any?' because of COROUTINE_SUSPENDED).
This commit is contained in:
+80
@@ -7733,6 +7733,86 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_Any.kt")
|
||||
public void testBoxUnboxInsideCoroutine_Any_1_2() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_Any.kt", "kotlin.coroutines.experimental");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_Any.kt")
|
||||
public void testBoxUnboxInsideCoroutine_Any_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_Any.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_InlineAny.kt")
|
||||
public void testBoxUnboxInsideCoroutine_InlineAny_1_2() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_InlineAny.kt", "kotlin.coroutines.experimental");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_InlineAny.kt")
|
||||
public void testBoxUnboxInsideCoroutine_InlineAny_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_InlineAny.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_InlineInt.kt")
|
||||
public void testBoxUnboxInsideCoroutine_InlineInt_1_2() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_InlineInt.kt", "kotlin.coroutines.experimental");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_InlineInt.kt")
|
||||
public void testBoxUnboxInsideCoroutine_InlineInt_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_InlineInt.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_Int.kt")
|
||||
public void testBoxUnboxInsideCoroutine_Int_1_2() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_Int.kt", "kotlin.coroutines.experimental");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_Int.kt")
|
||||
public void testBoxUnboxInsideCoroutine_Int_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_Int.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_Long.kt")
|
||||
public void testBoxUnboxInsideCoroutine_Long_1_2() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_Long.kt", "kotlin.coroutines.experimental");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_Long.kt")
|
||||
public void testBoxUnboxInsideCoroutine_Long_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_Long.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_NAny.kt")
|
||||
public void testBoxUnboxInsideCoroutine_NAny_1_2() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_NAny.kt", "kotlin.coroutines.experimental");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_NAny.kt")
|
||||
public void testBoxUnboxInsideCoroutine_NAny_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_NAny.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_nonLocalReturn.kt")
|
||||
public void testBoxUnboxInsideCoroutine_nonLocalReturn_1_2() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_nonLocalReturn.kt", "kotlin.coroutines.experimental");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_nonLocalReturn.kt")
|
||||
public void testBoxUnboxInsideCoroutine_nonLocalReturn_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_nonLocalReturn.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_suspendFunType.kt")
|
||||
public void testBoxUnboxInsideCoroutine_suspendFunType_1_2() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_suspendFunType.kt", "kotlin.coroutines.experimental");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_suspendFunType.kt")
|
||||
public void testBoxUnboxInsideCoroutine_suspendFunType_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_suspendFunType.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("bridgeGenerationCrossinline.kt")
|
||||
public void testBridgeGenerationCrossinline_1_2() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/bridgeGenerationCrossinline.kt", "kotlin.coroutines.experimental");
|
||||
|
||||
@@ -1472,6 +1472,34 @@ public class BytecodeTextTestGenerated extends AbstractBytecodeTextTest {
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/bytecodeText/coroutines/inlineClasses")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class InlineClasses extends AbstractBytecodeTextTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInInlineClasses() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeText/coroutines/inlineClasses"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
|
||||
}
|
||||
|
||||
@TestMetadata("inlineClassBoxingInSuspendFunReturn_Primitive.kt")
|
||||
public void testInlineClassBoxingInSuspendFunReturn_Primitive() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeText/coroutines/inlineClasses/inlineClassBoxingInSuspendFunReturn_Primitive.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("noInlineClassBoxingInSuspendFunReturn_Any.kt")
|
||||
public void testNoInlineClassBoxingInSuspendFunReturn_Any() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeText/coroutines/inlineClasses/noInlineClassBoxingInSuspendFunReturn_Any.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("noInlineClassBoxingInSuspendFunReturn_InlineAny.kt")
|
||||
public void testNoInlineClassBoxingInSuspendFunReturn_InlineAny() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeText/coroutines/inlineClasses/noInlineClassBoxingInSuspendFunReturn_InlineAny.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
+80
@@ -7733,6 +7733,86 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_Any.kt")
|
||||
public void testBoxUnboxInsideCoroutine_Any_1_2() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_Any.kt", "kotlin.coroutines.experimental");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_Any.kt")
|
||||
public void testBoxUnboxInsideCoroutine_Any_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_Any.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_InlineAny.kt")
|
||||
public void testBoxUnboxInsideCoroutine_InlineAny_1_2() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_InlineAny.kt", "kotlin.coroutines.experimental");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_InlineAny.kt")
|
||||
public void testBoxUnboxInsideCoroutine_InlineAny_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_InlineAny.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_InlineInt.kt")
|
||||
public void testBoxUnboxInsideCoroutine_InlineInt_1_2() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_InlineInt.kt", "kotlin.coroutines.experimental");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_InlineInt.kt")
|
||||
public void testBoxUnboxInsideCoroutine_InlineInt_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_InlineInt.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_Int.kt")
|
||||
public void testBoxUnboxInsideCoroutine_Int_1_2() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_Int.kt", "kotlin.coroutines.experimental");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_Int.kt")
|
||||
public void testBoxUnboxInsideCoroutine_Int_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_Int.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_Long.kt")
|
||||
public void testBoxUnboxInsideCoroutine_Long_1_2() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_Long.kt", "kotlin.coroutines.experimental");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_Long.kt")
|
||||
public void testBoxUnboxInsideCoroutine_Long_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_Long.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_NAny.kt")
|
||||
public void testBoxUnboxInsideCoroutine_NAny_1_2() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_NAny.kt", "kotlin.coroutines.experimental");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_NAny.kt")
|
||||
public void testBoxUnboxInsideCoroutine_NAny_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_NAny.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_nonLocalReturn.kt")
|
||||
public void testBoxUnboxInsideCoroutine_nonLocalReturn_1_2() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_nonLocalReturn.kt", "kotlin.coroutines.experimental");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_nonLocalReturn.kt")
|
||||
public void testBoxUnboxInsideCoroutine_nonLocalReturn_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_nonLocalReturn.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_suspendFunType.kt")
|
||||
public void testBoxUnboxInsideCoroutine_suspendFunType_1_2() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_suspendFunType.kt", "kotlin.coroutines.experimental");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_suspendFunType.kt")
|
||||
public void testBoxUnboxInsideCoroutine_suspendFunType_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_suspendFunType.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("bridgeGenerationCrossinline.kt")
|
||||
public void testBridgeGenerationCrossinline_1_2() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/bridgeGenerationCrossinline.kt", "kotlin.coroutines.experimental");
|
||||
|
||||
+40
@@ -7023,6 +7023,46 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_Any.kt")
|
||||
public void testBoxUnboxInsideCoroutine_Any_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_Any.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_InlineAny.kt")
|
||||
public void testBoxUnboxInsideCoroutine_InlineAny_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_InlineAny.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_InlineInt.kt")
|
||||
public void testBoxUnboxInsideCoroutine_InlineInt_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_InlineInt.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_Int.kt")
|
||||
public void testBoxUnboxInsideCoroutine_Int_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_Int.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_Long.kt")
|
||||
public void testBoxUnboxInsideCoroutine_Long_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_Long.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_NAny.kt")
|
||||
public void testBoxUnboxInsideCoroutine_NAny_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_NAny.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_nonLocalReturn.kt")
|
||||
public void testBoxUnboxInsideCoroutine_nonLocalReturn_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_nonLocalReturn.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInsideCoroutine_suspendFunType.kt")
|
||||
public void testBoxUnboxInsideCoroutine_suspendFunType_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_suspendFunType.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("bridgeGenerationCrossinline.kt")
|
||||
public void testBridgeGenerationCrossinline_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/bridgeGenerationCrossinline.kt", "kotlin.coroutines");
|
||||
|
||||
+28
@@ -1477,6 +1477,34 @@ public class IrBytecodeTextTestGenerated extends AbstractIrBytecodeTextTest {
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/bytecodeText/coroutines/inlineClasses")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class InlineClasses extends AbstractIrBytecodeTextTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInInlineClasses() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeText/coroutines/inlineClasses"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@TestMetadata("inlineClassBoxingInSuspendFunReturn_Primitive.kt")
|
||||
public void testInlineClassBoxingInSuspendFunReturn_Primitive() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeText/coroutines/inlineClasses/inlineClassBoxingInSuspendFunReturn_Primitive.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("noInlineClassBoxingInSuspendFunReturn_Any.kt")
|
||||
public void testNoInlineClassBoxingInSuspendFunReturn_Any() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeText/coroutines/inlineClasses/noInlineClassBoxingInSuspendFunReturn_Any.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("noInlineClassBoxingInSuspendFunReturn_InlineAny.kt")
|
||||
public void testNoInlineClassBoxingInSuspendFunReturn_InlineAny() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeText/coroutines/inlineClasses/noInlineClassBoxingInSuspendFunReturn_InlineAny.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/bytecodeText/coroutines/intLikeVarSpilling")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
Reference in New Issue
Block a user