diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java index be58c966a39..7d9d1f713dd 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java @@ -16229,6 +16229,18 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/extensionFunctions/contextReceivers/useFromAnotherModule.kt"); } + @Test + @TestMetadata("useFromAnotherModuleSuspending.kt") + public void testUseFromAnotherModuleSuspending() throws Exception { + runTest("compiler/testData/codegen/box/extensionFunctions/contextReceivers/useFromAnotherModuleSuspending.kt"); + } + + @Test + @TestMetadata("useFromAnotherModuleWithDefaultParameterValues.kt") + public void testUseFromAnotherModuleWithDefaultParameterValues() throws Exception { + runTest("compiler/testData/codegen/box/extensionFunctions/contextReceivers/useFromAnotherModuleWithDefaultParameterValues.kt"); + } + @Nested @TestMetadata("compiler/testData/codegen/box/extensionFunctions/contextReceivers/fromKEEP") @TestDataPath("$PROJECT_ROOT") diff --git a/compiler/testData/codegen/box/extensionFunctions/contextReceivers/useFromAnotherModuleSuspending.kt b/compiler/testData/codegen/box/extensionFunctions/contextReceivers/useFromAnotherModuleSuspending.kt new file mode 100644 index 00000000000..ab632d10656 --- /dev/null +++ b/compiler/testData/codegen/box/extensionFunctions/contextReceivers/useFromAnotherModuleSuspending.kt @@ -0,0 +1,31 @@ +// !LANGUAGE: +ContextReceivers +// TARGET_BACKEND: JVM_IR +// IGNORE_BACKEND_FIR: JVM_IR +// WITH_RUNTIME +// WITH_COROUTINES + +// MODULE: lib +// FILE: A.kt + +package a + +context(String) +suspend fun f() = this@String + +// MODULE: main(lib) +// FILE: B.kt + +import helpers.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* + +fun box(): String { + var result: String = "fail" + val block: suspend () -> String = { + with("OK") { a.f() } + } + block.startCoroutine(handleResultContinuation { value -> + result = value + }) + return result +} diff --git a/compiler/testData/codegen/box/extensionFunctions/contextReceivers/useFromAnotherModuleWithDefaultParameterValues.kt b/compiler/testData/codegen/box/extensionFunctions/contextReceivers/useFromAnotherModuleWithDefaultParameterValues.kt new file mode 100644 index 00000000000..1182afed054 --- /dev/null +++ b/compiler/testData/codegen/box/extensionFunctions/contextReceivers/useFromAnotherModuleWithDefaultParameterValues.kt @@ -0,0 +1,20 @@ +// !LANGUAGE: +ContextReceivers +// TARGET_BACKEND: JVM_IR +// IGNORE_BACKEND_FIR: JVM_IR + +// MODULE: lib +// FILE: A.kt + +package a + +context(String) +fun f(useArg: Boolean, arg: String = "K") = if (useArg) arg else this@String + +// MODULE: main(lib) +// FILE: B.kt + +fun box(): String { + return with("O") { + a.f(false) + a.f(true) + } +} diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java index 409be51320d..b8f76845901 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java @@ -16229,6 +16229,18 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/extensionFunctions/contextReceivers/useFromAnotherModule.kt"); } + @Test + @TestMetadata("useFromAnotherModuleSuspending.kt") + public void testUseFromAnotherModuleSuspending() throws Exception { + runTest("compiler/testData/codegen/box/extensionFunctions/contextReceivers/useFromAnotherModuleSuspending.kt"); + } + + @Test + @TestMetadata("useFromAnotherModuleWithDefaultParameterValues.kt") + public void testUseFromAnotherModuleWithDefaultParameterValues() throws Exception { + runTest("compiler/testData/codegen/box/extensionFunctions/contextReceivers/useFromAnotherModuleWithDefaultParameterValues.kt"); + } + @Nested @TestMetadata("compiler/testData/codegen/box/extensionFunctions/contextReceivers/fromKEEP") @TestDataPath("$PROJECT_ROOT")