diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/state/GenerationState.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/state/GenerationState.kt index bb364c59ae5..d155204df9c 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/state/GenerationState.kt +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/state/GenerationState.kt @@ -315,16 +315,15 @@ class GenerationState private constructor( val assertionsMode: JVMAssertionsMode = configuration.get(JVMConfigurationKeys.ASSERTIONS_MODE, JVMAssertionsMode.DEFAULT) val isInlineDisabled: Boolean = configuration.getBoolean(CommonConfigurationKeys.DISABLE_INLINE) val useTypeTableInSerializer: Boolean = configuration.getBoolean(JVMConfigurationKeys.USE_TYPE_TABLE) - val unifiedNullChecks: Boolean = ( - languageVersionSettings.apiVersion >= ApiVersion.KOTLIN_1_4 && - !configuration.getBoolean(JVMConfigurationKeys.NO_UNIFIED_NULL_CHECKS) - ).also { - check(it || !languageVersionSettings.supportsFeature(LanguageFeature.NoSourceCodeInNotNullAssertionExceptions)) { - // This assertion is needed because we generate calls to `Intrinsics.checkNotNull` which is only available since 1.4. - "Language feature ${LanguageFeature.NoSourceCodeInNotNullAssertionExceptions.name} is not supported " + - "if -Xno-unified-null-checks is enabled." - } - } + val unifiedNullChecks: Boolean = + languageVersionSettings.apiVersion >= ApiVersion.KOTLIN_1_4 && + !configuration.getBoolean(JVMConfigurationKeys.NO_UNIFIED_NULL_CHECKS) + + val noSourceCodeInNotNullAssertionExceptions: Boolean = + languageVersionSettings.supportsFeature(LanguageFeature.NoSourceCodeInNotNullAssertionExceptions) + // This check is needed because we generate calls to `Intrinsics.checkNotNull` which is only available since 1.4 + // (when unified null checks were introduced). + && unifiedNullChecks val generateSmapCopyToAnnotation: Boolean = !configuration.getBoolean(JVMConfigurationKeys.NO_SOURCE_DEBUG_EXTENSION) val functionsWithInlineClassReturnTypesMangled: Boolean = diff --git a/compiler/ir/backend.jvm/lower/src/org/jetbrains/kotlin/backend/jvm/lower/TypeOperatorLowering.kt b/compiler/ir/backend.jvm/lower/src/org/jetbrains/kotlin/backend/jvm/lower/TypeOperatorLowering.kt index bc5950449c9..78b4615da61 100644 --- a/compiler/ir/backend.jvm/lower/src/org/jetbrains/kotlin/backend/jvm/lower/TypeOperatorLowering.kt +++ b/compiler/ir/backend.jvm/lower/src/org/jetbrains/kotlin/backend/jvm/lower/TypeOperatorLowering.kt @@ -764,7 +764,7 @@ private class TypeOperatorLowering(private val backendContext: JvmBackendContext } private fun IrBuilderWithScope.computeNotNullAssertionText(typeOperatorCall: IrTypeOperatorCall): String? { - if (backendContext.state.languageVersionSettings.supportsFeature(LanguageFeature.NoSourceCodeInNotNullAssertionExceptions)) { + if (backendContext.state.noSourceCodeInNotNullAssertionExceptions) { return when (val argument = typeOperatorCall.argument) { is IrCall -> "${argument.symbol.owner.name.asString()}(...)" is IrGetField -> argument.symbol.owner.name.asString()