[Tests] Add tests with default params and suspending contextual function
This commit is contained in:
committed by
TeamCityServer
parent
cd2fbfed2e
commit
2e97e78e6a
+12
@@ -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")
|
||||
|
||||
Vendored
+31
@@ -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
|
||||
}
|
||||
+20
@@ -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)
|
||||
}
|
||||
}
|
||||
+12
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user