Implement proper name interpretation for suspend functions

#KT-57313 Fixed
This commit is contained in:
Ivan Kylchik
2023-04-08 22:44:37 +02:00
committed by Space Team
parent 82589f2506
commit 08ba63df90
10 changed files with 92 additions and 7 deletions
@@ -0,0 +1,20 @@
@CompileTimeCalculation
class A(val a: Int) {
fun foo(): Int {
return a
}
suspend fun baz(): Int {
return a
}
}
const val functionName = <!EVALUATED: `foo`!>A::foo.name<!>
const val functionInvoke = <!EVALUATED: `1`!>A::foo.invoke(A(1))<!>
const val functionWithReceiverName = <!EVALUATED: `foo`!>A(2)::foo.name<!>
const val functionWithReceiverInvoke = <!EVALUATED: `2`!>A(2)::foo.invoke()<!>
// THIS IS WRONG, suspend fun must be called from coroutine ot another suspend function.
// It is used here just for test purposes.
const val suspendFunctionInvoke = <!EVALUATED: `3`!>A::baz.invoke(A(3))<!>