Check for backend when checking for suspend in fun interfaces

This commit is contained in:
Ilmir Usmanov
2021-03-16 01:23:28 +01:00
parent bf2942b5cc
commit a90a5f6dd4
22 changed files with 85 additions and 92 deletions
@@ -61,15 +61,6 @@ class FunInterfaceDeclarationChecker : DeclarationChecker {
) {
val ktFunction = abstractMember.source.getPsi() as? KtNamedFunction
if (abstractMember.isSuspend &&
!(context.languageVersionSettings.supportsFeature(LanguageFeature.SuspendFunctionsInFunInterfaces) &&
context.languageVersionSettings.supportsFeature(LanguageFeature.JvmIrEnabledByDefault))
) {
val reportOn = ktFunction?.modifierList?.getModifier(KtTokens.SUSPEND_KEYWORD) ?: funInterfaceKeyword
context.trace.report(Errors.FUN_INTERFACE_WITH_SUSPEND_FUNCTION.on(reportOn))
return
}
if (abstractMember.typeParameters.isNotEmpty()) {
val reportOn = ktFunction?.typeParameterList ?: ktFunction?.funKeyword ?: funInterfaceKeyword
context.trace.report(Errors.FUN_INTERFACE_ABSTRACT_METHOD_WITH_TYPE_PARAMETERS.on(reportOn))