Allow suspend-conversion for callable references as part of adaptation

This commit is contained in:
Mikhail Zarechenskiy
2020-06-02 16:01:10 +03:00
parent 6b58be377e
commit 6b0a803d14
3 changed files with 2 additions and 22 deletions
@@ -35,25 +35,5 @@ object SuspendConversionCallChecker : CallChecker {
)
)
}
for ((parameter, argument) in resolvedCall.argumentMappingByOriginal) {
if (!parameter.type.isSuspendFunctionType) continue
if (argument !is ResolvedCallArgument.SimpleArgument) continue
val callArgument = argument.callArgument
if (callArgument !is CallableReferenceKotlinCallArgument) continue
val callableReferenceExpression = callArgument.psiExpression as? KtCallableReferenceExpression ?: continue
val argumentCall = callableReferenceExpression.callableReference.getResolvedCall(context.trace.bindingContext) ?: continue
val target = argumentCall.resultingDescriptor as? FunctionDescriptor ?: continue
if (!target.isSuspend) {
context.trace.report(
Errors.UNSUPPORTED_FEATURE.on(
callableReferenceExpression,
LanguageFeature.SuspendConversion to context.languageVersionSettings
)
)
}
}
}
}