[NI] Support callable references to suspend functions

#KT-30658 Fixed
This commit is contained in:
Mikhail Zarechenskiy
2019-03-28 11:50:37 +03:00
parent 017f9aea35
commit 1ac25259e8
6 changed files with 52 additions and 5 deletions
@@ -152,11 +152,14 @@ class ReflectionTypes(module: ModuleDescriptor, private val notFoundClasses: Not
}
fun isNumberedKFunctionOrKSuspendFunction(type: KotlinType): Boolean {
return isNumberedKFunction(type) || isNumberedKSuspendFunction(type)
}
fun isNumberedKFunction(type: KotlinType): Boolean {
val descriptor = type.constructor.declarationDescriptor as? ClassDescriptor ?: return false
val shortName = descriptor.name.asString()
return (shortName.length > K_FUNCTION_PREFIX.length && shortName.startsWith(K_FUNCTION_PREFIX) ||
isNumberedKSuspendFunction(type)) &&
return (shortName.length > K_FUNCTION_PREFIX.length && shortName.startsWith(K_FUNCTION_PREFIX)) &&
DescriptorUtils.getFqName(descriptor).parent().toSafe() == KOTLIN_REFLECT_FQ_NAME
}