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
@@ -4,19 +4,22 @@
class A(val OK: Int, val somePropertyWithLongName: String) {
fun foo() {}
suspend fun bar() {}
}
val topLevelProp = 1
const val propertyName1 = A::OK.name
const val propertyName2 = A::somePropertyWithLongName.name
const val methodName = A::foo.name
const val suspendMethodName = A::bar.name
const val className = ::A.name
const val topLevelPropName = ::topLevelProp.name
fun box(): String {
if (propertyName1 != "OK") return "Fail 1"
if (propertyName2 != "somePropertyWithLongName") return "Fail 2"
if (methodName != "foo") return "Fail 3"
if (methodName != "foo") return "Fail 3.1"
if (suspendMethodName != "bar") return "Fail 3.2"
if (className != "<init>") return "Fail 4"
if (topLevelPropName != "topLevelProp") return "Fail 5"
return "OK"
@@ -0,0 +1,22 @@
// TARGET_BACKEND: JVM_IR
abstract class AsyncJob {
abstract suspend fun execute(lifetime: AsyncLifetime, attempt: Int, due: DateTime, context: JobContext): JobContext
}
class OrgBootstrapRequest
class AsyncLifetime
class DateTime
class JobContext
class OrgBootstrapTriggerJob(val orgId: Long, val bootstrap: OrgBootstrapRequest, val jetSalesSync: Boolean?) : AsyncJob() {
override suspend fun execute(lifetime: AsyncLifetime, attempt: Int, due: DateTime, context: JobContext): JobContext {
return JobContext()
}
}
val name = "${OrgBootstrapTriggerJob::class.simpleName}.${OrgBootstrapTriggerJob::execute.name}"
fun box(): String {
return "OK"
}