JVM IR: do not copy type parameters into suspend lambda classes

Declarations inside that class are referencing the type parameters of
the containing function anyway, since we don't do any remapping. So the
resulting IR is slightly more correct, and doesn't lead to type
parameter/argument size mismatch error on IrBased/Wrapped-descriptors.

This reverts a part of 01da7f289b, which looks like it was no longer
necessary after 8d0ffa1444.

 #KT-42028 Fixed
This commit is contained in:
Alexander Udalov
2020-09-18 17:03:50 +02:00
parent bdf502edef
commit d48307ec34
10 changed files with 70 additions and 5 deletions
+34
View File
@@ -0,0 +1,34 @@
// WITH_RUNTIME
// WITH_COROUTINES
import kotlin.coroutines.*
import helpers.*
interface I {
suspend fun foo(g: suspend String.() -> Unit)
}
fun builder0(f: suspend () -> Unit) {
f.startCoroutine(EmptyContinuation)
}
fun <T> builder(f: suspend I.() -> T) {
builder0 {
f(object : I {
override suspend fun foo(g: suspend String.() -> Unit) {
g("OK")
"Force non-tail call".length
}
})
}
}
fun box(): String {
var result = "Fail"
builder {
foo {
result = this
}
}
return result
}