diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/JvmRuntimeTypes.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/JvmRuntimeTypes.kt index d099417addf..c5e8272d954 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/JvmRuntimeTypes.kt +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/JvmRuntimeTypes.kt @@ -24,6 +24,8 @@ import org.jetbrains.kotlin.resolve.calls.checkers.isRestrictsSuspensionReceiver import org.jetbrains.kotlin.resolve.descriptorUtil.builtIns import org.jetbrains.kotlin.storage.LockBasedStorageManager import org.jetbrains.kotlin.types.KotlinType +import org.jetbrains.kotlin.utils.KotlinExceptionWithAttachments + class JvmRuntimeTypes( module: ModuleDescriptor, @@ -96,6 +98,14 @@ class JvmRuntimeTypes( else descriptor + if (actualFunctionDescriptor.returnType == null) + throw KotlinExceptionWithAttachments( + "Return type for function description is null. Super type cannot be calculated." + + "initDesc=${descriptor}, actDesc=${actualFunctionDescriptor}, isReleaseCoroutines=${ + languageVersionSettings.supportsFeature(LanguageFeature.ReleaseCoroutines) + }" + ) + val functionType = createFunctionType( descriptor.builtIns, Annotations.EMPTY,