diff --git a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/SpecialBackendChecksTraversal.kt b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/SpecialBackendChecksTraversal.kt index 4ee96c37f66..2930249aae8 100644 --- a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/SpecialBackendChecksTraversal.kt +++ b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/SpecialBackendChecksTraversal.kt @@ -21,7 +21,6 @@ import org.jetbrains.kotlin.backend.konan.ir.companionObject import org.jetbrains.kotlin.backend.konan.ir.getSuperClassNotAny import org.jetbrains.kotlin.backend.konan.llvm.IntrinsicType import org.jetbrains.kotlin.backend.konan.llvm.tryGetIntrinsicType -import org.jetbrains.kotlin.builtins.functions.FunctionClassKind import org.jetbrains.kotlin.descriptors.ClassDescriptor import org.jetbrains.kotlin.descriptors.ClassKind import org.jetbrains.kotlin.descriptors.DescriptorVisibilities @@ -29,7 +28,6 @@ import org.jetbrains.kotlin.descriptors.isFinalClass import org.jetbrains.kotlin.ir.IrElement import org.jetbrains.kotlin.ir.declarations.* import org.jetbrains.kotlin.ir.expressions.* -import org.jetbrains.kotlin.ir.symbols.IrClassSymbol import org.jetbrains.kotlin.ir.symbols.IrSimpleFunctionSymbol import org.jetbrains.kotlin.ir.symbols.IrTypeParameterSymbol import org.jetbrains.kotlin.ir.types.* @@ -593,41 +591,9 @@ private class BackendChecker(val context: Context, val irFile: IrFile) : IrEleme if (declaration.isKotlinObjCClass()) { checkKotlinObjCClass(declaration) } - checkNotImplementsMultipleSuspendLambdas(declaration) } } -// TODO: remove this check in KT-46775 -private fun BackendChecker.checkNotImplementsMultipleSuspendLambdas(clazz: IrClass) { - var suspendFunctionClassSymbol: IrClassSymbol? = null // Can be null (no suspend function supertypes) or non-null (the single one). - - fun checkSupertype(superType: IrType): Boolean { - val superTypeClassSymbol = superType.classOrNull - ?: return true // This is not a class. Continue with others. - - return when { - superTypeClassSymbol.isFunctionMarker() -> true // Continue with others. - superTypeClassSymbol.isFunction() -> { - // Mixing suspend and non-suspend function supertypes is not allowed by the frontend. So can stop here. - false - } - superTypeClassSymbol.isSuspendFunction() -> { - suspendFunctionClassSymbol = when (suspendFunctionClassSymbol) { - null, superTypeClassSymbol -> superTypeClassSymbol - else -> reportError(clazz, "Multiple suspend function types as supertypes are not supported yet") - } - true // Continue with others. - } - else -> { - // Recurse with supertypes. - superTypeClassSymbol.owner.superTypes.all(::checkSupertype) - } - } - } - - clazz.superTypes.all(::checkSupertype) -} - private fun BackendChecker.checkCanGenerateCCall(expression: IrCall, isInvoke: Boolean) { val callee = expression.symbol.owner