IR: fix thisReceiver parameter type for function classes

Incorrect builder was used at line 269, which led to non-sensible type
in `IrClass.thisReceiver` for function types, such as
`SuspendFunction1<SuspendFunction1, SuspendFunction1>` in the linked
issue.

Avoid creating types manually completely to simplify this code and fix
the bug.

 #KT-49168 Fixed
This commit is contained in:
Alexander Udalov
2021-11-09 22:08:48 +01:00
parent 5b9268a108
commit 27cfcb9b3d
12 changed files with 86 additions and 23 deletions
+27
View File
@@ -0,0 +1,27 @@
// WITH_RUNTIME
// WITH_COROUTINES
// IGNORE_BACKEND: JVM
// IGNORE_LIGHT_ANALYSIS
import helpers.*
import kotlin.coroutines.*
fun interface Print {
suspend fun print(msg: String): String
}
object Context : Print by Print(::id)
fun id(x: String): String = x
fun builder(c: suspend () -> Unit) {
c.startCoroutine(EmptyContinuation)
}
fun box(): String {
var result = "Fail"
builder {
result = Context.print("OK")
}
return result
}