Add tests with resume path

This commit is contained in:
Ilmir Usmanov
2020-09-02 21:15:05 +02:00
parent 1c97eafea8
commit 7cbd067460
118 changed files with 8989 additions and 1444 deletions
@@ -7428,207 +7428,614 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
KotlinTestUtils.runTestWithCustomIgnoreDirective(this::doTest, TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: ");
}
private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception {
KotlinTestUtils.runTestWithCustomIgnoreDirective(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: ");
}
public void testAllFilesPresentInInlineClasses() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/inlineClasses"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
}
@TestMetadata("boxReturnValueOfSuspendFunctionReference.kt")
public void testBoxReturnValueOfSuspendFunctionReference() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/boxReturnValueOfSuspendFunctionReference.kt");
@TestMetadata("compiler/testData/codegen/box/coroutines/inlineClasses/direct")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Direct extends AbstractFirBlackBoxCodegenTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTestWithCustomIgnoreDirective(this::doTest, TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: ");
}
private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception {
KotlinTestUtils.runTestWithCustomIgnoreDirective(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: ");
}
public void testAllFilesPresentInDirect() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/inlineClasses/direct"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
}
@TestMetadata("boxReturnValueOfSuspendFunctionReference.kt")
public void testBoxReturnValueOfSuspendFunctionReference() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxReturnValueOfSuspendFunctionReference.kt");
}
@TestMetadata("boxReturnValueOfSuspendLambda.kt")
public void testBoxReturnValueOfSuspendLambda() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxReturnValueOfSuspendLambda.kt");
}
@TestMetadata("boxUnboxInsideCoroutine.kt")
public void testBoxUnboxInsideCoroutine_1_3() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine.kt", "kotlin.coroutines");
}
@TestMetadata("boxUnboxInsideCoroutine_Any.kt")
public void testBoxUnboxInsideCoroutine_Any_1_3() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_Any.kt", "kotlin.coroutines");
}
@TestMetadata("boxUnboxInsideCoroutine_InlineAny.kt")
public void testBoxUnboxInsideCoroutine_InlineAny_1_3() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_InlineAny.kt", "kotlin.coroutines");
}
@TestMetadata("boxUnboxInsideCoroutine_InlineInt.kt")
public void testBoxUnboxInsideCoroutine_InlineInt_1_3() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_InlineInt.kt", "kotlin.coroutines");
}
@TestMetadata("boxUnboxInsideCoroutine_Int.kt")
public void testBoxUnboxInsideCoroutine_Int_1_3() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_Int.kt", "kotlin.coroutines");
}
@TestMetadata("boxUnboxInsideCoroutine_Long.kt")
public void testBoxUnboxInsideCoroutine_Long_1_3() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_Long.kt", "kotlin.coroutines");
}
@TestMetadata("boxUnboxInsideCoroutine_NAny.kt")
public void testBoxUnboxInsideCoroutine_NAny_1_3() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_NAny.kt", "kotlin.coroutines");
}
@TestMetadata("boxUnboxInsideCoroutine_nonLocalReturn.kt")
public void testBoxUnboxInsideCoroutine_nonLocalReturn_1_3() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_nonLocalReturn.kt", "kotlin.coroutines");
}
@TestMetadata("boxUnboxInsideCoroutine_suspendFunType.kt")
public void testBoxUnboxInsideCoroutine_suspendFunType_1_3() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/boxUnboxInsideCoroutine_suspendFunType.kt", "kotlin.coroutines");
}
@TestMetadata("bridgeGenerationCrossinline.kt")
public void testBridgeGenerationCrossinline_1_3() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/bridgeGenerationCrossinline.kt", "kotlin.coroutines");
}
@TestMetadata("bridgeGenerationNonInline.kt")
public void testBridgeGenerationNonInline_1_3() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/bridgeGenerationNonInline.kt", "kotlin.coroutines");
}
@TestMetadata("covariantOverrideSuspendFun.kt")
public void testCovariantOverrideSuspendFun() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/covariantOverrideSuspendFun.kt");
}
@TestMetadata("covariantOverrideSuspendFunWithNullableInlineClass.kt")
public void testCovariantOverrideSuspendFunWithNullableInlineClass() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/covariantOverrideSuspendFunWithNullableInlineClass.kt");
}
@TestMetadata("covariantOverrideSuspendFunWithNullableInlineClass_Any.kt")
public void testCovariantOverrideSuspendFunWithNullableInlineClass_Any() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/covariantOverrideSuspendFunWithNullableInlineClass_Any.kt");
}
@TestMetadata("covariantOverrideSuspendFunWithNullableInlineClass_Int.kt")
public void testCovariantOverrideSuspendFunWithNullableInlineClass_Int() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/covariantOverrideSuspendFunWithNullableInlineClass_Int.kt");
}
@TestMetadata("covariantOverrideSuspendFunWithNullableInlineClass_NullableAny.kt")
public void testCovariantOverrideSuspendFunWithNullableInlineClass_NullableAny() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/covariantOverrideSuspendFunWithNullableInlineClass_NullableAny.kt");
}
@TestMetadata("covariantOverrideSuspendFunWithNullableInlineClass_NullableAny_null.kt")
public void testCovariantOverrideSuspendFunWithNullableInlineClass_NullableAny_null() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/covariantOverrideSuspendFunWithNullableInlineClass_NullableAny_null.kt");
}
@TestMetadata("covariantOverrideSuspendFunWithNullableInlineClass_NullableInt.kt")
public void testCovariantOverrideSuspendFunWithNullableInlineClass_NullableInt() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/covariantOverrideSuspendFunWithNullableInlineClass_NullableInt.kt");
}
@TestMetadata("covariantOverrideSuspendFunWithNullableInlineClass_NullableInt_null.kt")
public void testCovariantOverrideSuspendFunWithNullableInlineClass_NullableInt_null() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/covariantOverrideSuspendFunWithNullableInlineClass_NullableInt_null.kt");
}
@TestMetadata("covariantOverrideSuspendFun_Any.kt")
public void testCovariantOverrideSuspendFun_Any() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/covariantOverrideSuspendFun_Any.kt");
}
@TestMetadata("covariantOverrideSuspendFun_Int.kt")
public void testCovariantOverrideSuspendFun_Int() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/covariantOverrideSuspendFun_Int.kt");
}
@TestMetadata("genericOverrideSuspendFun.kt")
public void testGenericOverrideSuspendFun() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/genericOverrideSuspendFun.kt");
}
@TestMetadata("genericOverrideSuspendFun_Any.kt")
public void testGenericOverrideSuspendFun_Any() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/genericOverrideSuspendFun_Any.kt");
}
@TestMetadata("genericOverrideSuspendFun_Any_NullableInlineClassUpperBound.kt")
public void testGenericOverrideSuspendFun_Any_NullableInlineClassUpperBound() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/genericOverrideSuspendFun_Any_NullableInlineClassUpperBound.kt");
}
@TestMetadata("genericOverrideSuspendFun_Int.kt")
public void testGenericOverrideSuspendFun_Int() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/genericOverrideSuspendFun_Int.kt");
}
@TestMetadata("genericOverrideSuspendFun_NullableAny.kt")
public void testGenericOverrideSuspendFun_NullableAny() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/genericOverrideSuspendFun_NullableAny.kt");
}
@TestMetadata("genericOverrideSuspendFun_NullableAny_null.kt")
public void testGenericOverrideSuspendFun_NullableAny_null() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/genericOverrideSuspendFun_NullableAny_null.kt");
}
@TestMetadata("genericOverrideSuspendFun_NullableInt.kt")
public void testGenericOverrideSuspendFun_NullableInt() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/genericOverrideSuspendFun_NullableInt.kt");
}
@TestMetadata("genericOverrideSuspendFun_NullableInt_null.kt")
public void testGenericOverrideSuspendFun_NullableInt_null() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/genericOverrideSuspendFun_NullableInt_null.kt");
}
@TestMetadata("interfaceDelegateWithInlineClass.kt")
public void testInterfaceDelegateWithInlineClass_1_3() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/interfaceDelegateWithInlineClass.kt", "kotlin.coroutines");
}
@TestMetadata("overrideSuspendFun.kt")
public void testOverrideSuspendFun_1_3() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun.kt", "kotlin.coroutines");
}
@TestMetadata("overrideSuspendFun_Any.kt")
public void testOverrideSuspendFun_Any_1_3() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun_Any.kt", "kotlin.coroutines");
}
@TestMetadata("overrideSuspendFun_Any_itf.kt")
public void testOverrideSuspendFun_Any_itf_1_3() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun_Any_itf.kt", "kotlin.coroutines");
}
@TestMetadata("overrideSuspendFun_Any_this.kt")
public void testOverrideSuspendFun_Any_this_1_3() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun_Any_this.kt", "kotlin.coroutines");
}
@TestMetadata("overrideSuspendFun_Int.kt")
public void testOverrideSuspendFun_Int_1_3() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun_Int.kt", "kotlin.coroutines");
}
@TestMetadata("returnResult.kt")
public void testReturnResult() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/returnResult.kt");
}
}
@TestMetadata("boxReturnValueOfSuspendFunctionReferenceResume.kt")
public void testBoxReturnValueOfSuspendFunctionReferenceResume() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/boxReturnValueOfSuspendFunctionReferenceResume.kt");
@TestMetadata("compiler/testData/codegen/box/coroutines/inlineClasses/resume")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Resume extends AbstractFirBlackBoxCodegenTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTestWithCustomIgnoreDirective(this::doTest, TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: ");
}
private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception {
KotlinTestUtils.runTestWithCustomIgnoreDirective(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: ");
}
public void testAllFilesPresentInResume() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/inlineClasses/resume"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
}
@TestMetadata("boxReturnValueOfSuspendFunctionReference.kt")
public void testBoxReturnValueOfSuspendFunctionReference() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxReturnValueOfSuspendFunctionReference.kt");
}
@TestMetadata("boxReturnValueOfSuspendLambda.kt")
public void testBoxReturnValueOfSuspendLambda() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxReturnValueOfSuspendLambda.kt");
}
@TestMetadata("boxUnboxInsideCoroutine.kt")
public void testBoxUnboxInsideCoroutine_1_3() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine.kt", "kotlin.coroutines");
}
@TestMetadata("boxUnboxInsideCoroutine_Any.kt")
public void testBoxUnboxInsideCoroutine_Any_1_3() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_Any.kt", "kotlin.coroutines");
}
@TestMetadata("boxUnboxInsideCoroutine_InlineAny.kt")
public void testBoxUnboxInsideCoroutine_InlineAny_1_3() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_InlineAny.kt", "kotlin.coroutines");
}
@TestMetadata("boxUnboxInsideCoroutine_InlineInt.kt")
public void testBoxUnboxInsideCoroutine_InlineInt_1_3() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_InlineInt.kt", "kotlin.coroutines");
}
@TestMetadata("boxUnboxInsideCoroutine_Int.kt")
public void testBoxUnboxInsideCoroutine_Int_1_3() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_Int.kt", "kotlin.coroutines");
}
@TestMetadata("boxUnboxInsideCoroutine_Long.kt")
public void testBoxUnboxInsideCoroutine_Long_1_3() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_Long.kt", "kotlin.coroutines");
}
@TestMetadata("boxUnboxInsideCoroutine_NAny.kt")
public void testBoxUnboxInsideCoroutine_NAny_1_3() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_NAny.kt", "kotlin.coroutines");
}
@TestMetadata("boxUnboxInsideCoroutine_nonLocalReturn.kt")
public void testBoxUnboxInsideCoroutine_nonLocalReturn_1_3() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_nonLocalReturn.kt", "kotlin.coroutines");
}
@TestMetadata("boxUnboxInsideCoroutine_suspendFunType.kt")
public void testBoxUnboxInsideCoroutine_suspendFunType_1_3() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/boxUnboxInsideCoroutine_suspendFunType.kt", "kotlin.coroutines");
}
@TestMetadata("bridgeGenerationCrossinline.kt")
public void testBridgeGenerationCrossinline_1_3() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/bridgeGenerationCrossinline.kt", "kotlin.coroutines");
}
@TestMetadata("bridgeGenerationNonInline.kt")
public void testBridgeGenerationNonInline_1_3() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/bridgeGenerationNonInline.kt", "kotlin.coroutines");
}
@TestMetadata("covariantOverrideSuspendFun.kt")
public void testCovariantOverrideSuspendFun() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/covariantOverrideSuspendFun.kt");
}
@TestMetadata("covariantOverrideSuspendFunWithNullableInlineClass.kt")
public void testCovariantOverrideSuspendFunWithNullableInlineClass() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/covariantOverrideSuspendFunWithNullableInlineClass.kt");
}
@TestMetadata("covariantOverrideSuspendFunWithNullableInlineClass_Any.kt")
public void testCovariantOverrideSuspendFunWithNullableInlineClass_Any() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/covariantOverrideSuspendFunWithNullableInlineClass_Any.kt");
}
@TestMetadata("covariantOverrideSuspendFunWithNullableInlineClass_Int.kt")
public void testCovariantOverrideSuspendFunWithNullableInlineClass_Int() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/covariantOverrideSuspendFunWithNullableInlineClass_Int.kt");
}
@TestMetadata("covariantOverrideSuspendFunWithNullableInlineClass_NullableAny.kt")
public void testCovariantOverrideSuspendFunWithNullableInlineClass_NullableAny() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/covariantOverrideSuspendFunWithNullableInlineClass_NullableAny.kt");
}
@TestMetadata("covariantOverrideSuspendFunWithNullableInlineClass_NullableAny_null.kt")
public void testCovariantOverrideSuspendFunWithNullableInlineClass_NullableAny_null() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/covariantOverrideSuspendFunWithNullableInlineClass_NullableAny_null.kt");
}
@TestMetadata("covariantOverrideSuspendFunWithNullableInlineClass_NullableInt.kt")
public void testCovariantOverrideSuspendFunWithNullableInlineClass_NullableInt() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/covariantOverrideSuspendFunWithNullableInlineClass_NullableInt.kt");
}
@TestMetadata("covariantOverrideSuspendFunWithNullableInlineClass_NullableInt_null.kt")
public void testCovariantOverrideSuspendFunWithNullableInlineClass_NullableInt_null() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/covariantOverrideSuspendFunWithNullableInlineClass_NullableInt_null.kt");
}
@TestMetadata("covariantOverrideSuspendFun_Any.kt")
public void testCovariantOverrideSuspendFun_Any() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/covariantOverrideSuspendFun_Any.kt");
}
@TestMetadata("covariantOverrideSuspendFun_Int.kt")
public void testCovariantOverrideSuspendFun_Int() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/covariantOverrideSuspendFun_Int.kt");
}
@TestMetadata("genericOverrideSuspendFun.kt")
public void testGenericOverrideSuspendFun() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/genericOverrideSuspendFun.kt");
}
@TestMetadata("genericOverrideSuspendFun_Any.kt")
public void testGenericOverrideSuspendFun_Any() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/genericOverrideSuspendFun_Any.kt");
}
@TestMetadata("genericOverrideSuspendFun_Any_NullableInlineClassUpperBound.kt")
public void testGenericOverrideSuspendFun_Any_NullableInlineClassUpperBound() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/genericOverrideSuspendFun_Any_NullableInlineClassUpperBound.kt");
}
@TestMetadata("genericOverrideSuspendFun_Int.kt")
public void testGenericOverrideSuspendFun_Int() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/genericOverrideSuspendFun_Int.kt");
}
@TestMetadata("genericOverrideSuspendFun_NullableAny.kt")
public void testGenericOverrideSuspendFun_NullableAny() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/genericOverrideSuspendFun_NullableAny.kt");
}
@TestMetadata("genericOverrideSuspendFun_NullableAny_null.kt")
public void testGenericOverrideSuspendFun_NullableAny_null() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/genericOverrideSuspendFun_NullableAny_null.kt");
}
@TestMetadata("genericOverrideSuspendFun_NullableInt.kt")
public void testGenericOverrideSuspendFun_NullableInt() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/genericOverrideSuspendFun_NullableInt.kt");
}
@TestMetadata("genericOverrideSuspendFun_NullableInt_null.kt")
public void testGenericOverrideSuspendFun_NullableInt_null() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/genericOverrideSuspendFun_NullableInt_null.kt");
}
@TestMetadata("interfaceDelegateWithInlineClass.kt")
public void testInterfaceDelegateWithInlineClass_1_3() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/interfaceDelegateWithInlineClass.kt", "kotlin.coroutines");
}
@TestMetadata("overrideSuspendFun.kt")
public void testOverrideSuspendFun_1_3() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun.kt", "kotlin.coroutines");
}
@TestMetadata("overrideSuspendFun_Any.kt")
public void testOverrideSuspendFun_Any_1_3() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun_Any.kt", "kotlin.coroutines");
}
@TestMetadata("overrideSuspendFun_Any_itf.kt")
public void testOverrideSuspendFun_Any_itf_1_3() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun_Any_itf.kt", "kotlin.coroutines");
}
@TestMetadata("overrideSuspendFun_Any_this.kt")
public void testOverrideSuspendFun_Any_this_1_3() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun_Any_this.kt", "kotlin.coroutines");
}
@TestMetadata("overrideSuspendFun_Int.kt")
public void testOverrideSuspendFun_Int_1_3() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resume/overrideSuspendFun_Int.kt", "kotlin.coroutines");
}
@TestMetadata("returnResult.kt")
public void testReturnResult() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resume/returnResult.kt");
}
}
@TestMetadata("boxReturnValueOfSuspendLambda.kt")
public void testBoxReturnValueOfSuspendLambda() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/boxReturnValueOfSuspendLambda.kt");
}
@TestMetadata("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class ResumeWithException extends AbstractFirBlackBoxCodegenTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTestWithCustomIgnoreDirective(this::doTest, TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: ");
}
@TestMetadata("boxUnboxInsideCoroutine.kt")
public void testBoxUnboxInsideCoroutine_1_3() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine.kt", "kotlin.coroutines");
}
private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception {
KotlinTestUtils.runTestWithCustomIgnoreDirective(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: ");
}
@TestMetadata("boxUnboxInsideCoroutine_Any.kt")
public void testBoxUnboxInsideCoroutine_Any_1_3() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/boxUnboxInsideCoroutine_Any.kt", "kotlin.coroutines");
}
public void testAllFilesPresentInResumeWithException() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
}
@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("boxReturnValueOfSuspendFunctionReference.kt")
public void testBoxReturnValueOfSuspendFunctionReference() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxReturnValueOfSuspendFunctionReference.kt");
}
@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("boxReturnValueOfSuspendLambda.kt")
public void testBoxReturnValueOfSuspendLambda() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxReturnValueOfSuspendLambda.kt");
}
@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.kt")
public void testBoxUnboxInsideCoroutine_1_3() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine.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_Any.kt")
public void testBoxUnboxInsideCoroutine_Any_1_3() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_Any.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_InlineAny.kt")
public void testBoxUnboxInsideCoroutine_InlineAny_1_3() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_InlineAny.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_InlineInt.kt")
public void testBoxUnboxInsideCoroutine_InlineInt_1_3() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_InlineInt.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("boxUnboxInsideCoroutine_Int.kt")
public void testBoxUnboxInsideCoroutine_Int_1_3() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_Int.kt", "kotlin.coroutines");
}
@TestMetadata("bridgeGenerationCrossinline.kt")
public void testBridgeGenerationCrossinline_1_3() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/bridgeGenerationCrossinline.kt", "kotlin.coroutines");
}
@TestMetadata("boxUnboxInsideCoroutine_Long.kt")
public void testBoxUnboxInsideCoroutine_Long_1_3() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_Long.kt", "kotlin.coroutines");
}
@TestMetadata("bridgeGenerationNonInline.kt")
public void testBridgeGenerationNonInline_1_3() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/bridgeGenerationNonInline.kt", "kotlin.coroutines");
}
@TestMetadata("boxUnboxInsideCoroutine_NAny.kt")
public void testBoxUnboxInsideCoroutine_NAny_1_3() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_NAny.kt", "kotlin.coroutines");
}
@TestMetadata("covariantOverrideSuspendFun.kt")
public void testCovariantOverrideSuspendFun() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/covariantOverrideSuspendFun.kt");
}
@TestMetadata("boxUnboxInsideCoroutine_nonLocalReturn.kt")
public void testBoxUnboxInsideCoroutine_nonLocalReturn_1_3() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_nonLocalReturn.kt", "kotlin.coroutines");
}
@TestMetadata("covariantOverrideSuspendFunWithNullableInlineClass.kt")
public void testCovariantOverrideSuspendFunWithNullableInlineClass() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/covariantOverrideSuspendFunWithNullableInlineClass.kt");
}
@TestMetadata("boxUnboxInsideCoroutine_suspendFunType.kt")
public void testBoxUnboxInsideCoroutine_suspendFunType_1_3() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/boxUnboxInsideCoroutine_suspendFunType.kt", "kotlin.coroutines");
}
@TestMetadata("covariantOverrideSuspendFunWithNullableInlineClass_Any.kt")
public void testCovariantOverrideSuspendFunWithNullableInlineClass_Any() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/covariantOverrideSuspendFunWithNullableInlineClass_Any.kt");
}
@TestMetadata("bridgeGenerationCrossinline.kt")
public void testBridgeGenerationCrossinline_1_3() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/bridgeGenerationCrossinline.kt", "kotlin.coroutines");
}
@TestMetadata("covariantOverrideSuspendFunWithNullableInlineClass_Int.kt")
public void testCovariantOverrideSuspendFunWithNullableInlineClass_Int() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/covariantOverrideSuspendFunWithNullableInlineClass_Int.kt");
}
@TestMetadata("bridgeGenerationNonInline.kt")
public void testBridgeGenerationNonInline_1_3() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/bridgeGenerationNonInline.kt", "kotlin.coroutines");
}
@TestMetadata("covariantOverrideSuspendFunWithNullableInlineClass_NullableAny.kt")
public void testCovariantOverrideSuspendFunWithNullableInlineClass_NullableAny() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/covariantOverrideSuspendFunWithNullableInlineClass_NullableAny.kt");
}
@TestMetadata("covariantOverrideSuspendFun.kt")
public void testCovariantOverrideSuspendFun() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/covariantOverrideSuspendFun.kt");
}
@TestMetadata("covariantOverrideSuspendFunWithNullableInlineClass_NullableAny_null.kt")
public void testCovariantOverrideSuspendFunWithNullableInlineClass_NullableAny_null() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/covariantOverrideSuspendFunWithNullableInlineClass_NullableAny_null.kt");
}
@TestMetadata("covariantOverrideSuspendFunWithNullableInlineClass.kt")
public void testCovariantOverrideSuspendFunWithNullableInlineClass() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/covariantOverrideSuspendFunWithNullableInlineClass.kt");
}
@TestMetadata("covariantOverrideSuspendFunWithNullableInlineClass_NullableInt.kt")
public void testCovariantOverrideSuspendFunWithNullableInlineClass_NullableInt() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/covariantOverrideSuspendFunWithNullableInlineClass_NullableInt.kt");
}
@TestMetadata("covariantOverrideSuspendFunWithNullableInlineClass_Any.kt")
public void testCovariantOverrideSuspendFunWithNullableInlineClass_Any() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/covariantOverrideSuspendFunWithNullableInlineClass_Any.kt");
}
@TestMetadata("covariantOverrideSuspendFunWithNullableInlineClass_NullableInt_null.kt")
public void testCovariantOverrideSuspendFunWithNullableInlineClass_NullableInt_null() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/covariantOverrideSuspendFunWithNullableInlineClass_NullableInt_null.kt");
}
@TestMetadata("covariantOverrideSuspendFunWithNullableInlineClass_Int.kt")
public void testCovariantOverrideSuspendFunWithNullableInlineClass_Int() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/covariantOverrideSuspendFunWithNullableInlineClass_Int.kt");
}
@TestMetadata("covariantOverrideSuspendFun_Any.kt")
public void testCovariantOverrideSuspendFun_Any() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/covariantOverrideSuspendFun_Any.kt");
}
@TestMetadata("covariantOverrideSuspendFunWithNullableInlineClass_NullableAny.kt")
public void testCovariantOverrideSuspendFunWithNullableInlineClass_NullableAny() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/covariantOverrideSuspendFunWithNullableInlineClass_NullableAny.kt");
}
@TestMetadata("covariantOverrideSuspendFun_Int.kt")
public void testCovariantOverrideSuspendFun_Int() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/covariantOverrideSuspendFun_Int.kt");
}
@TestMetadata("covariantOverrideSuspendFunWithNullableInlineClass_NullableAny_null.kt")
public void testCovariantOverrideSuspendFunWithNullableInlineClass_NullableAny_null() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/covariantOverrideSuspendFunWithNullableInlineClass_NullableAny_null.kt");
}
@TestMetadata("genericOverrideSuspendFun.kt")
public void testGenericOverrideSuspendFun() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/genericOverrideSuspendFun.kt");
}
@TestMetadata("covariantOverrideSuspendFunWithNullableInlineClass_NullableInt.kt")
public void testCovariantOverrideSuspendFunWithNullableInlineClass_NullableInt() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/covariantOverrideSuspendFunWithNullableInlineClass_NullableInt.kt");
}
@TestMetadata("genericOverrideSuspendFun_Any.kt")
public void testGenericOverrideSuspendFun_Any() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/genericOverrideSuspendFun_Any.kt");
}
@TestMetadata("covariantOverrideSuspendFun_Any.kt")
public void testCovariantOverrideSuspendFun_Any() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/covariantOverrideSuspendFun_Any.kt");
}
@TestMetadata("genericOverrideSuspendFun_Any_NullableInlineClassUpperBound.kt")
public void testGenericOverrideSuspendFun_Any_NullableInlineClassUpperBound() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/genericOverrideSuspendFun_Any_NullableInlineClassUpperBound.kt");
}
@TestMetadata("covariantOverrideSuspendFun_Int.kt")
public void testCovariantOverrideSuspendFun_Int() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/covariantOverrideSuspendFun_Int.kt");
}
@TestMetadata("genericOverrideSuspendFun_Int.kt")
public void testGenericOverrideSuspendFun_Int() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/genericOverrideSuspendFun_Int.kt");
}
@TestMetadata("genericOverrideSuspendFun.kt")
public void testGenericOverrideSuspendFun() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/genericOverrideSuspendFun.kt");
}
@TestMetadata("genericOverrideSuspendFun_NullableAny.kt")
public void testGenericOverrideSuspendFun_NullableAny() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/genericOverrideSuspendFun_NullableAny.kt");
}
@TestMetadata("genericOverrideSuspendFun_Any.kt")
public void testGenericOverrideSuspendFun_Any() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/genericOverrideSuspendFun_Any.kt");
}
@TestMetadata("genericOverrideSuspendFun_NullableAny_null.kt")
public void testGenericOverrideSuspendFun_NullableAny_null() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/genericOverrideSuspendFun_NullableAny_null.kt");
}
@TestMetadata("genericOverrideSuspendFun_Any_NullableInlineClassUpperBound.kt")
public void testGenericOverrideSuspendFun_Any_NullableInlineClassUpperBound() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/genericOverrideSuspendFun_Any_NullableInlineClassUpperBound.kt");
}
@TestMetadata("genericOverrideSuspendFun_NullableInt.kt")
public void testGenericOverrideSuspendFun_NullableInt() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/genericOverrideSuspendFun_NullableInt.kt");
}
@TestMetadata("genericOverrideSuspendFun_Int.kt")
public void testGenericOverrideSuspendFun_Int() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/genericOverrideSuspendFun_Int.kt");
}
@TestMetadata("genericOverrideSuspendFun_NullableInt_null.kt")
public void testGenericOverrideSuspendFun_NullableInt_null() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/genericOverrideSuspendFun_NullableInt_null.kt");
}
@TestMetadata("genericOverrideSuspendFun_NullableAny.kt")
public void testGenericOverrideSuspendFun_NullableAny() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/genericOverrideSuspendFun_NullableAny.kt");
}
@TestMetadata("interfaceDelegateWithInlineClass.kt")
public void testInterfaceDelegateWithInlineClass_1_3() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/interfaceDelegateWithInlineClass.kt", "kotlin.coroutines");
}
@TestMetadata("genericOverrideSuspendFun_NullableInt.kt")
public void testGenericOverrideSuspendFun_NullableInt() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/genericOverrideSuspendFun_NullableInt.kt");
}
@TestMetadata("overrideSuspendFun.kt")
public void testOverrideSuspendFun_1_3() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/overrideSuspendFun.kt", "kotlin.coroutines");
}
@TestMetadata("interfaceDelegateWithInlineClass.kt")
public void testInterfaceDelegateWithInlineClass_1_3() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/interfaceDelegateWithInlineClass.kt", "kotlin.coroutines");
}
@TestMetadata("overrideSuspendFun_Any.kt")
public void testOverrideSuspendFun_Any_1_3() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/overrideSuspendFun_Any.kt", "kotlin.coroutines");
}
@TestMetadata("overrideSuspendFun.kt")
public void testOverrideSuspendFun_1_3() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun.kt", "kotlin.coroutines");
}
@TestMetadata("overrideSuspendFun_Any_itf.kt")
public void testOverrideSuspendFun_Any_itf_1_3() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/overrideSuspendFun_Any_itf.kt", "kotlin.coroutines");
}
@TestMetadata("overrideSuspendFun_Any.kt")
public void testOverrideSuspendFun_Any_1_3() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun_Any.kt", "kotlin.coroutines");
}
@TestMetadata("overrideSuspendFun_Any_this.kt")
public void testOverrideSuspendFun_Any_this_1_3() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/overrideSuspendFun_Any_this.kt", "kotlin.coroutines");
}
@TestMetadata("overrideSuspendFun_Any_itf.kt")
public void testOverrideSuspendFun_Any_itf_1_3() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun_Any_itf.kt", "kotlin.coroutines");
}
@TestMetadata("overrideSuspendFun_Int.kt")
public void testOverrideSuspendFun_Int_1_3() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/overrideSuspendFun_Int.kt", "kotlin.coroutines");
}
@TestMetadata("overrideSuspendFun_Any_this.kt")
public void testOverrideSuspendFun_Any_this_1_3() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun_Any_this.kt", "kotlin.coroutines");
}
@TestMetadata("returnResult.kt")
public void testReturnResult() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/returnResult.kt");
@TestMetadata("overrideSuspendFun_Int.kt")
public void testOverrideSuspendFun_Int_1_3() throws Exception {
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/overrideSuspendFun_Int.kt", "kotlin.coroutines");
}
@TestMetadata("returnResult.kt")
public void testReturnResult() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/resumeWithException/returnResult.kt");
}
}
}
@@ -15,12 +15,7 @@ inline class IC(val s: String)
class Test1() {
suspend fun <T> foo(value: T): T {
return suspendCoroutineUninterceptedOrReturn {
it.resume(value)
COROUTINE_SUSPENDED
}
}
suspend fun <T> foo(value: T): T = value
suspend fun qux(ss: IC): IC = IC(ss.s)
@@ -36,12 +31,7 @@ class Test1() {
class Test2 {
suspend fun foo(value: IC): IC {
return suspendCoroutineUninterceptedOrReturn {
it.resume(value)
COROUTINE_SUSPENDED
}
}
suspend fun foo(value: IC): IC = value
suspend fun qux(s: String): IC = IC(s)
@@ -55,12 +45,7 @@ class Test2 {
}
class Test3 {
suspend fun <T> foo(value: T): T {
return suspendCoroutineUninterceptedOrReturn {
it.resume(value)
COROUTINE_SUSPENDED
}
}
suspend fun <T> foo(value: T): T = value
suspend fun bar(): IC {
return foo(IC("OK"))
@@ -15,12 +15,7 @@ inline class IC(val s: Any)
class Test1() {
suspend fun <T> foo(value: T): T {
return suspendCoroutineUninterceptedOrReturn {
it.resume(value)
COROUTINE_SUSPENDED
}
}
suspend fun <T> foo(value: T): T = value
suspend fun qux(ss: IC): IC = IC(ss.s)
@@ -36,12 +31,7 @@ class Test1() {
class Test2 {
suspend fun foo(value: IC): IC {
return suspendCoroutineUninterceptedOrReturn {
it.resume(value)
COROUTINE_SUSPENDED
}
}
suspend fun foo(value: IC): IC = value
suspend fun qux(s: String): IC = IC(s)
@@ -55,12 +45,7 @@ class Test2 {
}
class Test3 {
suspend fun <T> foo(value: T): T {
return suspendCoroutineUninterceptedOrReturn {
it.resume(value)
COROUTINE_SUSPENDED
}
}
suspend fun <T> foo(value: T): T = value
suspend fun bar(): IC {
return foo(IC("OK"))
@@ -18,12 +18,7 @@ inline class IC(val s: I0)
class Test1() {
suspend fun <T> foo(value: T): T {
return suspendCoroutineUninterceptedOrReturn {
it.resume(value)
COROUTINE_SUSPENDED
}
}
suspend fun <T> foo(value: T): T = value
suspend fun qux(ss: IC): IC = IC(ss.s)
@@ -39,12 +34,7 @@ class Test1() {
class Test2 {
suspend fun foo(value: IC): IC {
return suspendCoroutineUninterceptedOrReturn {
it.resume(value)
COROUTINE_SUSPENDED
}
}
suspend fun foo(value: IC): IC = value
suspend fun qux(s: String): IC = IC(I0(s))
@@ -58,12 +48,7 @@ class Test2 {
}
class Test3 {
suspend fun <T> foo(value: T): T {
return suspendCoroutineUninterceptedOrReturn {
it.resume(value)
COROUTINE_SUSPENDED
}
}
suspend fun <T> foo(value: T): T = value
suspend fun bar(): IC {
return foo(IC(I0("OK")))
@@ -18,12 +18,7 @@ inline class IC(val s: I0)
class Test1() {
suspend fun <T> foo(value: T): T {
return suspendCoroutineUninterceptedOrReturn {
it.resume(value)
COROUTINE_SUSPENDED
}
}
suspend fun <T> foo(value: T): T = value
suspend fun qux(ss: IC): IC = IC(ss.s)
@@ -39,12 +34,7 @@ class Test1() {
class Test2 {
suspend fun foo(value: IC): IC {
return suspendCoroutineUninterceptedOrReturn {
it.resume(value)
COROUTINE_SUSPENDED
}
}
suspend fun foo(value: IC): IC = value
suspend fun qux(s: Int): IC = IC(I0(s))
@@ -58,12 +48,7 @@ class Test2 {
}
class Test3 {
suspend fun <T> foo(value: T): T {
return suspendCoroutineUninterceptedOrReturn {
it.resume(value)
COROUTINE_SUSPENDED
}
}
suspend fun <T> foo(value: T): T = value
suspend fun bar(): IC {
return foo(IC(I0(42)))
@@ -15,12 +15,7 @@ inline class IC(val s: Int)
class Test1() {
suspend fun <T> foo(value: T): T {
return suspendCoroutineUninterceptedOrReturn {
it.resume(value)
COROUTINE_SUSPENDED
}
}
suspend fun <T> foo(value: T): T = value
suspend fun qux(ss: IC): IC = IC(ss.s)
@@ -36,12 +31,7 @@ class Test1() {
class Test2 {
suspend fun foo(value: IC): IC {
return suspendCoroutineUninterceptedOrReturn {
it.resume(value)
COROUTINE_SUSPENDED
}
}
suspend fun foo(value: IC): IC = value
suspend fun qux(s: Int): IC = IC(s)
@@ -55,12 +45,7 @@ class Test2 {
}
class Test3 {
suspend fun <T> foo(value: T): T {
return suspendCoroutineUninterceptedOrReturn {
it.resume(value)
COROUTINE_SUSPENDED
}
}
suspend fun <T> foo(value: T): T = value
suspend fun bar(): IC {
return foo(IC(42))
@@ -15,12 +15,7 @@ inline class IC(val s: Long)
class Test1() {
suspend fun <T> foo(value: T): T {
return suspendCoroutineUninterceptedOrReturn {
it.resume(value)
COROUTINE_SUSPENDED
}
}
suspend fun <T> foo(value: T): T = value
suspend fun qux(ss: IC): IC = IC(ss.s)
@@ -36,12 +31,7 @@ class Test1() {
class Test2 {
suspend fun foo(value: IC): IC {
return suspendCoroutineUninterceptedOrReturn {
it.resume(value)
COROUTINE_SUSPENDED
}
}
suspend fun foo(value: IC): IC = value
suspend fun qux(s: Long): IC = IC(s)
@@ -55,12 +45,7 @@ class Test2 {
}
class Test3 {
suspend fun <T> foo(value: T): T {
return suspendCoroutineUninterceptedOrReturn {
it.resume(value)
COROUTINE_SUSPENDED
}
}
suspend fun <T> foo(value: T): T = value
suspend fun bar(): IC {
return foo(IC(42L))
@@ -15,12 +15,7 @@ inline class IC(val s: Any?)
class Test1() {
suspend fun <T> foo(value: T): T {
return suspendCoroutineUninterceptedOrReturn {
it.resume(value)
COROUTINE_SUSPENDED
}
}
suspend fun <T> foo(value: T): T = value
suspend fun qux(ss: IC): IC = IC(ss.s)
@@ -36,12 +31,7 @@ class Test1() {
class Test2 {
suspend fun foo(value: IC): IC {
return suspendCoroutineUninterceptedOrReturn {
it.resume(value)
COROUTINE_SUSPENDED
}
}
suspend fun foo(value: IC): IC = value
suspend fun qux(s: String): IC = IC(s)
@@ -55,12 +45,7 @@ class Test2 {
}
class Test3 {
suspend fun <T> foo(value: T): T {
return suspendCoroutineUninterceptedOrReturn {
it.resume(value)
COROUTINE_SUSPENDED
}
}
suspend fun <T> foo(value: T): T = value
suspend fun bar(): IC {
return foo(IC("OK"))
@@ -15,12 +15,7 @@ inline class IC(val s: String)
class Test1() {
suspend fun <T> foo(value: T): T {
return suspendCoroutineUninterceptedOrReturn {
it.resume(value)
COROUTINE_SUSPENDED
}
}
suspend fun <T> foo(value: T): T = value
suspend fun qux(ss: IC): IC = IC(ss.s)
@@ -38,12 +33,7 @@ class Test1() {
class Test2 {
suspend fun foo(value: IC): IC {
return suspendCoroutineUninterceptedOrReturn {
it.resume(value)
COROUTINE_SUSPENDED
}
}
suspend fun foo(value: IC): IC = value
suspend fun qux(s: String): IC = IC(s)
@@ -59,12 +49,7 @@ class Test2 {
}
class Test3 {
suspend fun <T> foo(value: T): T {
return suspendCoroutineUninterceptedOrReturn {
it.resume(value)
COROUTINE_SUSPENDED
}
}
suspend fun <T> foo(value: T): T = value
suspend fun bar(): IC {
run {
@@ -1,6 +1,7 @@
// WITH_RUNTIME
// WITH_COROUTINES
// COMMON_COROUTINES_TEST
// IGNORE_BACKEND: JS_IR
import helpers.*
import COROUTINES_PACKAGE.*
@@ -17,12 +18,7 @@ fun suspendFunId(block: suspend () -> IC) = block
class Test1() {
suspend fun <T> foo(value: T): T {
return suspendCoroutineUninterceptedOrReturn {
it.resume(value)
COROUTINE_SUSPENDED
}
}
suspend fun <T> foo(value: T): T = value
suspend fun qux(ss: IC): IC = IC(ss.s)
@@ -19,12 +19,7 @@ interface IBar {
class Test1() : IBar {
suspend fun <T> foo(value: T): T {
return suspendCoroutineUninterceptedOrReturn {
it.resume(value)
COROUTINE_SUSPENDED
}
}
suspend fun <T> foo(value: T): T = value
suspend fun qux(ss: IC): IC = IC(ss.s)
@@ -43,12 +38,7 @@ class Test1() : IBar {
class Test2 : IBar {
suspend fun foo(value: IC): IC {
return suspendCoroutineUninterceptedOrReturn {
it.resume(value)
COROUTINE_SUSPENDED
}
}
suspend fun foo(value: IC): IC = value
suspend fun qux(s: String): IC = IC(s)
@@ -65,12 +55,7 @@ class Test2 : IBar {
}
class Test3 : IBar {
suspend fun <T> foo(value: T): T {
return suspendCoroutineUninterceptedOrReturn {
it.resume(value)
COROUTINE_SUSPENDED
}
}
suspend fun <T> foo(value: T): T = value
override suspend fun bar(): IC {
return foo(IC("OK"))
@@ -19,12 +19,7 @@ interface IBar {
class Test1() : IBar {
suspend fun <T> foo(value: T): T {
return suspendCoroutineUninterceptedOrReturn {
it.resume(value)
COROUTINE_SUSPENDED
}
}
suspend fun <T> foo(value: T): T = value
suspend fun qux(ss: IC): IC = IC(ss.s)
@@ -43,12 +38,7 @@ class Test1() : IBar {
class Test2 : IBar {
suspend fun foo(value: IC): IC {
return suspendCoroutineUninterceptedOrReturn {
it.resume(value)
COROUTINE_SUSPENDED
}
}
suspend fun foo(value: IC): IC = value
suspend fun qux(s: String): IC = IC(s)
@@ -65,12 +55,7 @@ class Test2 : IBar {
}
class Test3 : IBar {
suspend fun <T> foo(value: T): T {
return suspendCoroutineUninterceptedOrReturn {
it.resume(value)
COROUTINE_SUSPENDED
}
}
suspend fun <T> foo(value: T): T = value
override suspend fun bar(): IC {
return foo(IC("OK"))
@@ -19,12 +19,7 @@ interface IBar {
class Test1() : IBar {
suspend fun <T> foo(value: T): T {
return suspendCoroutineUninterceptedOrReturn {
it.resume(value)
COROUTINE_SUSPENDED
}
}
suspend fun <T> foo(value: T): T = value
suspend fun qux(ss: IC): IC = IC(ss.s)
@@ -43,12 +38,7 @@ class Test1() : IBar {
class Test2 : IBar {
suspend fun foo(value: IC): IC {
return suspendCoroutineUninterceptedOrReturn {
it.resume(value)
COROUTINE_SUSPENDED
}
}
suspend fun foo(value: IC): IC = value
suspend fun qux(s: Int): IC = IC(s)
@@ -65,12 +55,7 @@ class Test2 : IBar {
}
class Test3 : IBar {
suspend fun <T> foo(value: T): T {
return suspendCoroutineUninterceptedOrReturn {
it.resume(value)
COROUTINE_SUSPENDED
}
}
suspend fun <T> foo(value: T): T = value
override suspend fun bar(): IC {
return foo(IC(42))
@@ -0,0 +1,26 @@
// WITH_RUNTIME
// WITH_COROUTINES
// IGNORE_BACKEND: JVM_IR
// IGNORE_BACKEND_FIR: JVM_IR
import helpers.*
import kotlin.coroutines.*
fun builder(c: suspend () -> Unit) {
c.startCoroutine(EmptyContinuation)
}
@Suppress("RESULT_CLASS_IN_RETURN_TYPE")
suspend fun signInFlowStepFirst(): Result<String> = try {
Result.success("OK")
} catch (e: Exception) {
Result.failure(e)
}
fun box(): String {
builder {
val res: Result<String> = signInFlowStepFirst()
if (res.getOrThrow() != "OK") error("FAIL")
}
return "OK"
}
@@ -0,0 +1,26 @@
// IGNORE_BACKEND: JS_IR_ES6
// WITH_RUNTIME
// WITH_COROUTINES
import helpers.*
import kotlin.coroutines.*
inline class R(val x: Any)
fun builder(c: suspend () -> Unit) {
c.startCoroutine(EmptyContinuation)
}
suspend fun <T> call(fn: suspend () -> T) = fn()
fun useR(r: R) = if (r.x == "OK") "OK" else "fail: $r"
fun box(): String {
var res: String = "fail"
var c: Continuation<R>? = null
builder {
res = useR(call { suspendCoroutine { c = it } })
}
c?.resume(R("OK"))
return res
}
@@ -0,0 +1,91 @@
// WITH_RUNTIME
// WITH_COROUTINES
// COMMON_COROUTINES_TEST
import helpers.*
import COROUTINES_PACKAGE.*
import COROUTINES_PACKAGE.intrinsics.*
fun builder(c: suspend () -> Unit) {
c.startCoroutine(EmptyContinuation)
}
@Suppress("UNSUPPORTED_FEATURE")
inline class IC(val s: String)
var c: Continuation<Any>? = null
suspend fun <T> suspendMe(): T = suspendCoroutine {
@Suppress("UNCHECKED_CAST")
c = it as Continuation<Any>
}
class Test1() {
suspend fun <T> foo(value: T): T = value
suspend fun qux(ss: IC): IC = IC(ss.s)
suspend fun <T> quz(t: T): T = t
suspend fun bar(): IC {
return foo(qux(quz(suspendMe<IC>())))
}
suspend fun test() = bar().s
}
class Test2 {
suspend fun foo(value: IC): IC = value
suspend fun qux(s: String): IC = IC(s)
suspend fun quz(): String = suspendMe<String>()
suspend fun bar(): IC {
return foo(qux(quz()))
}
suspend fun test() = bar().s
}
class Test3 {
suspend fun <T> foo(value: T): T = value
suspend fun bar(): IC {
return foo(suspendMe<IC>())
}
suspend fun test() = bar().s
}
fun box(): String {
var result = "FAIL"
builder {
result = Test1().test()
}
c?.resume(IC("OK"))
if (result != "OK") return "FAIL 1 $result"
result = "FAIL2"
builder {
result = Test2().test()
}
c?.resume("OK")
if (result != "OK") return "FAIL 2 $result"
result = "FAIL 3"
builder {
result = Test3().test()
}
c?.resume(IC("OK"))
return result
}
@@ -0,0 +1,91 @@
// WITH_RUNTIME
// WITH_COROUTINES
// COMMON_COROUTINES_TEST
import helpers.*
import COROUTINES_PACKAGE.*
import COROUTINES_PACKAGE.intrinsics.*
fun builder(c: suspend () -> Unit) {
c.startCoroutine(EmptyContinuation)
}
@Suppress("UNSUPPORTED_FEATURE")
inline class IC(val s: Any)
var c: Continuation<Any>? = null
suspend fun <T> suspendMe(): T = suspendCoroutine {
@Suppress("UNCHECKED_CAST")
c = it as Continuation<Any>
}
class Test1() {
suspend fun <T> foo(value: T): T = value
suspend fun qux(ss: IC): IC = IC(ss.s)
suspend fun <T> quz(t: T): T = t
suspend fun bar(): IC {
return foo(qux(quz(suspendMe())))
}
suspend fun test(): Any = bar().s
}
class Test2 {
suspend fun foo(value: IC): IC = value
suspend fun qux(s: String): IC = IC(s)
suspend fun quz(): String = suspendMe()
suspend fun bar(): IC {
return foo(qux(quz()))
}
suspend fun test() = bar().s
}
class Test3 {
suspend fun <T> foo(value: T) = value
suspend fun bar(): IC {
return foo(suspendMe())
}
suspend fun test() = bar().s
}
fun box(): String {
var result: Any = "FAIL"
builder {
result = Test1().test()
}
c?.resume(IC("OK"))
if (result != "OK") return "FAIL 1 $result"
result = "FAIL2"
builder {
result = Test2().test()
}
c?.resume("OK")
if (result != "OK") return "FAIL 2 $result"
result = "FAIL 3"
builder {
result = Test3().test()
}
c?.resume(IC("OK"))
return result as String
}
@@ -0,0 +1,94 @@
// WITH_RUNTIME
// WITH_COROUTINES
// COMMON_COROUTINES_TEST
import helpers.*
import COROUTINES_PACKAGE.*
import COROUTINES_PACKAGE.intrinsics.*
fun builder(c: suspend () -> Unit) {
c.startCoroutine(EmptyContinuation)
}
@Suppress("UNSUPPORTED_FEATURE")
inline class I0(val x: Any)
@Suppress("UNSUPPORTED_FEATURE")
inline class IC(val s: I0)
var c: Continuation<Any>? = null
suspend fun <T> suspendMe(): T = suspendCoroutine {
@Suppress("UNCHECKED_CAST")
c = it as Continuation<Any>
}
class Test1() {
suspend fun <T> foo(value: T): T = value
suspend fun qux(ss: IC): IC = IC(ss.s)
suspend fun <T> quz(t: T): T = t
suspend fun bar(): IC {
return foo(qux(quz(IC(suspendMe()))))
}
suspend fun test() = bar().s.x
}
class Test2 {
suspend fun foo(value: IC): IC = value
suspend fun qux(s: String): IC = IC(I0(s))
suspend fun quz(): String = suspendMe()
suspend fun bar(): IC {
return foo(qux(quz()))
}
suspend fun test() = bar().s.x
}
class Test3 {
suspend fun <T> foo(value: T): T = value
suspend fun bar(): IC {
return foo(IC(suspendMe()))
}
suspend fun test() = bar().s.x
}
fun box(): String {
var result: Any = "FAIL"
builder {
result = Test1().test()
}
c?.resume(I0("OK"))
if (result != "OK") return "FAIL 1 $result"
result = "FAIL2"
builder {
result = Test2().test()
}
c?.resume("OK")
if (result != "OK") return "FAIL 2 $result"
result = "FAIL 3"
builder {
result = Test3().test()
}
c?.resume(I0("OK"))
return result as String
}
@@ -0,0 +1,97 @@
// WITH_RUNTIME
// WITH_COROUTINES
// COMMON_COROUTINES_TEST
import helpers.*
import COROUTINES_PACKAGE.*
import COROUTINES_PACKAGE.intrinsics.*
fun builder(c: suspend () -> Unit) {
c.startCoroutine(EmptyContinuation)
}
@Suppress("UNSUPPORTED_FEATURE")
inline class I0(val x: Int)
@Suppress("UNSUPPORTED_FEATURE")
inline class IC(val s: I0)
var c: Continuation<Any>? = null
suspend fun <T> suspendMe(): T = suspendCoroutine {
@Suppress("UNCHECKED_CAST")
c = it as Continuation<Any>
}
class Test1() {
suspend fun <T> foo(value: T): T = value
suspend fun qux(ss: IC): IC = IC(ss.s)
suspend fun <T> quz(t: T): T = t
suspend fun bar(): IC {
return foo(qux(quz(IC(suspendMe()))))
}
suspend fun test() = bar().s.x
}
class Test2 {
suspend fun foo(value: IC): IC = value
suspend fun qux(s: Int): IC = IC(I0(s))
suspend fun quz() = suspendMe<Int>()
suspend fun bar(): IC {
return foo(qux(quz()))
}
suspend fun test() = bar().s.x
}
class Test3 {
suspend fun <T> foo(value: T): T = value
suspend fun bar(): IC {
return foo(IC(suspendMe()))
}
suspend fun test() = bar().s.x
}
fun Int.toBoxResult() =
if (this == 42) "OK" else toString()
fun box(): String {
var result: Any = "FAIL"
builder {
result = Test1().test().toBoxResult()
}
c?.resume(I0(42))
if (result != "OK") return "FAIL 1 $result"
result = "FAIL2"
builder {
result = Test2().test().toBoxResult()
}
c?.resume(42)
if (result != "OK") return "FAIL 2 $result"
result = "FAIL 3"
builder {
result = Test3().test().toBoxResult()
}
c?.resume(I0(42))
return result as String
}
@@ -0,0 +1,94 @@
// WITH_RUNTIME
// WITH_COROUTINES
// COMMON_COROUTINES_TEST
import helpers.*
import COROUTINES_PACKAGE.*
import COROUTINES_PACKAGE.intrinsics.*
fun builder(c: suspend () -> Unit) {
c.startCoroutine(EmptyContinuation)
}
@Suppress("UNSUPPORTED_FEATURE")
inline class IC(val s: Int)
var c: Continuation<Any>? = null
suspend fun <T> suspendMe(): T = suspendCoroutine {
@Suppress("UNCHECKED_CAST")
c = it as Continuation<Any>
}
class Test1() {
suspend fun <T> foo(value: T): T = value
suspend fun qux(ss: IC): IC = IC(ss.s)
suspend fun <T> quz(t: T): T = t
suspend fun bar(): IC {
return foo(qux(quz(suspendMe())))
}
suspend fun test() = bar().s
}
class Test2 {
suspend fun foo(value: IC): IC = value
suspend fun qux(s: Int): IC = IC(s)
suspend fun quz(): Int = suspendMe()
suspend fun bar(): IC {
return foo(qux(quz()))
}
suspend fun test() = bar().s
}
class Test3 {
suspend fun <T> foo(value: T): T = value
suspend fun bar(): IC {
return foo(suspendMe())
}
suspend fun test() = bar().s
}
fun Int.toBoxResult() =
if (this == 42) "OK" else toString()
fun box(): String {
var result: String = "FAIL"
builder {
result = Test1().test().toBoxResult()
}
c?.resume(IC(42))
if (result != "OK") return "FAIL 1 $result"
result = "FAIL2"
builder {
result = Test2().test().toBoxResult()
}
c?.resume(42)
if (result != "OK") return "FAIL 2 $result"
result = "FAIL 3"
builder {
result = Test3().test().toBoxResult()
}
c?.resume(IC(42))
return result as String
}
@@ -0,0 +1,94 @@
// WITH_RUNTIME
// WITH_COROUTINES
// COMMON_COROUTINES_TEST
import helpers.*
import COROUTINES_PACKAGE.*
import COROUTINES_PACKAGE.intrinsics.*
fun builder(c: suspend () -> Unit) {
c.startCoroutine(EmptyContinuation)
}
@Suppress("UNSUPPORTED_FEATURE")
inline class IC(val s: Long)
var c: Continuation<Any>? = null
suspend fun <T> suspendMe(): T = suspendCoroutine {
@Suppress("UNCHECKED_CAST")
c = it as Continuation<Any>
}
class Test1() {
suspend fun <T> foo(value: T): T = value
suspend fun qux(ss: IC): IC = IC(ss.s)
suspend fun <T> quz(t: T): T = t
suspend fun bar(): IC {
return foo(qux(quz(suspendMe())))
}
suspend fun test() = bar().s
}
class Test2 {
suspend fun foo(value: IC): IC = value
suspend fun qux(s: Long): IC = IC(s)
suspend fun quz() = suspendMe<Long>()
suspend fun bar(): IC {
return foo(qux(quz()))
}
suspend fun test() = bar().s
}
class Test3 {
suspend fun <T> foo(value: T): T = value
suspend fun bar(): IC {
return foo(suspendMe())
}
suspend fun test() = bar().s
}
fun Long.toBoxResult() =
if (this == 42L) "OK" else toString()
fun box(): String {
var result: String = "FAIL"
builder {
result = Test1().test().toBoxResult()
}
c?.resume(IC(42L))
if (result != "OK") return "FAIL 1 $result"
result = "FAIL2"
builder {
result = Test2().test().toBoxResult()
}
c?.resume(42L)
if (result != "OK") return "FAIL 2 $result"
result = "FAIL 3"
builder {
result = Test3().test().toBoxResult()
}
c?.resume(IC(42L))
return result as String
}
@@ -0,0 +1,91 @@
// WITH_RUNTIME
// WITH_COROUTINES
// COMMON_COROUTINES_TEST
import helpers.*
import COROUTINES_PACKAGE.*
import COROUTINES_PACKAGE.intrinsics.*
fun builder(c: suspend () -> Unit) {
c.startCoroutine(EmptyContinuation)
}
@Suppress("UNSUPPORTED_FEATURE")
inline class IC(val s: Any?)
var c: Continuation<Any>? = null
suspend fun <T> suspendMe(): T = suspendCoroutine {
@Suppress("UNCHECKED_CAST")
c = it as Continuation<Any>
}
class Test1() {
suspend fun <T> foo(value: T): T = value
suspend fun qux(ss: IC): IC = IC(ss.s)
suspend fun <T> quz(t: T): T = t
suspend fun bar(): IC {
return foo(qux(quz(suspendMe())))
}
suspend fun test() = bar().s
}
class Test2 {
suspend fun foo(value: IC): IC = value
suspend fun qux(s: String): IC = IC(s)
suspend fun quz(): String = suspendMe()
suspend fun bar(): IC {
return foo(qux(quz()))
}
suspend fun test() = bar().s
}
class Test3 {
suspend fun <T> foo(value: T): T = value
suspend fun bar(): IC {
return foo(suspendMe())
}
suspend fun test() = bar().s
}
fun box(): String {
var result: Any? = "FAIL"
builder {
result = Test1().test()
}
c?.resume(IC("OK"))
if (result != "OK") return "FAIL 1 $result"
result = "FAIL2"
builder {
result = Test2().test()
}
c?.resume("OK")
if (result != "OK") return "FAIL 2 $result"
result = "FAIL 3"
builder {
result = Test3().test()
}
c?.resume(IC("OK"))
return result as String
}
@@ -0,0 +1,97 @@
// WITH_RUNTIME
// WITH_COROUTINES
// COMMON_COROUTINES_TEST
import helpers.*
import COROUTINES_PACKAGE.*
import COROUTINES_PACKAGE.intrinsics.*
fun builder(c: suspend () -> Unit) {
c.startCoroutine(EmptyContinuation)
}
@Suppress("UNSUPPORTED_FEATURE")
inline class IC(val s: String)
var c: Continuation<Any>? = null
suspend fun <T> suspendMe(): T = suspendCoroutine {
@Suppress("UNCHECKED_CAST")
c = it as Continuation<Any>
}
class Test1() {
suspend fun <T> foo(value: T): T = value
suspend fun qux(ss: IC): IC = IC(ss.s)
suspend fun <T> quz(t: T): T = t
suspend fun bar(): IC {
run {
return foo(qux(quz(suspendMe())))
}
}
suspend fun test() = bar().s
}
class Test2 {
suspend fun foo(value: IC): IC = value
suspend fun qux(s: String): IC = IC(s)
suspend fun quz(): String = suspendMe()
suspend fun bar(): IC {
run {
return foo(qux(quz()))
}
}
suspend fun test() = bar().s
}
class Test3 {
suspend fun <T> foo(value: T): T = value
suspend fun bar(): IC {
run {
return foo(suspendMe())
}
}
suspend fun test() = bar().s
}
fun box(): String {
var result = "FAIL"
builder {
result = Test1().test()
}
c?.resume(IC("OK"))
if (result != "OK") return "FAIL 1 $result"
result = "FAIL2"
builder {
result = Test2().test()
}
c?.resume("OK")
if (result != "OK") return "FAIL 2 $result"
result = "FAIL 3"
builder {
result = Test3().test()
}
c?.resume(IC("OK"))
return result
}
@@ -0,0 +1,51 @@
// WITH_RUNTIME
// WITH_COROUTINES
// COMMON_COROUTINES_TEST
import helpers.*
import COROUTINES_PACKAGE.*
import COROUTINES_PACKAGE.intrinsics.*
fun builder(c: suspend () -> Unit) {
c.startCoroutine(EmptyContinuation)
}
@Suppress("UNSUPPORTED_FEATURE")
inline class IC(val s: String)
var c: Continuation<Any>? = null
suspend fun <T> suspendMe(): T = suspendCoroutine {
@Suppress("UNCHECKED_CAST")
c = it as Continuation<Any>
}
fun suspendFunId(block: suspend () -> IC) = block
class Test1() {
suspend fun <T> foo(value: T): T = value
suspend fun qux(ss: IC): IC = IC(ss.s)
suspend fun <T> quz(t: T): T = t
suspend fun bar(): IC {
return suspendFunId { foo(qux(quz(suspendMe()))) }()
}
suspend fun test() = bar().s
}
fun box(): String {
var result = "FAIL"
builder {
result = Test1().test()
}
c?.resume(IC("OK"))
if (result != "OK") return "FAIL 1 $result"
return result
}
@@ -0,0 +1,54 @@
// WITH_RUNTIME
// WITH_COROUTINES
// COMMON_COROUTINES_TEST
import helpers.*
import COROUTINES_PACKAGE.*
fun builder(c: suspend () -> Unit) {
c.startCoroutine(EmptyContinuation)
}
@Suppress("UNSUPPORTED_FEATURE")
inline class Result<T>(val a: Any?) {
fun getOrThrow(): T = a as T
}
var c: Continuation<Any>? = null
suspend fun <T> suspendMe(): T = suspendCoroutine {
@Suppress("UNCHECKED_CAST")
c = it as Continuation<Any>
}
abstract class ResultReceiver<T> {
abstract suspend fun receive(result: Result<T>)
}
inline fun <T> ResultReceiver(crossinline f: (Result<T>) -> Unit): ResultReceiver<T> =
object : ResultReceiver<T>() {
override suspend fun receive(result: Result<T>) {
f(result)
}
}
fun test() {
var invoked = false
val receiver = ResultReceiver<String> { result ->
val intResult = result.getOrThrow()
invoked = true
}
builder {
receiver.receive(Result(suspendMe()))
}
c?.resume("42")
if (!invoked) {
throw RuntimeException("Fail")
}
}
fun box(): String {
test()
return "OK"
}
@@ -0,0 +1,54 @@
// WITH_RUNTIME
// WITH_COROUTINES
// COMMON_COROUTINES_TEST
import helpers.*
import COROUTINES_PACKAGE.*
fun builder(c: suspend () -> Unit) {
c.startCoroutine(EmptyContinuation)
}
@Suppress("UNSUPPORTED_FEATURE")
inline class Result<T>(val a: Any?) {
fun getOrThrow(): T = a as T
}
var c: Continuation<Any>? = null
suspend fun <T> suspendMe(): T = suspendCoroutine {
@Suppress("UNCHECKED_CAST")
c = it as Continuation<Any>
}
abstract class ResultReceiver<T> {
abstract suspend fun receive(result: Result<T>)
}
fun <T> ResultReceiver(f: (Result<T>) -> Unit): ResultReceiver<T> =
object : ResultReceiver<T>() {
override suspend fun receive(result: Result<T>) {
f(result)
}
}
fun test() {
var invoked = false
val receiver = ResultReceiver<Int> { result ->
val intResult = result.getOrThrow()
invoked = true
}
builder {
receiver.receive(Result(suspendMe()))
}
c?.resume(42)
if (!invoked) {
throw RuntimeException("Fail")
}
}
fun box(): String {
test()
return "OK"
}
@@ -0,0 +1,53 @@
// WITH_RUNTIME
// WITH_COROUTINES
import helpers.*
import kotlin.coroutines.*
fun builder(c: suspend () -> Unit) {
c.startCoroutine(EmptyContinuation)
}
@Suppress("UNSUPPORTED_FEATURE")
inline class IC(val s: String)
interface IBar {
suspend fun bar(): Any
}
var c: Continuation<Any>? = null
suspend fun <T> suspendMe(): T = suspendCoroutine {
@Suppress("UNCHECKED_CAST")
c = it as Continuation<Any>
}
class Test() : IBar {
override suspend fun bar(): IC = suspendMe()
suspend fun test1(): String {
val b: IBar = this
return (b.bar() as IC).s
}
suspend fun test2(): String = bar().s
}
fun box(): String {
var result = "FAIL 1"
builder {
result = Test().test1()
}
c?.resume(IC("OK"))
if (result != "OK") return "FAIL 1 $result"
result = "FAIL2 "
builder {
result = Test().test2()
}
c?.resume(IC("OK"))
if (result != "OK") return "FAIL 2 $result"
return result
}
@@ -0,0 +1,55 @@
// WITH_RUNTIME
// WITH_COROUTINES
import helpers.*
import kotlin.coroutines.*
fun builder(c: suspend () -> Unit) {
c.startCoroutine(EmptyContinuation)
}
@Suppress("UNSUPPORTED_FEATURE")
inline class IC(val s: String)
var c: Continuation<Any>? = null
suspend fun <T> suspendMe(): T = suspendCoroutine {
@Suppress("UNCHECKED_CAST")
c = it as Continuation<Any>
}
interface IBar {
suspend fun bar(): IC?
}
class Test() : IBar {
override suspend fun bar(): IC = suspendMe()
suspend fun test1(): String {
val b: IBar = this
return b.bar()!!.s
}
suspend fun test2(): String {
return bar().s
}
}
fun box(): String {
var result = "FAIL"
builder {
result = Test().test1()
}
c?.resume(IC("OK"))
if (result != "OK") return "FAIL 1 $result"
result = "FAIL2"
builder {
result = Test().test2()
}
c?.resume(IC("OK"))
if (result != "OK") return "FAIL 2 $result"
return result
}
@@ -0,0 +1,54 @@
// WITH_RUNTIME
// WITH_COROUTINES
import helpers.*
import kotlin.coroutines.*
fun builder(c: suspend () -> Unit) {
c.startCoroutine(EmptyContinuation)
}
@Suppress("UNSUPPORTED_FEATURE")
inline class IC(val s: Any)
var c: Continuation<Any>? = null
suspend fun <T> suspendMe(): T = suspendCoroutine {
@Suppress("UNCHECKED_CAST")
c = it as Continuation<Any>
}
interface IBar {
suspend fun bar(): IC?
}
class Test() : IBar {
override suspend fun bar(): IC = suspendMe()
suspend fun test1(): String {
val b: IBar = this
return b.bar()!!.s as String
}
suspend fun test2(): String {
return bar()!!.s as String
}
}
fun box(): String {
var result = "FAIL"
builder {
result = Test().test1()
}
c?.resume(IC("OK"))
if (result != "OK") return "FAIL 1 $result"
result = "FAIL2"
builder {
result = Test().test2()
}
c?.resume(IC("OK"))
if (result != "OK") return "FAIL 2 $result"
return result
}
@@ -0,0 +1,57 @@
// WITH_RUNTIME
// WITH_COROUTINES
import helpers.*
import kotlin.coroutines.*
fun builder(c: suspend () -> Unit) {
c.startCoroutine(EmptyContinuation)
}
@Suppress("UNSUPPORTED_FEATURE")
inline class IC(val s: Int)
var c: Continuation<Any>? = null
suspend fun <T> suspendMe(): T = suspendCoroutine {
@Suppress("UNCHECKED_CAST")
c = it as Continuation<Any>
}
interface IBar {
suspend fun bar(): IC?
}
fun Int.toResultString() =
if (this == 42) "OK" else "!!! $this"
class Test() : IBar {
override suspend fun bar(): IC = suspendMe()
suspend fun test1(): String {
val b: IBar = this
return b.bar()!!.s.toResultString()
}
suspend fun test2(): String {
return bar()!!.s.toResultString()
}
}
fun box(): String {
var result = "FAIL"
builder {
result = Test().test1()
}
c?.resume(IC(42))
if (result != "OK") return "FAIL 1 $result"
result = "FAIL2"
builder {
result = Test().test2()
}
c?.resume(IC(42))
if (result != "OK") return "FAIL 2 $result"
return result
}
@@ -0,0 +1,54 @@
// WITH_RUNTIME
// WITH_COROUTINES
// IGNORE_BACKEND: JS_IR
import helpers.*
import kotlin.coroutines.*
fun builder(c: suspend () -> Unit) {
c.startCoroutine(EmptyContinuation)
}
@Suppress("UNSUPPORTED_FEATURE")
inline class IC(val s: Any?)
var c: Continuation<Any>? = null
suspend fun <T> suspendMe(): T = suspendCoroutine {
@Suppress("UNCHECKED_CAST")
c = it as Continuation<Any>
}
interface IBar {
suspend fun bar(): IC?
}
class Test() : IBar {
override suspend fun bar(): IC = suspendMe()
suspend fun test1(): String {
val b: IBar = this
return b.bar()!!.s as String
}
suspend fun test2(): String = bar().s as String
}
fun box(): String {
var result = "FAIL"
builder {
result = Test().test1()
}
c?.resume(IC("OK"))
if (result != "OK") return "FAIL 1 $result"
result = "FAIL2"
builder {
result = Test().test2()
}
c?.resume(IC("OK"))
if (result != "OK") return "FAIL 2 $result"
return result
}
@@ -0,0 +1,60 @@
// WITH_RUNTIME
// WITH_COROUTINES
import helpers.*
import kotlin.coroutines.*
fun builder(c: suspend () -> Unit) {
c.startCoroutine(EmptyContinuation)
}
@Suppress("UNSUPPORTED_FEATURE")
inline class IC(val s: Any?)
var c: Continuation<Any>? = null
suspend fun <T> suspendMe(): T = suspendCoroutine {
@Suppress("UNCHECKED_CAST")
c = it as Continuation<Any>
}
interface IBar {
suspend fun bar(): IC?
}
class Test1() : IBar {
override suspend fun bar(): IC = suspendMe()
suspend fun test(): Any? {
val b: IBar = this
return b.bar()!!.s
}
}
class Test2() : IBar {
override suspend fun bar(): IC = suspendMe()
suspend fun test(): IC {
val b: IBar = this
return b.bar()!!
}
}
fun box(): String {
var result: Any? = "FAIL 1"
builder {
result = Test1().test()
}
c?.resume(IC(null))
if (result != null) return "FAIL 1 $result"
result = "FAIL 2"
builder {
result = Test2().test()
}
c?.resume(IC(null))
if (result != IC(null)) return "FAIL 2 $result"
return "OK"
}
@@ -0,0 +1,57 @@
// WITH_RUNTIME
// WITH_COROUTINES
import helpers.*
import kotlin.coroutines.*
fun builder(c: suspend () -> Unit) {
c.startCoroutine(EmptyContinuation)
}
@Suppress("UNSUPPORTED_FEATURE")
inline class IC(val s: Int?)
var c: Continuation<Any>? = null
suspend fun <T> suspendMe(): T = suspendCoroutine {
@Suppress("UNCHECKED_CAST")
c = it as Continuation<Any>
}
interface IBar {
suspend fun bar(): IC?
}
fun Int?.toResultString() =
if (this == 42) "OK" else "!!! $this"
class Test() : IBar {
override suspend fun bar(): IC = suspendMe()
suspend fun test1(): String {
val b: IBar = this
return b.bar()!!.s.toResultString()
}
suspend fun test2(): String {
return bar()!!.s.toResultString()
}
}
fun box(): String {
var result = "FAIL"
builder {
result = Test().test1()
}
c?.resume(IC(42))
if (result != "OK") return "FAIL 1 $result"
result = "FAIL2"
builder {
result = Test().test2()
}
c?.resume(IC(42))
if (result != "OK") return "FAIL 2 $result"
return result
}
@@ -0,0 +1,57 @@
// WITH_RUNTIME
// WITH_COROUTINES
import helpers.*
import kotlin.coroutines.*
fun builder(c: suspend () -> Unit) {
c.startCoroutine(EmptyContinuation)
}
@Suppress("UNSUPPORTED_FEATURE")
inline class IC(val s: Int?)
var c: Continuation<Any>? = null
suspend fun <T> suspendMe(): T = suspendCoroutine {
@Suppress("UNCHECKED_CAST")
c = it as Continuation<Any>
}
interface IBar {
suspend fun bar(): IC?
}
fun Int?.toResultString() =
if (this == null) "OK" else "!!! $this"
class Test() : IBar {
override suspend fun bar(): IC = suspendMe()
suspend fun test1(): String {
val b: IBar = this
return b.bar()!!.s.toResultString()
}
suspend fun test2(): String {
return bar()!!.s.toResultString()
}
}
fun box(): String {
var result = "FAIL"
builder {
result = Test().test1()
}
c?.resume(IC(null))
if (result != "OK") return "FAIL 1 $result"
result = "FAIL2"
builder {
result = Test().test2()
}
c?.resume(IC(null))
if (result != "OK") return "FAIL 2 $result"
return result
}
@@ -0,0 +1,55 @@
// WITH_RUNTIME
// WITH_COROUTINES
// IGNORE_BACKEND: JS_IR
import helpers.*
import kotlin.coroutines.*
fun builder(c: suspend () -> Unit) {
c.startCoroutine(EmptyContinuation)
}
@Suppress("UNSUPPORTED_FEATURE")
inline class IC(val s: Any)
var c: Continuation<Any>? = null
suspend fun <T> suspendMe(): T = suspendCoroutine {
@Suppress("UNCHECKED_CAST")
c = it as Continuation<Any>
}
interface IBar {
suspend fun bar(): Any
}
class Test() : IBar {
override suspend fun bar(): IC = suspendMe()
suspend fun test1(): String {
val b: IBar = this
return (b.bar() as IC).s as String
}
suspend fun test2(): String = bar().s as String
}
fun box(): String {
var result = "FAIL 1"
builder {
result = Test().test1()
}
c?.resume(IC("OK"))
if (result != "OK") return "FAIL 1 $result"
result = "FAIL2 "
builder {
result = Test().test2()
}
c?.resume(IC("OK"))
if (result != "OK") return "FAIL 2 $result"
return result
}
@@ -0,0 +1,58 @@
// WITH_RUNTIME
// WITH_COROUTINES
import helpers.*
import kotlin.coroutines.*
fun builder(c: suspend () -> Unit) {
c.startCoroutine(EmptyContinuation)
}
@Suppress("UNSUPPORTED_FEATURE")
inline class IC(val s: Int)
var c: Continuation<Any>? = null
suspend fun <T> suspendMe(): T = suspendCoroutine {
@Suppress("UNCHECKED_CAST")
c = it as Continuation<Any>
}
interface IBar {
suspend fun bar(): Any
}
class Test() : IBar {
override suspend fun bar(): IC = suspendMe()
suspend fun test1(): Int {
val b: IBar = this
return (b.bar() as IC).s
}
suspend fun test2(): Int {
val b: IBar = this
return (b.bar() as IC).s
}
}
fun Int.toBoxResult() =
if (this == 42) "OK" else toString()
fun box(): String {
var result: String = "FAIL"
builder {
result = Test().test1().toBoxResult()
}
c?.resume(IC(42))
if (result != "OK") return "FAIL 1 $result"
result = "FAIL2"
builder {
result = Test().test2().toBoxResult()
}
c?.resume(IC(42))
if (result != "OK") return "FAIL 2 $result"
return result as String
}
@@ -0,0 +1,36 @@
// WITH_RUNTIME
// WITH_COROUTINES
import helpers.*
import kotlin.coroutines.*
inline class IC(val s: String)
var c: Continuation<Any>? = null
suspend fun <T> suspendMe(): T = suspendCoroutine {
@Suppress("UNCHECKED_CAST")
c = it as Continuation<Any>
}
interface Base<T> {
suspend fun generic(): T
}
class Derived : Base<IC> {
override suspend fun generic(): IC = suspendMe()
}
fun builder(c: suspend () -> Unit) {
c.startCoroutine(EmptyContinuation)
}
fun box(): String {
var res: String? = null
builder {
val base: Base<*> = Derived()
res = (base.generic() as IC).s
}
c?.resume(IC("OK"))
return res!!
}
@@ -0,0 +1,37 @@
// WITH_RUNTIME
// WITH_COROUTINES
// IGNORE_BACKEND: JS_IR
import helpers.*
import kotlin.coroutines.*
inline class IC(val s: Any)
var c: Continuation<Any>? = null
suspend fun <T> suspendMe(): T = suspendCoroutine {
@Suppress("UNCHECKED_CAST")
c = it as Continuation<Any>
}
interface Base<T> {
suspend fun generic(): T
}
class Derived : Base<IC> {
override suspend fun generic(): IC = suspendMe()
}
fun builder(c: suspend () -> Unit) {
c.startCoroutine(EmptyContinuation)
}
fun box(): String {
var res: String? = null
builder {
val base: Base<*> = Derived()
res = (base.generic() as IC).s as String
}
c?.resume(IC("OK"))
return res!!
}
@@ -0,0 +1,36 @@
// WITH_RUNTIME
// WITH_COROUTINES
import helpers.*
import kotlin.coroutines.*
inline class IC(val s: Any)
var c: Continuation<Any>? = null
suspend fun <T> suspendMe(): T = suspendCoroutine {
@Suppress("UNCHECKED_CAST")
c = it as Continuation<Any>
}
interface Base<T : IC?> {
suspend fun generic(): T
}
class Derived : Base<IC> {
override suspend fun generic(): IC = suspendMe()
}
fun builder(c: suspend () -> Unit) {
c.startCoroutine(EmptyContinuation)
}
fun box(): String {
var res: String? = null
builder {
val base: Base<*> = Derived()
res = base.generic()!!.s as String
}
c?.resume(IC("OK"))
return res!!
}
@@ -0,0 +1,39 @@
// WITH_RUNTIME
// WITH_COROUTINES
import helpers.*
import kotlin.coroutines.*
inline class IC(val s: Int)
var c: Continuation<Any>? = null
suspend fun <T> suspendMe(): T = suspendCoroutine {
@Suppress("UNCHECKED_CAST")
c = it as Continuation<Any>
}
fun Int.toResultString() =
if (this == 42) "OK" else "!! $this"
interface Base<T> {
suspend fun generic(): T
}
class Derived : Base<IC> {
override suspend fun generic(): IC = suspendMe()
}
fun builder(c: suspend () -> Unit) {
c.startCoroutine(EmptyContinuation)
}
fun box(): String {
var res: String? = null
builder {
val base: Base<*> = Derived()
res = (base.generic() as IC).s.toResultString()
}
c?.resume(IC(42))
return res!!
}
@@ -0,0 +1,37 @@
// WITH_RUNTIME
// WITH_COROUTINES
// IGNORE_BACKEND: JS_IR
import helpers.*
import kotlin.coroutines.*
inline class IC(val s: Any?)
var c: Continuation<Any>? = null
suspend fun <T> suspendMe(): T = suspendCoroutine {
@Suppress("UNCHECKED_CAST")
c = it as Continuation<Any>
}
interface Base<T> {
suspend fun generic(): T
}
class Derived : Base<IC> {
override suspend fun generic(): IC = suspendMe()
}
fun builder(c: suspend () -> Unit) {
c.startCoroutine(EmptyContinuation)
}
fun box(): String {
var res: String? = null
builder {
val base: Base<*> = Derived()
res = (base.generic() as IC).s as String
}
c?.resume(IC("OK"))
return res!!
}
@@ -0,0 +1,39 @@
// WITH_RUNTIME
// WITH_COROUTINES
import helpers.*
import kotlin.coroutines.*
inline class IC(val s: Any?)
var c: Continuation<Any>? = null
suspend fun <T> suspendMe(): T = suspendCoroutine {
@Suppress("UNCHECKED_CAST")
c = it as Continuation<Any>
}
interface Base<T> {
suspend fun generic(): T
}
class Derived : Base<IC> {
override suspend fun generic(): IC = suspendMe()
}
fun Any?.toResultString(): String =
if (this == null) "OK" else "!! $this"
fun builder(c: suspend () -> Unit) {
c.startCoroutine(EmptyContinuation)
}
fun box(): String {
var res: String? = null
builder {
val base: Base<*> = Derived()
res = (base.generic() as IC).s.toResultString()
}
c?.resume(IC(null))
return res!!
}
@@ -0,0 +1,39 @@
// WITH_RUNTIME
// WITH_COROUTINES
import helpers.*
import kotlin.coroutines.*
inline class IC(val s: Int?)
var c: Continuation<Any>? = null
suspend fun <T> suspendMe(): T = suspendCoroutine {
@Suppress("UNCHECKED_CAST")
c = it as Continuation<Any>
}
fun Int?.toResultString() =
if (this == 42) "OK" else "!! $this"
interface Base<T> {
suspend fun generic(): T
}
class Derived : Base<IC> {
override suspend fun generic(): IC = suspendMe()
}
fun builder(c: suspend () -> Unit) {
c.startCoroutine(EmptyContinuation)
}
fun box(): String {
var res: String? = null
builder {
val base: Base<*> = Derived()
res = (base.generic() as IC).s.toResultString()
}
c?.resume(IC(42))
return res!!
}
@@ -0,0 +1,39 @@
// WITH_RUNTIME
// WITH_COROUTINES
import helpers.*
import kotlin.coroutines.*
inline class IC(val s: Int?)
var c: Continuation<Any>? = null
suspend fun <T> suspendMe(): T = suspendCoroutine {
@Suppress("UNCHECKED_CAST")
c = it as Continuation<Any>
}
fun Int?.toResultString() =
if (this == null) "OK" else "!! $this"
interface Base<T> {
suspend fun generic(): T
}
class Derived : Base<IC> {
override suspend fun generic(): IC = suspendMe()
}
fun builder(c: suspend () -> Unit) {
c.startCoroutine(EmptyContinuation)
}
fun box(): String {
var res: String? = null
builder {
val base: Base<*> = Derived()
res = (base.generic() as IC).s.toResultString()
}
c?.resume(IC(null))
return res!!
}
@@ -0,0 +1,47 @@
// WITH_RUNTIME
// WITH_COROUTINES
// COMMON_COROUTINES_TEST
import helpers.*
import COROUTINES_PACKAGE.*
import COROUTINES_PACKAGE.intrinsics.*
fun builder(c: suspend () -> Unit) {
c.startCoroutine(EmptyContinuation)
}
@Suppress("UNSUPPORTED_FEATURE")
inline class IC(val s: String)
var c: Continuation<Any>? = null
suspend fun <T> suspendMe(): T = suspendCoroutine {
@Suppress("UNCHECKED_CAST")
c = it as Continuation<Any>
}
interface I {
suspend fun foo(s: String): IC
}
class D: I {
override suspend fun foo(s: String): IC = suspendMe()
}
class C(val d: I) : I by d
fun box(): String {
var result = "FAIL"
val d = D()
builder {
result = C(d).foo("IGNORE ME").s
}
c?.resume(IC("OK"))
if (result != "OK") return "FAIL: $result"
return result
}
@@ -0,0 +1,104 @@
// WITH_RUNTIME
// WITH_COROUTINES
// COMMON_COROUTINES_TEST
import helpers.*
import COROUTINES_PACKAGE.*
import COROUTINES_PACKAGE.intrinsics.*
fun builder(c: suspend () -> Unit) {
c.startCoroutine(EmptyContinuation)
}
@Suppress("UNSUPPORTED_FEATURE")
inline class IC(val s: String)
var c: Continuation<Any>? = null
suspend fun <T> suspendMe(): T = suspendCoroutine {
@Suppress("UNCHECKED_CAST")
c = it as Continuation<Any>
}
interface IBar {
suspend fun bar(): IC
}
class Test1() : IBar {
suspend fun <T> foo(value: T): T = value
suspend fun qux(ss: IC): IC = IC(ss.s)
suspend fun <T> quz(t: T): T = t
override suspend fun bar(): IC {
return foo(qux(quz(suspendMe())))
}
suspend fun test(): String {
val b: IBar = this
return b.bar().s
}
}
class Test2 : IBar {
suspend fun foo(value: IC): IC = value
suspend fun qux(s: String): IC = IC(s)
suspend fun quz(): String = suspendMe()
override suspend fun bar(): IC {
return foo(qux(quz()))
}
suspend fun test(): String {
val b: IBar = this
return b.bar().s
}
}
class Test3 : IBar {
suspend fun <T> foo(value: T): T = value
override suspend fun bar(): IC {
return foo(suspendMe())
}
suspend fun test(): String {
val b: IBar = this
return b.bar().s
}
}
fun box(): String {
var result = "FAIL"
builder {
result = Test1().test()
}
c?.resume(IC("OK"))
if (result != "OK") return "FAIL 1 $result"
result = "FAIL2"
builder {
result = Test2().test()
}
c?.resume("OK")
if (result != "OK") return "FAIL 2 $result"
result = "FAIL 3"
builder {
result = Test3().test()
}
c?.resume(IC("OK"))
return result
}
@@ -0,0 +1,98 @@
// WITH_RUNTIME
// WITH_COROUTINES
// COMMON_COROUTINES_TEST
import helpers.*
import COROUTINES_PACKAGE.*
import COROUTINES_PACKAGE.intrinsics.*
fun builder(c: suspend () -> Unit) {
c.startCoroutine(EmptyContinuation)
}
@Suppress("UNSUPPORTED_FEATURE")
inline class IC(val s: Any)
var c: Continuation<Any>? = null
suspend fun <T> suspendMe(): T = suspendCoroutine {
@Suppress("UNCHECKED_CAST")
c = it as Continuation<Any>
}
interface IBar {
suspend fun bar(): IC
}
class Test1() : IBar {
suspend fun <T> foo(value: T): T = value
suspend fun qux(ss: IC): IC = IC(ss.s)
suspend fun <T> quz(t: T): T = t
override suspend fun bar(): IC {
return foo(qux(quz(suspendMe())))
}
suspend fun test(): Any {
val b: IBar = this
return b.bar().s
}
}
class Test2 : IBar {
suspend fun foo(value: IC): IC = value
suspend fun qux(s: String): IC = IC(s)
suspend fun quz(): String = suspendMe()
override suspend fun bar(): IC {
return foo(qux(quz()))
}
suspend fun test(): Any {
val b: IBar = this
return b.bar().s
}
}
class Test3 : IBar {
suspend fun <T> foo(value: T): T = value
override suspend fun bar(): IC {
return foo(suspendMe())
}
suspend fun test(): Any {
val b: IBar = this
return b.bar().s
}
}
fun box(): String {
var result: Any = "FAIL1"
builder {
result = Test1().test()
}
c?.resume(IC("OK"))
if (result != "OK") return "FAIL 1 $result"
result = "FAIL2"
builder {
result = Test2().test()
}
c?.resume("OK")
if (result != "OK") return "FAIL 2 $result"
result = "FAIL 3"
builder {
result = Test3().test()
}
c?.resume(IC("OK"))
return result as String
}
@@ -0,0 +1,45 @@
// WITH_RUNTIME
// WITH_COROUTINES
// COMMON_COROUTINES_TEST
import helpers.*
import COROUTINES_PACKAGE.*
import COROUTINES_PACKAGE.intrinsics.*
fun builder(c: suspend () -> Unit) {
c.startCoroutine(EmptyContinuation)
}
@Suppress("UNSUPPORTED_FEATURE")
inline class IC(val s: Any)
var c: Continuation<Any>? = null
suspend fun <T> suspendMe(): T = suspendCoroutine {
@Suppress("UNCHECKED_CAST")
c = it as Continuation<Any>
}
interface IBar {
suspend fun bar(): IC
}
class Test0() : IBar {
override suspend fun bar(): IC = suspendMe()
suspend fun test(): Any {
val b: IBar = this
return b.bar().s
}
}
fun box(): String {
var result: Any = "FAIL"
builder {
result = Test0().test()
}
c?.resume(IC("OK"))
if (result != "OK") return "FAIL 0 $result"
return result as String
}
@@ -0,0 +1,44 @@
// WITH_RUNTIME
// WITH_COROUTINES
// COMMON_COROUTINES_TEST
import helpers.*
import COROUTINES_PACKAGE.*
import COROUTINES_PACKAGE.intrinsics.*
fun builder(c: suspend () -> Unit) {
c.startCoroutine(EmptyContinuation)
}
@Suppress("UNSUPPORTED_FEATURE")
inline class IC(val s: Any)
var c: Continuation<Any>? = null
suspend fun <T> suspendMe(): T = suspendCoroutine {
@Suppress("UNCHECKED_CAST")
c = it as Continuation<Any>
}
interface IBar {
suspend fun bar(): IC
}
class Test0() : IBar {
override suspend fun bar(): IC = suspendMe()
suspend fun test(): Any {
return bar().s
}
}
fun box(): String {
var result: Any = "FAIL"
builder {
result = Test0().test()
}
c?.resume(IC("OK"))
if (result != "OK") return "FAIL 0 $result"
return result as String
}
@@ -0,0 +1,107 @@
// WITH_RUNTIME
// WITH_COROUTINES
// COMMON_COROUTINES_TEST
import helpers.*
import COROUTINES_PACKAGE.*
import COROUTINES_PACKAGE.intrinsics.*
fun builder(c: suspend () -> Unit) {
c.startCoroutine(EmptyContinuation)
}
@Suppress("UNSUPPORTED_FEATURE")
inline class IC(val s: Int)
var c: Continuation<Any>? = null
suspend fun <T> suspendMe(): T = suspendCoroutine {
@Suppress("UNCHECKED_CAST")
c = it as Continuation<Any>
}
interface IBar {
suspend fun bar(): IC
}
class Test1() : IBar {
suspend fun <T> foo(value: T): T = value
suspend fun qux(ss: IC): IC = IC(ss.s)
suspend fun <T> quz(t: T): T = t
override suspend fun bar(): IC {
return foo(qux(quz(suspendMe())))
}
suspend fun test(): Int {
val b: IBar = this
return b.bar().s
}
}
class Test2 : IBar {
suspend fun foo(value: IC): IC = value
suspend fun qux(s: Int): IC = IC(s)
suspend fun quz(): Int = suspendMe()
override suspend fun bar(): IC {
return foo(qux(quz()))
}
suspend fun test(): Int {
val b: IBar = this
return b.bar().s
}
}
class Test3 : IBar {
suspend fun <T> foo(value: T): T = value
override suspend fun bar(): IC {
return foo(suspendMe())
}
suspend fun test(): Int {
val b: IBar = this
return b.bar().s
}
}
fun Int.toBoxResult() =
if (this == 42) "OK" else toString()
fun box(): String {
var result: String = "FAIL"
builder {
result = Test1().test().toBoxResult()
}
c?.resume(IC(42))
if (result != "OK") return "FAIL 1 $result"
result = "FAIL2"
builder {
result = Test2().test().toBoxResult()
}
c?.resume(42)
if (result != "OK") return "FAIL 2 $result"
result = "FAIL 3"
builder {
result = Test3().test().toBoxResult()
}
c?.resume(IC(42))
return result as String
}
@@ -0,0 +1,31 @@
// WITH_RUNTIME
// WITH_COROUTINES
// IGNORE_BACKEND: JVM_IR
// IGNORE_BACKEND_FIR: JVM_IR
import helpers.*
import kotlin.coroutines.*
fun builder(c: suspend () -> Unit) {
c.startCoroutine(EmptyContinuation)
}
var continuation: Continuation<String>? = null
suspend fun suspendMe() = suspendCoroutine<String> { continuation = it }
@Suppress("RESULT_CLASS_IN_RETURN_TYPE")
suspend fun signInFlowStepFirst(): Result<String> = try {
Result.success(suspendMe())
} catch (e: Exception) {
Result.failure(e)
}
fun box(): String {
builder {
val res: Result<String> = signInFlowStepFirst()
if (res.getOrNull() != "OK") error("FAIL")
}
continuation!!.resume("OK")
return "OK"
}
@@ -0,0 +1,32 @@
// IGNORE_BACKEND: JS_IR_ES6
// WITH_RUNTIME
// WITH_COROUTINES
import helpers.*
import kotlin.coroutines.*
inline class R(val x: Any)
var result: String = "fail"
fun builder(c: suspend () -> Unit) {
c.startCoroutine(handleExceptionContinuation {
result = it.message!!
})
}
suspend fun <T> call(fn: suspend () -> T) = fn()
fun useR(r: R) = if (r.x == "OK") "OK" else "fail: $r"
var c: Continuation<R>? = null
suspend fun ok() = suspendCoroutine<R> { c = it }
fun box(): String {
builder {
useR(call(::ok))
}
c?.resumeWithException(IllegalStateException("OK"))
return result
}
@@ -0,0 +1,29 @@
// IGNORE_BACKEND: JS_IR_ES6
// WITH_RUNTIME
// WITH_COROUTINES
import helpers.*
import kotlin.coroutines.*
inline class R(val x: Any)
var result: String = "fail"
fun builder(c: suspend () -> Unit) {
c.startCoroutine(handleExceptionContinuation {
result = it.message!!
})
}
suspend fun <T> call(fn: suspend () -> T) = fn()
fun useR(r: R) = if (r.x == "OK") "OK" else "fail: $r"
fun box(): String {
var c: Continuation<R>? = null
builder {
useR(call { suspendCoroutine { c = it } })
}
c?.resumeWithException(IllegalStateException("OK"))
return result
}
@@ -0,0 +1,93 @@
// WITH_RUNTIME
// WITH_COROUTINES
// COMMON_COROUTINES_TEST
import helpers.*
import COROUTINES_PACKAGE.*
import COROUTINES_PACKAGE.intrinsics.*
var result = "FAIL"
fun builder(c: suspend () -> Unit) {
c.startCoroutine(handleExceptionContinuation {
result = it.message!!
})
}
@Suppress("UNSUPPORTED_FEATURE")
inline class IC(val s: String)
var c: Continuation<Any>? = null
suspend fun <T> suspendMe(): T = suspendCoroutine {
@Suppress("UNCHECKED_CAST")
c = it as Continuation<Any>
}
class Test1() {
suspend fun <T> foo(value: T): T = value
suspend fun qux(ss: IC): IC = IC(ss.s)
suspend fun <T> quz(t: T): T = t
suspend fun bar(): IC {
return foo(qux(quz(suspendMe<IC>())))
}
suspend fun test() = bar().s
}
class Test2 {
suspend fun foo(value: IC): IC = value
suspend fun qux(s: String): IC = IC(s)
suspend fun quz(): String = suspendMe<String>()
suspend fun bar(): IC {
return foo(qux(quz()))
}
suspend fun test() = bar().s
}
class Test3 {
suspend fun <T> foo(value: T): T = value
suspend fun bar(): IC {
return foo(suspendMe<IC>())
}
suspend fun test() = bar().s
}
fun box(): String {
builder {
Test1().test()
}
c?.resumeWithException(IllegalStateException("OK"))
if (result != "OK") return "FAIL 1 $result"
result = "FAIL2"
builder {
Test2().test()
}
c?.resumeWithException(IllegalStateException("OK"))
if (result != "OK") return "FAIL 2 $result"
result = "FAIL 3"
builder {
Test3().test()
}
c?.resumeWithException(IllegalStateException("OK"))
return result
}
@@ -0,0 +1,93 @@
// WITH_RUNTIME
// WITH_COROUTINES
// COMMON_COROUTINES_TEST
import helpers.*
import COROUTINES_PACKAGE.*
import COROUTINES_PACKAGE.intrinsics.*
var result = "FAIL"
fun builder(c: suspend () -> Unit) {
c.startCoroutine(handleExceptionContinuation {
result = it.message!!
})
}
@Suppress("UNSUPPORTED_FEATURE")
inline class IC(val s: Any)
var c: Continuation<Any>? = null
suspend fun <T> suspendMe(): T = suspendCoroutine {
@Suppress("UNCHECKED_CAST")
c = it as Continuation<Any>
}
class Test1() {
suspend fun <T> foo(value: T): T = value
suspend fun qux(ss: IC): IC = IC(ss.s)
suspend fun <T> quz(t: T): T = t
suspend fun bar(): IC {
return foo(qux(quz(suspendMe())))
}
suspend fun test(): Any = bar().s
}
class Test2 {
suspend fun foo(value: IC): IC = value
suspend fun qux(s: String): IC = IC(s)
suspend fun quz(): String = suspendMe()
suspend fun bar(): IC {
return foo(qux(quz()))
}
suspend fun test() = bar().s
}
class Test3 {
suspend fun <T> foo(value: T) = value
suspend fun bar(): IC {
return foo(suspendMe())
}
suspend fun test() = bar().s
}
fun box(): String {
builder {
Test1().test()
}
c?.resumeWithException(IllegalStateException("OK"))
if (result != "OK") return "FAIL 1 $result"
result = "FAIL2"
builder {
Test2().test()
}
c?.resumeWithException(IllegalStateException("OK"))
if (result != "OK") return "FAIL 2 $result"
result = "FAIL 3"
builder {
Test3().test()
}
c?.resumeWithException(IllegalStateException("OK"))
return result as String
}
@@ -0,0 +1,96 @@
// WITH_RUNTIME
// WITH_COROUTINES
// COMMON_COROUTINES_TEST
import helpers.*
import COROUTINES_PACKAGE.*
import COROUTINES_PACKAGE.intrinsics.*
var result = "FAIL"
fun builder(c: suspend () -> Unit) {
c.startCoroutine(handleExceptionContinuation {
result = it.message!!
})
}
@Suppress("UNSUPPORTED_FEATURE")
inline class I0(val x: Any)
@Suppress("UNSUPPORTED_FEATURE")
inline class IC(val s: I0)
var c: Continuation<Any>? = null
suspend fun <T> suspendMe(): T = suspendCoroutine {
@Suppress("UNCHECKED_CAST")
c = it as Continuation<Any>
}
class Test1() {
suspend fun <T> foo(value: T): T = value
suspend fun qux(ss: IC): IC = IC(ss.s)
suspend fun <T> quz(t: T): T = t
suspend fun bar(): IC {
return foo(qux(quz(IC(suspendMe()))))
}
suspend fun test() = bar().s.x
}
class Test2 {
suspend fun foo(value: IC): IC = value
suspend fun qux(s: String): IC = IC(I0(s))
suspend fun quz(): String = suspendMe()
suspend fun bar(): IC {
return foo(qux(quz()))
}
suspend fun test() = bar().s.x
}
class Test3 {
suspend fun <T> foo(value: T): T = value
suspend fun bar(): IC {
return foo(IC(suspendMe()))
}
suspend fun test() = bar().s.x
}
fun box(): String {
builder {
Test1().test()
}
c?.resumeWithException(IllegalStateException("OK"))
if (result != "OK") return "FAIL 1 $result"
result = "FAIL2"
builder {
Test2().test()
}
c?.resumeWithException(IllegalStateException("OK"))
if (result != "OK") return "FAIL 2 $result"
result = "FAIL 3"
builder {
Test3().test()
}
c?.resumeWithException(IllegalStateException("OK"))
return result as String
}
@@ -0,0 +1,99 @@
// WITH_RUNTIME
// WITH_COROUTINES
// COMMON_COROUTINES_TEST
import helpers.*
import COROUTINES_PACKAGE.*
import COROUTINES_PACKAGE.intrinsics.*
var result = "FAIL"
fun builder(c: suspend () -> Unit) {
c.startCoroutine(handleExceptionContinuation {
result = it.message!!
})
}
@Suppress("UNSUPPORTED_FEATURE")
inline class I0(val x: Int)
@Suppress("UNSUPPORTED_FEATURE")
inline class IC(val s: I0)
var c: Continuation<Any>? = null
suspend fun <T> suspendMe(): T = suspendCoroutine {
@Suppress("UNCHECKED_CAST")
c = it as Continuation<Any>
}
class Test1() {
suspend fun <T> foo(value: T): T = value
suspend fun qux(ss: IC): IC = IC(ss.s)
suspend fun <T> quz(t: T): T = t
suspend fun bar(): IC {
return foo(qux(quz(IC(suspendMe()))))
}
suspend fun test() = bar().s.x
}
class Test2 {
suspend fun foo(value: IC): IC = value
suspend fun qux(s: Int): IC = IC(I0(s))
suspend fun quz() = suspendMe<Int>()
suspend fun bar(): IC {
return foo(qux(quz()))
}
suspend fun test() = bar().s.x
}
class Test3 {
suspend fun <T> foo(value: T): T = value
suspend fun bar(): IC {
return foo(IC(suspendMe()))
}
suspend fun test() = bar().s.x
}
fun Int.toBoxResult() =
if (this == 42) "OK" else toString()
fun box(): String {
builder {
Test1().test().toBoxResult()
}
c?.resumeWithException(IllegalStateException("OK"))
if (result != "OK") return "FAIL 1 $result"
result = "FAIL2"
builder {
Test2().test().toBoxResult()
}
c?.resumeWithException(IllegalStateException("OK"))
if (result != "OK") return "FAIL 2 $result"
result = "FAIL 3"
builder {
Test3().test().toBoxResult()
}
c?.resumeWithException(IllegalStateException("OK"))
return result as String
}
@@ -0,0 +1,96 @@
// WITH_RUNTIME
// WITH_COROUTINES
// COMMON_COROUTINES_TEST
import helpers.*
import COROUTINES_PACKAGE.*
import COROUTINES_PACKAGE.intrinsics.*
var result = "FAIL"
fun builder(c: suspend () -> Unit) {
c.startCoroutine(handleExceptionContinuation {
result = it.message!!
})
}
@Suppress("UNSUPPORTED_FEATURE")
inline class IC(val s: Int)
var c: Continuation<Any>? = null
suspend fun <T> suspendMe(): T = suspendCoroutine {
@Suppress("UNCHECKED_CAST")
c = it as Continuation<Any>
}
class Test1() {
suspend fun <T> foo(value: T): T = value
suspend fun qux(ss: IC): IC = IC(ss.s)
suspend fun <T> quz(t: T): T = t
suspend fun bar(): IC {
return foo(qux(quz(suspendMe())))
}
suspend fun test() = bar().s
}
class Test2 {
suspend fun foo(value: IC): IC = value
suspend fun qux(s: Int): IC = IC(s)
suspend fun quz(): Int = suspendMe()
suspend fun bar(): IC {
return foo(qux(quz()))
}
suspend fun test() = bar().s
}
class Test3 {
suspend fun <T> foo(value: T): T = value
suspend fun bar(): IC {
return foo(suspendMe())
}
suspend fun test() = bar().s
}
fun Int.toBoxResult() =
if (this == 42) "OK" else toString()
fun box(): String {
builder {
Test1().test().toBoxResult()
}
c?.resumeWithException(IllegalStateException("OK"))
if (result != "OK") return "FAIL 1 $result"
result = "FAIL2"
builder {
Test2().test().toBoxResult()
}
c?.resumeWithException(IllegalStateException("OK"))
if (result != "OK") return "FAIL 2 $result"
result = "FAIL 3"
builder {
Test3().test().toBoxResult()
}
c?.resumeWithException(IllegalStateException("OK"))
return result as String
}
@@ -0,0 +1,96 @@
// WITH_RUNTIME
// WITH_COROUTINES
// COMMON_COROUTINES_TEST
import helpers.*
import COROUTINES_PACKAGE.*
import COROUTINES_PACKAGE.intrinsics.*
var result = "FAIL"
fun builder(c: suspend () -> Unit) {
c.startCoroutine(handleExceptionContinuation {
result = it.message!!
})
}
@Suppress("UNSUPPORTED_FEATURE")
inline class IC(val s: Long)
var c: Continuation<Any>? = null
suspend fun <T> suspendMe(): T = suspendCoroutine {
@Suppress("UNCHECKED_CAST")
c = it as Continuation<Any>
}
class Test1() {
suspend fun <T> foo(value: T): T = value
suspend fun qux(ss: IC): IC = IC(ss.s)
suspend fun <T> quz(t: T): T = t
suspend fun bar(): IC {
return foo(qux(quz(suspendMe())))
}
suspend fun test() = bar().s
}
class Test2 {
suspend fun foo(value: IC): IC = value
suspend fun qux(s: Long): IC = IC(s)
suspend fun quz() = suspendMe<Long>()
suspend fun bar(): IC {
return foo(qux(quz()))
}
suspend fun test() = bar().s
}
class Test3 {
suspend fun <T> foo(value: T): T = value
suspend fun bar(): IC {
return foo(suspendMe())
}
suspend fun test() = bar().s
}
fun Long.toBoxResult() =
if (this == 42L) "OK" else toString()
fun box(): String {
builder {
Test1().test().toBoxResult()
}
c?.resumeWithException(IllegalStateException("OK"))
if (result != "OK") return "FAIL 1 $result"
result = "FAIL2"
builder {
Test2().test().toBoxResult()
}
c?.resumeWithException(IllegalStateException("OK"))
if (result != "OK") return "FAIL 2 $result"
result = "FAIL 3"
builder {
Test3().test().toBoxResult()
}
c?.resumeWithException(IllegalStateException("OK"))
return result as String
}
@@ -0,0 +1,93 @@
// WITH_RUNTIME
// WITH_COROUTINES
// COMMON_COROUTINES_TEST
import helpers.*
import COROUTINES_PACKAGE.*
import COROUTINES_PACKAGE.intrinsics.*
var result = "FAIL"
fun builder(c: suspend () -> Unit) {
c.startCoroutine(handleExceptionContinuation {
result = it.message!!
})
}
@Suppress("UNSUPPORTED_FEATURE")
inline class IC(val s: Any?)
var c: Continuation<Any>? = null
suspend fun <T> suspendMe(): T = suspendCoroutine {
@Suppress("UNCHECKED_CAST")
c = it as Continuation<Any>
}
class Test1() {
suspend fun <T> foo(value: T): T = value
suspend fun qux(ss: IC): IC = IC(ss.s)
suspend fun <T> quz(t: T): T = t
suspend fun bar(): IC {
return foo(qux(quz(suspendMe())))
}
suspend fun test() = bar().s
}
class Test2 {
suspend fun foo(value: IC): IC = value
suspend fun qux(s: String): IC = IC(s)
suspend fun quz(): String = suspendMe()
suspend fun bar(): IC {
return foo(qux(quz()))
}
suspend fun test() = bar().s
}
class Test3 {
suspend fun <T> foo(value: T): T = value
suspend fun bar(): IC {
return foo(suspendMe())
}
suspend fun test() = bar().s
}
fun box(): String {
builder {
Test1().test()
}
c?.resumeWithException(IllegalStateException("OK"))
if (result != "OK") return "FAIL 1 $result"
result = "FAIL2"
builder {
Test2().test()
}
c?.resumeWithException(IllegalStateException("OK"))
if (result != "OK") return "FAIL 2 $result"
result = "FAIL 3"
builder {
Test3().test()
}
c?.resumeWithException(IllegalStateException("OK"))
return result as String
}
@@ -0,0 +1,99 @@
// WITH_RUNTIME
// WITH_COROUTINES
// COMMON_COROUTINES_TEST
import helpers.*
import COROUTINES_PACKAGE.*
import COROUTINES_PACKAGE.intrinsics.*
var result = "FAIL"
fun builder(c: suspend () -> Unit) {
c.startCoroutine(handleExceptionContinuation {
result = it.message!!
})
}
@Suppress("UNSUPPORTED_FEATURE")
inline class IC(val s: String)
var c: Continuation<Any>? = null
suspend fun <T> suspendMe(): T = suspendCoroutine {
@Suppress("UNCHECKED_CAST")
c = it as Continuation<Any>
}
class Test1() {
suspend fun <T> foo(value: T): T = value
suspend fun qux(ss: IC): IC = IC(ss.s)
suspend fun <T> quz(t: T): T = t
suspend fun bar(): IC {
run {
return foo(qux(quz(suspendMe())))
}
}
suspend fun test() = bar().s
}
class Test2 {
suspend fun foo(value: IC): IC = value
suspend fun qux(s: String): IC = IC(s)
suspend fun quz(): String = suspendMe()
suspend fun bar(): IC {
run {
return foo(qux(quz()))
}
}
suspend fun test() = bar().s
}
class Test3 {
suspend fun <T> foo(value: T): T = value
suspend fun bar(): IC {
run {
return foo(suspendMe())
}
}
suspend fun test() = bar().s
}
fun box(): String {
builder {
Test1().test()
}
c?.resumeWithException(IllegalStateException("OK"))
if (result != "OK") return "FAIL 1 $result"
result = "FAIL2"
builder {
Test2().test()
}
c?.resumeWithException(IllegalStateException("OK"))
if (result != "OK") return "FAIL 2 $result"
result = "FAIL 3"
builder {
Test3().test()
}
c?.resumeWithException(IllegalStateException("OK"))
return result
}
@@ -0,0 +1,53 @@
// WITH_RUNTIME
// WITH_COROUTINES
// COMMON_COROUTINES_TEST
import helpers.*
import COROUTINES_PACKAGE.*
import COROUTINES_PACKAGE.intrinsics.*
var result = "FAIL"
fun builder(c: suspend () -> Unit) {
c.startCoroutine(handleExceptionContinuation {
result = it.message!!
})
}
@Suppress("UNSUPPORTED_FEATURE")
inline class IC(val s: String)
var c: Continuation<Any>? = null
suspend fun <T> suspendMe(): T = suspendCoroutine {
@Suppress("UNCHECKED_CAST")
c = it as Continuation<Any>
}
fun suspendFunId(block: suspend () -> IC) = block
class Test1() {
suspend fun <T> foo(value: T): T = value
suspend fun qux(ss: IC): IC = IC(ss.s)
suspend fun <T> quz(t: T): T = t
suspend fun bar(): IC {
return suspendFunId { foo(qux(quz(suspendMe()))) }()
}
suspend fun test() = bar().s
}
fun box(): String {
builder {
Test1().test()
}
c?.resumeWithException(IllegalStateException("OK"))
if (result != "OK") return "FAIL 1 $result"
return result
}
@@ -0,0 +1,58 @@
// WITH_RUNTIME
// WITH_COROUTINES
// COMMON_COROUTINES_TEST
import helpers.*
import COROUTINES_PACKAGE.*
var result = "FAIL"
fun builder(c: suspend () -> Unit) {
c.startCoroutine(handleExceptionContinuation {
result = it.message!!
})
}
@Suppress("UNSUPPORTED_FEATURE")
inline class Result<T>(val a: Any?) {
fun getOrThrow(): T = a as T
}
var c: Continuation<Any>? = null
suspend fun <T> suspendMe(): T = suspendCoroutine {
@Suppress("UNCHECKED_CAST")
c = it as Continuation<Any>
}
abstract class ResultReceiver<T> {
abstract suspend fun receive(result: Result<T>)
}
inline fun <T> ResultReceiver(crossinline f: (Result<T>) -> Unit): ResultReceiver<T> =
object : ResultReceiver<T>() {
override suspend fun receive(result: Result<T>) {
f(result)
}
}
fun test() {
var invoked = false
val receiver = ResultReceiver<String> { result ->
invoked = true
result.getOrThrow()
}
builder {
receiver.receive(Result(suspendMe()))
}
c?.resumeWithException(IllegalStateException("OK"))
if (invoked) {
throw RuntimeException("Fail")
}
}
fun box(): String {
test()
return result
}
@@ -0,0 +1,58 @@
// WITH_RUNTIME
// WITH_COROUTINES
// COMMON_COROUTINES_TEST
import helpers.*
import COROUTINES_PACKAGE.*
var result = "FAIL"
fun builder(c: suspend () -> Unit) {
c.startCoroutine(handleExceptionContinuation {
result = it.message!!
})
}
@Suppress("UNSUPPORTED_FEATURE")
inline class Result<T>(val a: Any?) {
fun getOrThrow(): T = a as T
}
var c: Continuation<Any>? = null
suspend fun <T> suspendMe(): T = suspendCoroutine {
@Suppress("UNCHECKED_CAST")
c = it as Continuation<Any>
}
abstract class ResultReceiver<T> {
abstract suspend fun receive(result: Result<T>)
}
fun <T> ResultReceiver(f: (Result<T>) -> Unit): ResultReceiver<T> =
object : ResultReceiver<T>() {
override suspend fun receive(result: Result<T>) {
f(result)
}
}
fun test() {
var invoked = false
val receiver = ResultReceiver<Int> { result ->
invoked = true
result.getOrThrow()
}
builder {
receiver.receive(Result(suspendMe()))
}
c?.resumeWithException(IllegalStateException("OK"))
if (invoked) {
throw RuntimeException("Fail")
}
}
fun box(): String {
test()
return result
}
@@ -0,0 +1,56 @@
// WITH_RUNTIME
// WITH_COROUTINES
import helpers.*
import kotlin.coroutines.*
var result = "FAIL"
fun builder(c: suspend () -> Unit) {
c.startCoroutine(handleExceptionContinuation {
result = it.message!!
})
}
@Suppress("UNSUPPORTED_FEATURE")
inline class IC(val s: String)
interface IBar {
suspend fun bar(): Any
}
var c: Continuation<Any>? = null
suspend fun <T> suspendMe(): T = suspendCoroutine {
@Suppress("UNCHECKED_CAST")
c = it as Continuation<Any>
}
class Test() : IBar {
override suspend fun bar(): IC = suspendMe()
suspend fun test1(): String {
val b: IBar = this
return (b.bar() as IC).s
}
suspend fun test2(): String = bar().s
}
fun box(): String {
builder {
Test().test1()
}
c?.resumeWithException(IllegalStateException("OK"))
if (result != "OK") return "FAIL 1 $result"
result = "FAIL2 "
builder {
Test().test2()
}
c?.resumeWithException(IllegalStateException("OK"))
if (result != "OK") return "FAIL 2 $result"
return result
}
@@ -0,0 +1,58 @@
// WITH_RUNTIME
// WITH_COROUTINES
import helpers.*
import kotlin.coroutines.*
var result = "FAIL"
fun builder(c: suspend () -> Unit) {
c.startCoroutine(handleExceptionContinuation {
result = it.message!!
})
}
@Suppress("UNSUPPORTED_FEATURE")
inline class IC(val s: String)
var c: Continuation<Any>? = null
suspend fun <T> suspendMe(): T = suspendCoroutine {
@Suppress("UNCHECKED_CAST")
c = it as Continuation<Any>
}
interface IBar {
suspend fun bar(): IC?
}
class Test() : IBar {
override suspend fun bar(): IC = suspendMe()
suspend fun test1(): String {
val b: IBar = this
return b.bar()!!.s
}
suspend fun test2(): String {
return bar().s
}
}
fun box(): String {
builder {
Test().test1()
}
c?.resumeWithException(IllegalStateException("OK"))
if (result != "OK") return "FAIL 1 $result"
result = "FAIL2"
builder {
Test().test2()
}
c?.resumeWithException(IllegalStateException("OK"))
if (result != "OK") return "FAIL 2 $result"
return result
}
@@ -0,0 +1,57 @@
// WITH_RUNTIME
// WITH_COROUTINES
import helpers.*
import kotlin.coroutines.*
var result = "FAIL"
fun builder(c: suspend () -> Unit) {
c.startCoroutine(handleExceptionContinuation {
result = it.message!!
})
}
@Suppress("UNSUPPORTED_FEATURE")
inline class IC(val s: Any)
var c: Continuation<Any>? = null
suspend fun <T> suspendMe(): T = suspendCoroutine {
@Suppress("UNCHECKED_CAST")
c = it as Continuation<Any>
}
interface IBar {
suspend fun bar(): IC?
}
class Test() : IBar {
override suspend fun bar(): IC = suspendMe()
suspend fun test1(): String {
val b: IBar = this
return b.bar()!!.s as String
}
suspend fun test2(): String {
return bar()!!.s as String
}
}
fun box(): String {
builder {
Test().test1()
}
c?.resumeWithException(IllegalStateException("OK"))
if (result != "OK") return "FAIL 1 $result"
result = "FAIL2"
builder {
Test().test2()
}
c?.resumeWithException(IllegalStateException("OK"))
if (result != "OK") return "FAIL 2 $result"
return result
}
@@ -0,0 +1,60 @@
// WITH_RUNTIME
// WITH_COROUTINES
import helpers.*
import kotlin.coroutines.*
var result = "FAIL"
fun builder(c: suspend () -> Unit) {
c.startCoroutine(handleExceptionContinuation {
result = it.message!!
})
}
@Suppress("UNSUPPORTED_FEATURE")
inline class IC(val s: Int)
var c: Continuation<Any>? = null
suspend fun <T> suspendMe(): T = suspendCoroutine {
@Suppress("UNCHECKED_CAST")
c = it as Continuation<Any>
}
interface IBar {
suspend fun bar(): IC?
}
fun Int.toResultString() =
if (this == 42) "OK" else "!!! $this"
class Test() : IBar {
override suspend fun bar(): IC = suspendMe()
suspend fun test1(): String {
val b: IBar = this
return b.bar()!!.s.toResultString()
}
suspend fun test2(): String {
return bar()!!.s.toResultString()
}
}
fun box(): String {
builder {
Test().test1()
}
c?.resumeWithException(IllegalStateException("OK"))
if (result != "OK") return "FAIL 1 $result"
result = "FAIL2"
builder {
Test().test2()
}
c?.resumeWithException(IllegalStateException("OK"))
if (result != "OK") return "FAIL 2 $result"
return result
}
@@ -0,0 +1,57 @@
// WITH_RUNTIME
// WITH_COROUTINES
// IGNORE_BACKEND: JS_IR
import helpers.*
import kotlin.coroutines.*
var result = "FAIL"
fun builder(c: suspend () -> Unit) {
c.startCoroutine(handleExceptionContinuation {
result = it.message!!
})
}
@Suppress("UNSUPPORTED_FEATURE")
inline class IC(val s: Any?)
var c: Continuation<Any>? = null
suspend fun <T> suspendMe(): T = suspendCoroutine {
@Suppress("UNCHECKED_CAST")
c = it as Continuation<Any>
}
interface IBar {
suspend fun bar(): IC?
}
class Test() : IBar {
override suspend fun bar(): IC = suspendMe()
suspend fun test1(): String {
val b: IBar = this
return b.bar()!!.s as String
}
suspend fun test2(): String = bar().s as String
}
fun box(): String {
builder {
Test().test1()
}
c?.resumeWithException(IllegalStateException("OK"))
if (result != "OK") return "FAIL 1 $result"
result = "FAIL2"
builder {
Test().test2()
}
c?.resumeWithException(IllegalStateException("OK"))
if (result != "OK") return "FAIL 2 $result"
return result
}
@@ -0,0 +1,63 @@
// WITH_RUNTIME
// WITH_COROUTINES
import helpers.*
import kotlin.coroutines.*
var result = "FAIL"
fun builder(c: suspend () -> Unit) {
c.startCoroutine(handleExceptionContinuation {
result = it.message!!
})
}
@Suppress("UNSUPPORTED_FEATURE")
inline class IC(val s: Any?)
var c: Continuation<Any>? = null
suspend fun <T> suspendMe(): T = suspendCoroutine {
@Suppress("UNCHECKED_CAST")
c = it as Continuation<Any>
}
interface IBar {
suspend fun bar(): IC?
}
class Test1() : IBar {
override suspend fun bar(): IC = suspendMe()
suspend fun test(): Any? {
val b: IBar = this
return b.bar()!!.s
}
}
class Test2() : IBar {
override suspend fun bar(): IC = suspendMe()
suspend fun test(): IC {
val b: IBar = this
return b.bar()!!
}
}
fun box(): String {
builder {
Test1().test()
}
c?.resumeWithException(IllegalStateException("OK"))
if (result != "OK") return "FAIL 1 $result"
result = "FAIL 2"
builder {
Test2().test()
}
c?.resumeWithException(IllegalStateException("OK"))
if (result != "OK") return "FAIL 2 $result"
return "OK"
}
@@ -0,0 +1,60 @@
// WITH_RUNTIME
// WITH_COROUTINES
import helpers.*
import kotlin.coroutines.*
var result = "FAIL"
fun builder(c: suspend () -> Unit) {
c.startCoroutine(handleExceptionContinuation {
result = it.message!!
})
}
@Suppress("UNSUPPORTED_FEATURE")
inline class IC(val s: Int?)
var c: Continuation<Any>? = null
suspend fun <T> suspendMe(): T = suspendCoroutine {
@Suppress("UNCHECKED_CAST")
c = it as Continuation<Any>
}
interface IBar {
suspend fun bar(): IC?
}
fun Int?.toResultString() =
if (this == 42) "OK" else "!!! $this"
class Test() : IBar {
override suspend fun bar(): IC = suspendMe()
suspend fun test1(): String {
val b: IBar = this
return b.bar()!!.s.toResultString()
}
suspend fun test2(): String {
return bar()!!.s.toResultString()
}
}
fun box(): String {
builder {
Test().test1()
}
c?.resumeWithException(IllegalStateException("OK"))
if (result != "OK") return "FAIL 1 $result"
result = "FAIL2"
builder {
Test().test2()
}
c?.resumeWithException(IllegalStateException("OK"))
if (result != "OK") return "FAIL 2 $result"
return result
}
@@ -0,0 +1,58 @@
// WITH_RUNTIME
// WITH_COROUTINES
// IGNORE_BACKEND: JS_IR
import helpers.*
import kotlin.coroutines.*
var result = "FAIL"
fun builder(c: suspend () -> Unit) {
c.startCoroutine(handleExceptionContinuation {
result = it.message!!
})
}
@Suppress("UNSUPPORTED_FEATURE")
inline class IC(val s: Any)
var c: Continuation<Any>? = null
suspend fun <T> suspendMe(): T = suspendCoroutine {
@Suppress("UNCHECKED_CAST")
c = it as Continuation<Any>
}
interface IBar {
suspend fun bar(): Any
}
class Test() : IBar {
override suspend fun bar(): IC = suspendMe()
suspend fun test1(): String {
val b: IBar = this
return (b.bar() as IC).s as String
}
suspend fun test2(): String = bar().s as String
}
fun box(): String {
builder {
Test().test1()
}
c?.resumeWithException(IllegalStateException("OK"))
if (result != "OK") return "FAIL 1 $result"
result = "FAIL2 "
builder {
Test().test2()
}
c?.resumeWithException(IllegalStateException("OK"))
if (result != "OK") return "FAIL 2 $result"
return result
}
@@ -0,0 +1,61 @@
// WITH_RUNTIME
// WITH_COROUTINES
import helpers.*
import kotlin.coroutines.*
var result = "FAIL"
fun builder(c: suspend () -> Unit) {
c.startCoroutine(handleExceptionContinuation {
result = it.message!!
})
}
@Suppress("UNSUPPORTED_FEATURE")
inline class IC(val s: Int)
var c: Continuation<Any>? = null
suspend fun <T> suspendMe(): T = suspendCoroutine {
@Suppress("UNCHECKED_CAST")
c = it as Continuation<Any>
}
interface IBar {
suspend fun bar(): Any
}
class Test() : IBar {
override suspend fun bar(): IC = suspendMe()
suspend fun test1(): Int {
val b: IBar = this
return (b.bar() as IC).s
}
suspend fun test2(): Int {
val b: IBar = this
return (b.bar() as IC).s
}
}
fun Int.toBoxResult() =
if (this == 42) "OK" else toString()
fun box(): String {
builder {
Test().test1().toBoxResult()
}
c?.resumeWithException(IllegalStateException("OK"))
if (result != "OK") return "FAIL 1 $result"
result = "FAIL2"
builder {
Test().test2().toBoxResult()
}
c?.resumeWithException(IllegalStateException("OK"))
if (result != "OK") return "FAIL 2 $result"
return result as String
}
@@ -0,0 +1,39 @@
// WITH_RUNTIME
// WITH_COROUTINES
import helpers.*
import kotlin.coroutines.*
var result = "FAIL"
inline class IC(val s: String)
var c: Continuation<Any>? = null
suspend fun <T> suspendMe(): T = suspendCoroutine {
@Suppress("UNCHECKED_CAST")
c = it as Continuation<Any>
}
interface Base<T> {
suspend fun generic(): T
}
class Derived : Base<IC> {
override suspend fun generic(): IC = suspendMe()
}
fun builder(c: suspend () -> Unit) {
c.startCoroutine(handleExceptionContinuation {
result = it.message!!
})
}
fun box(): String {
builder {
val base: Base<*> = Derived()
(base.generic() as IC).s
}
c?.resumeWithException(IllegalStateException("OK"))
return result
}

Some files were not shown because too many files have changed in this diff Show More