KT-51243 Fix parameterized contextual lambda

^KT-51243 Fixed
This commit is contained in:
Anastasia.Shadrina
2022-03-15 15:15:51 +07:00
committed by teamcity
parent efd5beb49b
commit d857142514
10 changed files with 102 additions and 10 deletions
@@ -0,0 +1,13 @@
// !LANGUAGE: +ContextReceivers
// TARGET_BACKEND: JVM_IR
// FIR status: context receivers aren't yet supported
class A {
val result = "OK"
}
fun <T> test(receiver: T, action: context(T) () -> String) = action(receiver)
fun box(): String = with(A()) {
result
}
@@ -0,0 +1,20 @@
// FIR_IDENTICAL
// SKIP_TXT
// !LANGUAGE: +ContextReceivers
fun <T> test(action: context(T) () -> Unit) {}
fun <T> test2(actionWithArg: context(T) (T) -> Unit) {}
fun main() {
test<String> {
length
}
test<Int> {
toDouble()
}
test2<String> { a ->
length
a.length
}
}