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 d155204df9c..f4cd6604198 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/state/GenerationState.kt +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/state/GenerationState.kt @@ -320,10 +320,13 @@ class GenerationState private constructor( !configuration.getBoolean(JVMConfigurationKeys.NO_UNIFIED_NULL_CHECKS) val noSourceCodeInNotNullAssertionExceptions: Boolean = - languageVersionSettings.supportsFeature(LanguageFeature.NoSourceCodeInNotNullAssertionExceptions) + (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 + && unifiedNullChecks) + // Never generate source code in assertion exceptions in K2 to make behavior of FIR PSI & FIR light-tree equivalent + // (obtaining source code is not supported in light tree). + || languageVersionSettings.languageVersion.usesK2 val generateSmapCopyToAnnotation: Boolean = !configuration.getBoolean(JVMConfigurationKeys.NO_SOURCE_DEBUG_EXTENSION) val functionsWithInlineClassReturnTypesMangled: Boolean = diff --git a/compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages/field_before.kt b/compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages/field_before.kt index 4701eefd2bd..d2fa56f17ad 100644 --- a/compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages/field_before.kt +++ b/compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages/field_before.kt @@ -1,7 +1,7 @@ // !LANGUAGE: -NoSourceCodeInNotNullAssertionExceptions -// IGNORE_BACKEND_K2_LIGHT_TREE: JVM_IR -// Reason: KT-56760 // TARGET_BACKEND: JVM +// IGNORE_BACKEND_K2: JVM_IR +// FIR status: don't support legacy feature (KT-57570) // FILE: test.kt fun f(x: String) = "Fail 1" diff --git a/compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages/localVariable_before.kt b/compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages/localVariable_before.kt index e62d0192375..75bdfd37833 100644 --- a/compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages/localVariable_before.kt +++ b/compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages/localVariable_before.kt @@ -1,7 +1,7 @@ // !LANGUAGE: -NoSourceCodeInNotNullAssertionExceptions -// IGNORE_BACKEND_K2_LIGHT_TREE: JVM_IR -// Reason: KT-56760 // TARGET_BACKEND: JVM +// IGNORE_BACKEND_K2: JVM_IR +// FIR status: don't support legacy feature (KT-57570) // FILE: test.kt fun f(x: String) = "Fail 1" diff --git a/compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages/simple_before.kt b/compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages/simple_before.kt index cc42333f13a..65cf9ed91a1 100644 --- a/compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages/simple_before.kt +++ b/compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages/simple_before.kt @@ -1,7 +1,7 @@ // !LANGUAGE: -NoSourceCodeInNotNullAssertionExceptions -// IGNORE_BACKEND_K2_LIGHT_TREE: JVM_IR -// Reason: KT-56760 // TARGET_BACKEND: JVM +// IGNORE_BACKEND_K2: JVM_IR +// FIR status: don't support legacy feature (KT-57570) // FILE: test.kt fun f(x: String) = "Fail 1" diff --git a/compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages/staticCall_before.kt b/compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages/staticCall_before.kt index 42ced26a895..66cf3edc7a1 100644 --- a/compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages/staticCall_before.kt +++ b/compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages/staticCall_before.kt @@ -1,7 +1,7 @@ // !LANGUAGE: -NoSourceCodeInNotNullAssertionExceptions -// IGNORE_BACKEND_K2_LIGHT_TREE: JVM_IR -// Reason: KT-56760 // TARGET_BACKEND: JVM +// IGNORE_BACKEND_K2: JVM_IR +// FIR status: don't support legacy feature (KT-57570) // FILE: test.kt fun f(x: String) = "Fail 1" diff --git a/compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages/syntheticProperty_before.kt b/compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages/syntheticProperty_before.kt index 95f31431e6c..20ee247a10d 100644 --- a/compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages/syntheticProperty_before.kt +++ b/compiler/testData/codegen/box/javaInterop/notNullAssertions/expressionAssertionMessages/syntheticProperty_before.kt @@ -1,7 +1,7 @@ // !LANGUAGE: -NoSourceCodeInNotNullAssertionExceptions -// IGNORE_BACKEND_K2_LIGHT_TREE: JVM_IR -// Reason: KT-56760 // TARGET_BACKEND: JVM +// IGNORE_BACKEND_K2: JVM_IR +// FIR status: don't support legacy feature (KT-57570) // FILE: test.kt fun f(x: String) = "Fail 1"