JVM: change logic of applying KT-57570 behavior a bit

If `-Xno-unified-null-checks` is specified, do not throw exceptions, but
rather revert to the old behavior, with source code in exception
messages.

Note that `-Xno-unified-null-checks` is a flag which enables behavior of
Kotlin 1.3. It can be removed once we no longer support API version 1.3.
This commit is contained in:
Alexander Udalov
2023-05-22 15:48:04 +02:00
committed by Space Team
parent 5d3fe7547a
commit ad1dfd5cb9
2 changed files with 10 additions and 11 deletions
@@ -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()