[Tests] Add a test with type parameter as a context receiver

This commit is contained in:
Anastasiya Shadrina
2021-11-18 16:57:20 +07:00
committed by TeamCityServer
parent 752bc299f1
commit a70036c945
13 changed files with 118 additions and 0 deletions
@@ -0,0 +1,11 @@
// !LANGUAGE: +ContextReceivers
// IGNORE_BACKEND_FIR: JVM_IR
context(T)
fun <T> useContext(block: (T) -> Unit) { }
fun test() {
with(42) {
useContext { i: Int -> i.toDouble() }
}
}
@@ -0,0 +1,12 @@
// !LANGUAGE: +ContextReceivers
// IGNORE_BACKEND_FIR: JVM_IR
context(T)
fun <T> useContext(block: (T) -> Unit) { }
fun test() {
with(42) {
useContext { i: Int -> i.toDouble() }
}
}
@@ -0,0 +1,4 @@
package
public fun test(): kotlin.Unit
public fun </*0*/ T> useContext(/*0*/ block: (T) -> kotlin.Unit): kotlin.Unit