K2: do not support disabling NoSourceCodeInNotNullAssertionExceptions

Disabling of this language feature (see KT-57570) was not supported in
the (default) light tree mode, and after this change it will not be
supported in the PSI mode as well. This makes the behavior more
consistent and allows us to remove the directive
IGNORE_BACKEND_K2_LIGHT_TREE in the future (KT-56757).
This commit is contained in:
Alexander Udalov
2023-06-01 16:22:10 +02:00
committed by Space Team
parent 82a1242f22
commit b8785fbd90
6 changed files with 15 additions and 12 deletions
@@ -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 =
@@ -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"
@@ -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"
@@ -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"
@@ -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"
@@ -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"