JVM_IR: keep suspend fun return type in IrCalls

Otherwise:

  * should the dispatch receiver of a call be another call to a `suspend
    fun` wrapped in something that is optimized away later, the owner of
    the method will be incorrect;

  * references to functions returning non-Unit but casted to `() ->
    Unit` (allowed by new inference) might in fact not return Unit after
    tail call optimization.
This commit is contained in:
pyos
2020-02-21 12:49:07 +01:00
committed by Ilmir Usmanov
parent d982203d56
commit a3d85e108f
11 changed files with 177 additions and 29 deletions
@@ -6785,6 +6785,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunImportedFromObject.kt", "kotlin.coroutines");
}
@TestMetadata("suspendImplBridge.kt")
public void testSuspendImplBridge() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/suspendImplBridge.kt");
}
@TestMetadata("suspendInCycle.kt")
public void testSuspendInCycle_1_2() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendInCycle.kt", "kotlin.coroutines.experimental");
@@ -6830,6 +6835,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
runTest("compiler/testData/codegen/box/coroutines/suspendJavaOverrides.kt");
}
@TestMetadata("suspendReturningPlatformType.kt")
public void testSuspendReturningPlatformType() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/suspendReturningPlatformType.kt");
}
@TestMetadata("suspensionInsideSafeCallWithElvis.kt")
public void testSuspensionInsideSafeCallWithElvis_1_2() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspensionInsideSafeCallWithElvis.kt", "kotlin.coroutines.experimental");
@@ -8715,6 +8725,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/tailCallOptimizations/unit"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
}
@TestMetadata("functionReference.kt")
public void testFunctionReference() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/tailCallOptimizations/unit/functionReference.kt");
}
@TestMetadata("override.kt")
public void testOverride() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/tailCallOptimizations/unit/override.kt");