fixup! [KLIB] Enhance error message about poisoned KLIBs in KLIB-based compilers
diff --git a/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/diagnostics/KaFirDiagnostics.kt b/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/diagnostics/KaFirDiagnostics.kt
index 53f95b7..f24f1a8 100644
--- a/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/diagnostics/KaFirDiagnostics.kt
+++ b/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/diagnostics/KaFirDiagnostics.kt
@@ -3989,7 +3989,7 @@
     interface PreReleaseClass : KaFirDiagnostic<PsiElement> {
         override val diagnosticClass get() = PreReleaseClass::class
         val presentableString: String
-        val poisonedFeatures: List<String>
+        val poisoningFeatures: List<String>
     }
 
     interface IrWithUnstableAbiCompiledClass : KaFirDiagnostic<PsiElement> {
diff --git a/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/diagnostics/KaFirDiagnosticsImpl.kt b/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/diagnostics/KaFirDiagnosticsImpl.kt
index c61fcfb..29a4a0766 100644
--- a/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/diagnostics/KaFirDiagnosticsImpl.kt
+++ b/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/diagnostics/KaFirDiagnosticsImpl.kt
@@ -4806,7 +4806,7 @@
 
 internal class PreReleaseClassImpl(
     override val presentableString: String,
-    override val poisonedFeatures: List<String>,
+    override val poisoningFeatures: List<String>,
     firDiagnostic: KtPsiDiagnostic,
     token: KaLifetimeToken,
 ) : KaAbstractFirDiagnostic<PsiElement>(firDiagnostic, token), KaFirDiagnostic.PreReleaseClass
diff --git a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/stubBased/deserialization/JvmStubDeserializedBuiltInsContainerSource.kt b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/stubBased/deserialization/JvmStubDeserializedBuiltInsContainerSource.kt
index 50f28f1..9705bdc 100644
--- a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/stubBased/deserialization/JvmStubDeserializedBuiltInsContainerSource.kt
+++ b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/stubBased/deserialization/JvmStubDeserializedBuiltInsContainerSource.kt
@@ -34,7 +34,7 @@
         get() = null
 
     override val preReleaseInfo: PreReleaseInfo
-        get() = PreReleaseInfo(false, listOf())
+        get() = PreReleaseInfo.DEFAULT_VISIBLE
 
     override val abiStability: DeserializedContainerAbiStability
         get() = DeserializedContainerAbiStability.STABLE
diff --git a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/stubBased/deserialization/JvmStubDeserializedContainerSource.kt b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/stubBased/deserialization/JvmStubDeserializedContainerSource.kt
index 5ce798c..88b7c17 100644
--- a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/stubBased/deserialization/JvmStubDeserializedContainerSource.kt
+++ b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/stubBased/deserialization/JvmStubDeserializedContainerSource.kt
@@ -21,7 +21,7 @@
         get() = null
 
     override val preReleaseInfo: PreReleaseInfo
-        get() = PreReleaseInfo(false, listOf())
+        get() = PreReleaseInfo.DEFAULT_VISIBLE
 
     override val abiStability: DeserializedContainerAbiStability
         get() = DeserializedContainerAbiStability.STABLE
diff --git a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/stubBased/deserialization/JvmStubDeserializedFacadeContainerSource.kt b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/stubBased/deserialization/JvmStubDeserializedFacadeContainerSource.kt
index 17ce7b6..0363021 100644
--- a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/stubBased/deserialization/JvmStubDeserializedFacadeContainerSource.kt
+++ b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/stubBased/deserialization/JvmStubDeserializedFacadeContainerSource.kt
@@ -20,7 +20,7 @@
         get() = null
 
     override val preReleaseInfo: PreReleaseInfo
-        get() = PreReleaseInfo(false, listOf())
+        get() = PreReleaseInfo.DEFAULT_VISIBLE
 
     override val abiStability: DeserializedContainerAbiStability
         get() = DeserializedContainerAbiStability.STABLE
diff --git a/compiler/fir/checkers/checkers-component-generator/src/org/jetbrains/kotlin/fir/checkers/generator/diagnostics/FirDiagnosticsList.kt b/compiler/fir/checkers/checkers-component-generator/src/org/jetbrains/kotlin/fir/checkers/generator/diagnostics/FirDiagnosticsList.kt
index dbfd946..2097021 100644
--- a/compiler/fir/checkers/checkers-component-generator/src/org/jetbrains/kotlin/fir/checkers/generator/diagnostics/FirDiagnosticsList.kt
+++ b/compiler/fir/checkers/checkers-component-generator/src/org/jetbrains/kotlin/fir/checkers/generator/diagnostics/FirDiagnosticsList.kt
@@ -2023,7 +2023,7 @@
         }
         val PRE_RELEASE_CLASS by error<PsiElement> {
             parameter<String>("presentableString")
-            parameter<List<String>>("poisonedFeatures")
+            parameter<List<String>>("poisoningFeatures")
         }
         val IR_WITH_UNSTABLE_ABI_COMPILED_CLASS by error<PsiElement> {
             parameter<String>("presentableString")
diff --git a/compiler/fir/checkers/gen/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrors.kt b/compiler/fir/checkers/gen/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrors.kt
index 6e986ad..da202a1 100644
--- a/compiler/fir/checkers/gen/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrors.kt
+++ b/compiler/fir/checkers/gen/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrors.kt
@@ -987,7 +987,6 @@
 
     // Compatibility issues
     val INCOMPATIBLE_CLASS: KtDiagnosticFactory2<String, IncompatibleVersionErrorData<*>> = KtDiagnosticFactory2("INCOMPATIBLE_CLASS", ERROR, SourceElementPositioningStrategies.DEFAULT, PsiElement::class)
-    // TODO: Now poisoning features are forwarded only for FIR, should they be also forwarded for classic frontend in `Errors.java`?
     val PRE_RELEASE_CLASS: KtDiagnosticFactory2<String, List<String>> = KtDiagnosticFactory2("PRE_RELEASE_CLASS", ERROR, SourceElementPositioningStrategies.DEFAULT, PsiElement::class)
     val IR_WITH_UNSTABLE_ABI_COMPILED_CLASS: KtDiagnosticFactory1<String> = KtDiagnosticFactory1("IR_WITH_UNSTABLE_ABI_COMPILED_CLASS", ERROR, SourceElementPositioningStrategies.DEFAULT, PsiElement::class)
 
diff --git a/compiler/fir/entrypoint/src/org/jetbrains/kotlin/fir/session/KlibIcDeserializedContainerSource.kt b/compiler/fir/entrypoint/src/org/jetbrains/kotlin/fir/session/KlibIcDeserializedContainerSource.kt
index 6f5e0f9..a6f8f2c 100644
--- a/compiler/fir/entrypoint/src/org/jetbrains/kotlin/fir/session/KlibIcDeserializedContainerSource.kt
+++ b/compiler/fir/entrypoint/src/org/jetbrains/kotlin/fir/session/KlibIcDeserializedContainerSource.kt
@@ -15,7 +15,7 @@
 class KlibIcDeserializedContainerSource(packageFqName: FqName) : DeserializedContainerSource {
     override val presentableString: String = "Package '$packageFqName'"
     override val incompatibility: IncompatibleVersionErrorData<*>? get() = null
-    override val preReleaseInfo: PreReleaseInfo get() = PreReleaseInfo(false, listOf())
+    override val preReleaseInfo: PreReleaseInfo get() = PreReleaseInfo.DEFAULT_VISIBLE
     override val abiStability: DeserializedContainerAbiStability get() = DeserializedContainerAbiStability.STABLE
     override fun getContainingFile(): SourceFile = SourceFile.NO_SOURCE_FILE
 }
\ No newline at end of file
diff --git a/compiler/fir/fir-jvm/src/org/jetbrains/kotlin/fir/java/deserialization/JvmClassFileBasedSymbolProvider.kt b/compiler/fir/fir-jvm/src/org/jetbrains/kotlin/fir/java/deserialization/JvmClassFileBasedSymbolProvider.kt
index 031e7b5..ce7e44b 100644
--- a/compiler/fir/fir-jvm/src/org/jetbrains/kotlin/fir/java/deserialization/JvmClassFileBasedSymbolProvider.kt
+++ b/compiler/fir/fir-jvm/src/org/jetbrains/kotlin/fir/java/deserialization/JvmClassFileBasedSymbolProvider.kt
@@ -197,7 +197,7 @@
             KotlinJvmBinarySourceElement(
                 kotlinClass,
                 kotlinClass.incompatibility,
-                PreReleaseInfo(kotlinClass.isPreReleaseInvisible, listOf()),
+                PreReleaseInfo(isInvisible = kotlinClass.isPreReleaseInvisible),
                 kotlinClass.abiStability,
             ),
             JavaAwareFlexibleTypeFactory,
diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrDeclarationStorage.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrDeclarationStorage.kt
index 6fff3f1..13e3e1a 100644
--- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrDeclarationStorage.kt
+++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrDeclarationStorage.kt
@@ -289,7 +289,7 @@
         override val facadeClassName: JvmClassName?
     ) : DeserializedContainerSource, FacadeClassSource {
         override val incompatibility get() = null
-        override val preReleaseInfo: PreReleaseInfo get() = PreReleaseInfo(false, listOf())
+        override val preReleaseInfo: PreReleaseInfo get() = PreReleaseInfo.DEFAULT_VISIBLE
         override val abiStability get() = DeserializedContainerAbiStability.STABLE
         override val presentableString get() = className.internalName
 
diff --git a/compiler/ir/backend.jvm/entrypoint/src/org/jetbrains/kotlin/backend/jvm/FacadeClassSourceShimForFragmentCompilation.kt b/compiler/ir/backend.jvm/entrypoint/src/org/jetbrains/kotlin/backend/jvm/FacadeClassSourceShimForFragmentCompilation.kt
index fea391e..f7e6a0c 100644
--- a/compiler/ir/backend.jvm/entrypoint/src/org/jetbrains/kotlin/backend/jvm/FacadeClassSourceShimForFragmentCompilation.kt
+++ b/compiler/ir/backend.jvm/entrypoint/src/org/jetbrains/kotlin/backend/jvm/FacadeClassSourceShimForFragmentCompilation.kt
@@ -26,7 +26,7 @@
     override val incompatibility: IncompatibleVersionErrorData<*>?
         get() = null
     override val preReleaseInfo: PreReleaseInfo
-        get() = PreReleaseInfo(false, listOf())
+        get() = PreReleaseInfo.DEFAULT_VISIBLE
     override val abiStability: DeserializedContainerAbiStability
         get() = DeserializedContainerAbiStability.STABLE
     override val presentableString: String
diff --git a/compiler/testData/compileKotlinAgainstCustomBinaries/releaseCompilerAgainstPreReleaseFeatureJs/output.fir.txt b/compiler/testData/compileKotlinAgainstCustomBinaries/releaseCompilerAgainstPreReleaseFeatureJs/output.fir.txt
index 87fc84b..71510c0 100644
--- a/compiler/testData/compileKotlinAgainstCustomBinaries/releaseCompilerAgainstPreReleaseFeatureJs/output.fir.txt
+++ b/compiler/testData/compileKotlinAgainstCustomBinaries/releaseCompilerAgainstPreReleaseFeatureJs/output.fir.txt
@@ -1,32 +1,32 @@
 error: pre-release declarations were found in dependencies. Please exclude the dependencies with such declarations and recompile with a release compiler, or use '-Xskip-prerelease-check' to suppress errors. Note that in the latter case the compiled declarations will also be marked as pre-release.
-compiler/testData/compileKotlinAgainstCustomBinaries/releaseCompilerAgainstPreReleaseFeatureJs/source.kt:5:16: error: package 'a' was compiled by a pre-release version of Kotlin and cannot be loaded by this version of the compiler. Enabled pre-release features: ExplicitBackingFields
+compiler/testData/compileKotlinAgainstCustomBinaries/releaseCompilerAgainstPreReleaseFeatureJs/source.kt:5:16: error: package 'a' was compiled by a pre-release version of Kotlin and cannot be loaded by this version of the compiler. Enabled pre-release features: <!POISONING_LANGUAGE_FEATURE!>
 fun baz(param: A, nested: A.Nested) {
                ^
-compiler/testData/compileKotlinAgainstCustomBinaries/releaseCompilerAgainstPreReleaseFeatureJs/source.kt:5:27: error: package 'a' was compiled by a pre-release version of Kotlin and cannot be loaded by this version of the compiler. Enabled pre-release features: ExplicitBackingFields
+compiler/testData/compileKotlinAgainstCustomBinaries/releaseCompilerAgainstPreReleaseFeatureJs/source.kt:5:27: error: package 'a' was compiled by a pre-release version of Kotlin and cannot be loaded by this version of the compiler. Enabled pre-release features: <!POISONING_LANGUAGE_FEATURE!>
 fun baz(param: A, nested: A.Nested) {
                           ^^^^^^^^
-compiler/testData/compileKotlinAgainstCustomBinaries/releaseCompilerAgainstPreReleaseFeatureJs/source.kt:6:23: error: package 'a' was compiled by a pre-release version of Kotlin and cannot be loaded by this version of the compiler. Enabled pre-release features: ExplicitBackingFields
+compiler/testData/compileKotlinAgainstCustomBinaries/releaseCompilerAgainstPreReleaseFeatureJs/source.kt:6:23: error: package 'a' was compiled by a pre-release version of Kotlin and cannot be loaded by this version of the compiler. Enabled pre-release features: <!POISONING_LANGUAGE_FEATURE!>
     val constructor = A()
                       ^^^
-compiler/testData/compileKotlinAgainstCustomBinaries/releaseCompilerAgainstPreReleaseFeatureJs/source.kt:7:18: error: package 'a' was compiled by a pre-release version of Kotlin and cannot be loaded by this version of the compiler. Enabled pre-release features: ExplicitBackingFields
+compiler/testData/compileKotlinAgainstCustomBinaries/releaseCompilerAgainstPreReleaseFeatureJs/source.kt:7:18: error: package 'a' was compiled by a pre-release version of Kotlin and cannot be loaded by this version of the compiler. Enabled pre-release features: <!POISONING_LANGUAGE_FEATURE!>
     val nested = A.Nested()
                  ^^^^^^^^^^
-compiler/testData/compileKotlinAgainstCustomBinaries/releaseCompilerAgainstPreReleaseFeatureJs/source.kt:8:22: error: package 'a' was compiled by a pre-release version of Kotlin and cannot be loaded by this version of the compiler. Enabled pre-release features: ExplicitBackingFields
+compiler/testData/compileKotlinAgainstCustomBinaries/releaseCompilerAgainstPreReleaseFeatureJs/source.kt:8:22: error: package 'a' was compiled by a pre-release version of Kotlin and cannot be loaded by this version of the compiler. Enabled pre-release features: <!POISONING_LANGUAGE_FEATURE!>
     val methodCall = param.method()
                      ^^^^^
 compiler/testData/compileKotlinAgainstCustomBinaries/releaseCompilerAgainstPreReleaseFeatureJs/source.kt:8:28: error: unresolved reference 'method'.
     val methodCall = param.method()
                            ^^^^^^
-compiler/testData/compileKotlinAgainstCustomBinaries/releaseCompilerAgainstPreReleaseFeatureJs/source.kt:9:30: error: package 'a' was compiled by a pre-release version of Kotlin and cannot be loaded by this version of the compiler. Enabled pre-release features: ExplicitBackingFields
+compiler/testData/compileKotlinAgainstCustomBinaries/releaseCompilerAgainstPreReleaseFeatureJs/source.kt:9:30: error: package 'a' was compiled by a pre-release version of Kotlin and cannot be loaded by this version of the compiler. Enabled pre-release features: <!POISONING_LANGUAGE_FEATURE!>
     val supertype = object : A() {}
                              ^
-compiler/testData/compileKotlinAgainstCustomBinaries/releaseCompilerAgainstPreReleaseFeatureJs/source.kt:11:13: error: package 'a' was compiled by a pre-release version of Kotlin and cannot be loaded by this version of the compiler. Enabled pre-release features: ExplicitBackingFields
+compiler/testData/compileKotlinAgainstCustomBinaries/releaseCompilerAgainstPreReleaseFeatureJs/source.kt:11:13: error: package 'a' was compiled by a pre-release version of Kotlin and cannot be loaded by this version of the compiler. Enabled pre-release features: <!POISONING_LANGUAGE_FEATURE!>
     val x = foo()
             ^^^^^
-compiler/testData/compileKotlinAgainstCustomBinaries/releaseCompilerAgainstPreReleaseFeatureJs/source.kt:12:13: error: package 'a' was compiled by a pre-release version of Kotlin and cannot be loaded by this version of the compiler. Enabled pre-release features: ExplicitBackingFields
+compiler/testData/compileKotlinAgainstCustomBinaries/releaseCompilerAgainstPreReleaseFeatureJs/source.kt:12:13: error: package 'a' was compiled by a pre-release version of Kotlin and cannot be loaded by this version of the compiler. Enabled pre-release features: <!POISONING_LANGUAGE_FEATURE!>
     val y = bar
             ^^^
-compiler/testData/compileKotlinAgainstCustomBinaries/releaseCompilerAgainstPreReleaseFeatureJs/source.kt:13:5: error: package 'a' was compiled by a pre-release version of Kotlin and cannot be loaded by this version of the compiler. Enabled pre-release features: ExplicitBackingFields
+compiler/testData/compileKotlinAgainstCustomBinaries/releaseCompilerAgainstPreReleaseFeatureJs/source.kt:13:5: error: package 'a' was compiled by a pre-release version of Kotlin and cannot be loaded by this version of the compiler. Enabled pre-release features: <!POISONING_LANGUAGE_FEATURE!>
     bar = 239
     ^^^
 COMPILATION_ERROR
diff --git a/compiler/tests-integration/tests/org/jetbrains/kotlin/jvm/compiler/AbstractCompileKotlinAgainstCustomBinariesTest.kt b/compiler/tests-integration/tests/org/jetbrains/kotlin/jvm/compiler/AbstractCompileKotlinAgainstCustomBinariesTest.kt
index 19316ad..268d162 100644
--- a/compiler/tests-integration/tests/org/jetbrains/kotlin/jvm/compiler/AbstractCompileKotlinAgainstCustomBinariesTest.kt
+++ b/compiler/tests-integration/tests/org/jetbrains/kotlin/jvm/compiler/AbstractCompileKotlinAgainstCustomBinariesTest.kt
@@ -20,7 +20,6 @@
 import org.jetbrains.kotlin.config.KotlinCompilerVersion
 import org.jetbrains.kotlin.config.LanguageFeature
 import org.jetbrains.kotlin.config.LanguageVersion
-import org.jetbrains.kotlin.config.forcesPreReleaseBinariesIfEnabled
 import org.jetbrains.kotlin.incremental.LocalFileKotlinClass
 import org.jetbrains.kotlin.load.java.JvmAnnotationNames
 import org.jetbrains.kotlin.metadata.deserialization.MetadataVersion
@@ -55,6 +54,7 @@
         additionalOptions: List<String>,
         expectedFileName: String?,
         additionalSources: List<String>,
+        sanitizeCompilerOutput: (String) -> String,
     ): Pair<String, ExitCode> {
         val options =
             if (CommonCompilerArguments::languageVersion.cliArgument in additionalOptions) additionalOptions
@@ -66,7 +66,7 @@
         return super.compileKotlin(
             fileName, output, classpath, compiler, options,
             if (expectedFirFile != null && languageVersion.usesK2 && expectedFirFile.exists()) expectedFirFile.name else expectedFileName,
-            additionalSources
+            additionalSources, sanitizeCompilerOutput
         )
     }
 
@@ -131,22 +131,6 @@
         compileKotlin("source.kt", usageDestination, listOf(result), compiler, additionalOptions.toList())
     }
 
-    private fun doTestPoisoningKotlinFeatureJs(
-        libraryName: String,
-        usageDestination: File,
-    ) {
-        val somePoisoningFeature = LanguageFeature.entries.firstOrNull { it.forcesPreReleaseBinariesIfEnabled() } ?: return
-
-        val result = compileJsLibrary(
-            libraryName,
-            additionalOptions = listOf(
-                "-XXLanguage:+$somePoisoningFeature",
-            )
-        ) {}
-
-        compileKotlin("source.kt", usageDestination, listOf(result), K2JSCompiler())
-    }
-
     private fun <T> withPreRelease(block: () -> T): T =
         try {
             System.setProperty(KotlinCompilerVersion.TEST_IS_PRE_RELEASE_SYSTEM_PROPERTY, "true")
@@ -262,11 +246,6 @@
         doTestPreReleaseKotlinLibrary(K2JSCompiler(), "library", File(tmpdir, "usage.js"))
     }
 
-    fun testReleaseCompilerAgainstPreReleaseFeatureJs() {
-        // TODO: Sanitize poisoning feature name for data consistency
-        doTestPoisoningKotlinFeatureJs("library", File(tmpdir, "usage.js"))
-    }
-
     fun testReleaseCompilerAgainstPreReleaseLibrarySkipPrereleaseCheck() {
         doTestPreReleaseKotlinLibrary(K2JVMCompiler(), "library", tmpdir, CommonCompilerArguments::skipPrereleaseCheck.cliArgument)
     }
diff --git a/compiler/tests-integration/tests/org/jetbrains/kotlin/jvm/compiler/AbstractKotlinCompilerIntegrationTest.kt b/compiler/tests-integration/tests/org/jetbrains/kotlin/jvm/compiler/AbstractKotlinCompilerIntegrationTest.kt
index 332dca2..9367af2 100644
--- a/compiler/tests-integration/tests/org/jetbrains/kotlin/jvm/compiler/AbstractKotlinCompilerIntegrationTest.kt
+++ b/compiler/tests-integration/tests/org/jetbrains/kotlin/jvm/compiler/AbstractKotlinCompilerIntegrationTest.kt
@@ -146,6 +146,7 @@
         additionalOptions: List<String> = emptyList(),
         expectedFileName: String? = "output.txt",
         additionalSources: List<String> = emptyList(),
+        sanitizeCompilerOutput: (String) -> String = { it },
     ): Pair<String, ExitCode> {
         val args = mutableListOf<String>()
         val sourceFile = File(testDataDirectory, fileName)
@@ -177,7 +178,7 @@
 
         val result = AbstractCliTest.executeCompilerGrabOutput(compiler, args)
         if (expectedFileName != null) {
-            KotlinTestUtils.assertEqualsToFile(File(testDataDirectory, expectedFileName), normalizeOutput(result))
+            KotlinTestUtils.assertEqualsToFile(File(testDataDirectory, expectedFileName), sanitizeCompilerOutput(normalizeOutput(result)))
         }
         return result
     }
diff --git a/compiler/tests-integration/tests/org/jetbrains/kotlin/jvm/compiler/FirCompileKotlinAgainstCustomBinariesTest.kt b/compiler/tests-integration/tests/org/jetbrains/kotlin/jvm/compiler/FirCompileKotlinAgainstCustomBinariesTest.kt
index e67b4af..8ce4b37 100644
--- a/compiler/tests-integration/tests/org/jetbrains/kotlin/jvm/compiler/FirCompileKotlinAgainstCustomBinariesTest.kt
+++ b/compiler/tests-integration/tests/org/jetbrains/kotlin/jvm/compiler/FirCompileKotlinAgainstCustomBinariesTest.kt
@@ -7,11 +7,14 @@
 
 import org.jetbrains.kotlin.cli.common.arguments.CommonCompilerArguments
 import org.jetbrains.kotlin.cli.common.arguments.cliArgument
+import org.jetbrains.kotlin.cli.js.K2JSCompiler
 import org.jetbrains.kotlin.config.KotlinCompilerVersion
 import org.jetbrains.kotlin.config.LanguageFeature
 import org.jetbrains.kotlin.config.LanguageVersion
+import org.jetbrains.kotlin.config.forcesPreReleaseBinariesIfEnabled
 import org.jetbrains.kotlin.utils.PathUtil
 import org.jetbrains.kotlin.util.toJvmMetadataVersion
+import java.io.File
 import java.util.jar.JarFile
 
 class FirCompileKotlinAgainstCustomBinariesTest : AbstractCompileKotlinAgainstCustomBinariesTest() {
@@ -76,4 +79,22 @@
             KotlinCompilerVersion.isPreRelease()
         )
     }
+
+    fun testReleaseCompilerAgainstPreReleaseFeatureJs() {
+        val arbitraryPoisoningFeature = LanguageFeature.entries.firstOrNull { it.forcesPreReleaseBinariesIfEnabled() } ?: return
+
+        val result = compileJsLibrary(
+            libraryName = "library",
+            additionalOptions = listOf("-XXLanguage:+$arbitraryPoisoningFeature",)
+        ) {}
+
+        compileKotlin(
+            fileName = "source.kt",
+            output = File(tmpdir, "usage.js"),
+            classpath = listOf(result),
+            compiler = K2JSCompiler()
+        ) { compilerOutput ->
+            compilerOutput.replace(arbitraryPoisoningFeature.name, "<!POISONING_LANGUAGE_FEATURE!>")
+        }
+    }
 }
diff --git a/compiler/util-klib-metadata/src/org/jetbrains/kotlin/library/metadata/KlibDeserializedContainerSource.kt b/compiler/util-klib-metadata/src/org/jetbrains/kotlin/library/metadata/KlibDeserializedContainerSource.kt
index eb8f96d..6fdbb13 100644
--- a/compiler/util-klib-metadata/src/org/jetbrains/kotlin/library/metadata/KlibDeserializedContainerSource.kt
+++ b/compiler/util-klib-metadata/src/org/jetbrains/kotlin/library/metadata/KlibDeserializedContainerSource.kt
@@ -31,8 +31,8 @@
         incompatibility: IncompatibleVersionErrorData<*>?,
     ) : this(
         preReleaseInfo = PreReleaseInfo(
-            configuration.reportErrorsOnPreReleaseDependencies && (header.flags and KlibMetadataHeaderFlags.PRE_RELEASE) != 0,
-            klib.manifestProperties.propertyList(KLIB_PROPERTY_MANUALLY_ENABLED_POISONING_LANGUAGE_FEATURES).map { it.trimStart('+') }
+            isInvisible = configuration.reportErrorsOnPreReleaseDependencies && (header.flags and KlibMetadataHeaderFlags.PRE_RELEASE) != 0,
+            poisoningFeatures = klib.manifestProperties.propertyList(KLIB_PROPERTY_MANUALLY_ENABLED_POISONING_LANGUAGE_FEATURES).map { it.trimStart('+') }
         ),
         presentableString = "Package '$packageFqName'",
         klib = klib,
diff --git a/core/compiler.common/src/org/jetbrains/kotlin/serialization/deserialization/descriptors/DeserializedContainerSource.kt b/core/compiler.common/src/org/jetbrains/kotlin/serialization/deserialization/descriptors/DeserializedContainerSource.kt
index 64d072f..a743c2e 100644
--- a/core/compiler.common/src/org/jetbrains/kotlin/serialization/deserialization/descriptors/DeserializedContainerSource.kt
+++ b/core/compiler.common/src/org/jetbrains/kotlin/serialization/deserialization/descriptors/DeserializedContainerSource.kt
@@ -34,7 +34,12 @@
     UNSTABLE,
 }
 
-// True iff this is container is "invisible" because it's loaded from a pre-release class and this compiler is a release.
-// List of manually enabled poisoning features.
-// TODO: Does this way of forwarding poisoningFeatures to errors make sense or should it be done somehow different?
-data class PreReleaseInfo(val isInvisible: Boolean, val poisoningFeatures: List<String>)
+/**
+ * @property isInvisible True if this container is "invisible" because it has a pre-release flag.
+ * @property poisoningFeatures The list of manually enabled language features that caused raising the pre-release flag.
+ */
+data class PreReleaseInfo(val isInvisible: Boolean, val poisoningFeatures: List<String> = emptyList()) {
+    companion object {
+        val DEFAULT_VISIBLE = PreReleaseInfo(isInvisible = false)
+    }
+}
diff --git a/core/descriptors.jvm/src/org/jetbrains/kotlin/load/kotlin/DeserializedDescriptorResolver.kt b/core/descriptors.jvm/src/org/jetbrains/kotlin/load/kotlin/DeserializedDescriptorResolver.kt
index 4e983b1..fec9628 100644
--- a/core/descriptors.jvm/src/org/jetbrains/kotlin/load/kotlin/DeserializedDescriptorResolver.kt
+++ b/core/descriptors.jvm/src/org/jetbrains/kotlin/load/kotlin/DeserializedDescriptorResolver.kt
@@ -46,7 +46,10 @@
             JvmProtoBufUtil.readClassDataFrom(data, strings)
         } ?: return null
         val source = KotlinJvmBinarySourceElement(
-            kotlinClass, kotlinClass.incompatibility, PreReleaseInfo(kotlinClass.isPreReleaseInvisible, listOf()), kotlinClass.abiStability
+            binaryClass = kotlinClass,
+            incompatibility = kotlinClass.incompatibility,
+            preReleaseInfo = PreReleaseInfo(isInvisible = kotlinClass.isPreReleaseInvisible),
+            abiStability = kotlinClass.abiStability
         )
         return ClassData(nameResolver, classProto, kotlinClass.classHeader.metadataVersion, source)
     }
diff --git a/core/deserialization.common.jvm/src/org/jetbrains/kotlin/load/kotlin/JvmPackagePartSource.kt b/core/deserialization.common.jvm/src/org/jetbrains/kotlin/load/kotlin/JvmPackagePartSource.kt
index 0850388..a8bbdb9 100644
--- a/core/deserialization.common.jvm/src/org/jetbrains/kotlin/load/kotlin/JvmPackagePartSource.kt
+++ b/core/deserialization.common.jvm/src/org/jetbrains/kotlin/load/kotlin/JvmPackagePartSource.kt
@@ -26,7 +26,7 @@
     packageProto: ProtoBuf.Package,
     nameResolver: NameResolver,
     override val incompatibility: IncompatibleVersionErrorData<MetadataVersion>? = null,
-    override val preReleaseInfo: PreReleaseInfo = PreReleaseInfo(false, listOf()),
+    override val preReleaseInfo: PreReleaseInfo = PreReleaseInfo.DEFAULT_VISIBLE,
     override val abiStability: DeserializedContainerAbiStability = DeserializedContainerAbiStability.STABLE,
     val knownJvmBinaryClass: KotlinJvmBinaryClass? = null
 ) : DeserializedContainerSource, FacadeClassSource {
@@ -45,7 +45,7 @@
         packageProto,
         nameResolver,
         incompatibility,
-        PreReleaseInfo(isPreReleaseInvisible, listOf()),
+        PreReleaseInfo(isPreReleaseInvisible),
         abiStability,
         kotlinClass
     )
diff --git a/core/deserialization.common.jvm/src/org/jetbrains/kotlin/load/kotlin/KotlinJvmBinarySourceElement.kt b/core/deserialization.common.jvm/src/org/jetbrains/kotlin/load/kotlin/KotlinJvmBinarySourceElement.kt
index 2e609bc..cba7347 100644
--- a/core/deserialization.common.jvm/src/org/jetbrains/kotlin/load/kotlin/KotlinJvmBinarySourceElement.kt
+++ b/core/deserialization.common.jvm/src/org/jetbrains/kotlin/load/kotlin/KotlinJvmBinarySourceElement.kt
@@ -26,7 +26,7 @@
 class KotlinJvmBinarySourceElement(
     val binaryClass: KotlinJvmBinaryClass,
     override val incompatibility: IncompatibleVersionErrorData<MetadataVersion>? = null,
-    override val preReleaseInfo: PreReleaseInfo = PreReleaseInfo(false, listOf()),
+    override val preReleaseInfo: PreReleaseInfo = PreReleaseInfo.DEFAULT_VISIBLE,
     override val abiStability: DeserializedContainerAbiStability = DeserializedContainerAbiStability.STABLE,
 ) : DeserializedContainerSource {
     override val presentableString: String
diff --git a/js/js.serializer/src/org/jetbrains/kotlin/serialization/js/KotlinJavascriptPackageFragment.kt b/js/js.serializer/src/org/jetbrains/kotlin/serialization/js/KotlinJavascriptPackageFragment.kt
index 97b193d..6c7bd21 100644
--- a/js/js.serializer/src/org/jetbrains/kotlin/serialization/js/KotlinJavascriptPackageFragment.kt
+++ b/js/js.serializer/src/org/jetbrains/kotlin/serialization/js/KotlinJavascriptPackageFragment.kt
@@ -94,7 +94,7 @@
             get() = null
 
         override val preReleaseInfo: PreReleaseInfo =
-            PreReleaseInfo(configuration.reportErrorsOnPreReleaseDependencies && (header.flags and 1) != 0, listOf())
+            PreReleaseInfo(isInvisible = configuration.reportErrorsOnPreReleaseDependencies && (header.flags and 1) != 0)
 
         override val abiStability: DeserializedContainerAbiStability
             get() = DeserializedContainerAbiStability.STABLE
diff --git a/native/native.tests/klib-ir-inliner/tests/org/jetbrains/kotlin/konan/test/inlining/AbstractNativeUnboundIrSerializationTest.kt b/native/native.tests/klib-ir-inliner/tests/org/jetbrains/kotlin/konan/test/inlining/AbstractNativeUnboundIrSerializationTest.kt
index 1f6da24..a89561b 100644
--- a/native/native.tests/klib-ir-inliner/tests/org/jetbrains/kotlin/konan/test/inlining/AbstractNativeUnboundIrSerializationTest.kt
+++ b/native/native.tests/klib-ir-inliner/tests/org/jetbrains/kotlin/konan/test/inlining/AbstractNativeUnboundIrSerializationTest.kt
@@ -158,7 +158,7 @@
         for (functionUnderTest in functionsUnderTest) {
             // Make a copy of the original (fully linked) function but without the body to emulate Fir2IrLazy function.
             val deserializedContainerSource = KlibDeserializedContainerSource(
-                preReleaseInfo = PreReleaseInfo(false, listOf()),
+                preReleaseInfo = PreReleaseInfo.DEFAULT_VISIBLE,
                 presentableString = "Emulation of lazy IR inline function ${functionUnderTest.fullyLinkedIrFunction.render()} from ${library.libraryFile.absolutePath}",
                 klib = library,
                 incompatibility = null,
diff --git a/native/native.tests/testData/compilerOutput/releaseCompilerAgainstPreReleaseFeature/output.fir.txt b/native/native.tests/testData/compilerOutput/releaseCompilerAgainstPreReleaseFeature/output.fir.txt
index 9a13ba9..55dc0d7 100644
--- a/native/native.tests/testData/compilerOutput/releaseCompilerAgainstPreReleaseFeature/output.fir.txt
+++ b/native/native.tests/testData/compilerOutput/releaseCompilerAgainstPreReleaseFeature/output.fir.txt
@@ -1,32 +1,32 @@
 error: pre-release declarations were found in dependencies. Please exclude the dependencies with such declarations and recompile with a release compiler, or use '-Xskip-prerelease-check' to suppress errors. Note that in the latter case the compiled declarations will also be marked as pre-release.
-$TESTDATA_DIR$/releaseCompilerAgainstPreReleaseFeature/source.kt:5:16: error: package 'a' was compiled by a pre-release version of Kotlin and cannot be loaded by this version of the compiler. Enabled pre-release features: ExplicitBackingFields
+$TESTDATA_DIR$/releaseCompilerAgainstPreReleaseFeature/source.kt:5:16: error: package 'a' was compiled by a pre-release version of Kotlin and cannot be loaded by this version of the compiler. Enabled pre-release features: <!POISONING_LANGUAGE_FEATURE!>
 fun baz(param: A, nested: A.Nested) {
                ^
-$TESTDATA_DIR$/releaseCompilerAgainstPreReleaseFeature/source.kt:5:27: error: package 'a' was compiled by a pre-release version of Kotlin and cannot be loaded by this version of the compiler. Enabled pre-release features: ExplicitBackingFields
+$TESTDATA_DIR$/releaseCompilerAgainstPreReleaseFeature/source.kt:5:27: error: package 'a' was compiled by a pre-release version of Kotlin and cannot be loaded by this version of the compiler. Enabled pre-release features: <!POISONING_LANGUAGE_FEATURE!>
 fun baz(param: A, nested: A.Nested) {
                           ^^^^^^^^
-$TESTDATA_DIR$/releaseCompilerAgainstPreReleaseFeature/source.kt:6:23: error: package 'a' was compiled by a pre-release version of Kotlin and cannot be loaded by this version of the compiler. Enabled pre-release features: ExplicitBackingFields
+$TESTDATA_DIR$/releaseCompilerAgainstPreReleaseFeature/source.kt:6:23: error: package 'a' was compiled by a pre-release version of Kotlin and cannot be loaded by this version of the compiler. Enabled pre-release features: <!POISONING_LANGUAGE_FEATURE!>
     val constructor = A()
                       ^^^
-$TESTDATA_DIR$/releaseCompilerAgainstPreReleaseFeature/source.kt:7:18: error: package 'a' was compiled by a pre-release version of Kotlin and cannot be loaded by this version of the compiler. Enabled pre-release features: ExplicitBackingFields
+$TESTDATA_DIR$/releaseCompilerAgainstPreReleaseFeature/source.kt:7:18: error: package 'a' was compiled by a pre-release version of Kotlin and cannot be loaded by this version of the compiler. Enabled pre-release features: <!POISONING_LANGUAGE_FEATURE!>
     val nested = A.Nested()
                  ^^^^^^^^^^
-$TESTDATA_DIR$/releaseCompilerAgainstPreReleaseFeature/source.kt:8:22: error: package 'a' was compiled by a pre-release version of Kotlin and cannot be loaded by this version of the compiler. Enabled pre-release features: ExplicitBackingFields
+$TESTDATA_DIR$/releaseCompilerAgainstPreReleaseFeature/source.kt:8:22: error: package 'a' was compiled by a pre-release version of Kotlin and cannot be loaded by this version of the compiler. Enabled pre-release features: <!POISONING_LANGUAGE_FEATURE!>
     val methodCall = param.method()
                      ^^^^^
 $TESTDATA_DIR$/releaseCompilerAgainstPreReleaseFeature/source.kt:8:28: error: unresolved reference 'method'.
     val methodCall = param.method()
                            ^^^^^^
-$TESTDATA_DIR$/releaseCompilerAgainstPreReleaseFeature/source.kt:9:30: error: package 'a' was compiled by a pre-release version of Kotlin and cannot be loaded by this version of the compiler. Enabled pre-release features: ExplicitBackingFields
+$TESTDATA_DIR$/releaseCompilerAgainstPreReleaseFeature/source.kt:9:30: error: package 'a' was compiled by a pre-release version of Kotlin and cannot be loaded by this version of the compiler. Enabled pre-release features: <!POISONING_LANGUAGE_FEATURE!>
     val supertype = object : A() {}
                              ^
-$TESTDATA_DIR$/releaseCompilerAgainstPreReleaseFeature/source.kt:11:13: error: package 'a' was compiled by a pre-release version of Kotlin and cannot be loaded by this version of the compiler. Enabled pre-release features: ExplicitBackingFields
+$TESTDATA_DIR$/releaseCompilerAgainstPreReleaseFeature/source.kt:11:13: error: package 'a' was compiled by a pre-release version of Kotlin and cannot be loaded by this version of the compiler. Enabled pre-release features: <!POISONING_LANGUAGE_FEATURE!>
     val x = foo()
             ^^^^^
-$TESTDATA_DIR$/releaseCompilerAgainstPreReleaseFeature/source.kt:12:13: error: package 'a' was compiled by a pre-release version of Kotlin and cannot be loaded by this version of the compiler. Enabled pre-release features: ExplicitBackingFields
+$TESTDATA_DIR$/releaseCompilerAgainstPreReleaseFeature/source.kt:12:13: error: package 'a' was compiled by a pre-release version of Kotlin and cannot be loaded by this version of the compiler. Enabled pre-release features: <!POISONING_LANGUAGE_FEATURE!>
     val y = bar
             ^^^
-$TESTDATA_DIR$/releaseCompilerAgainstPreReleaseFeature/source.kt:13:5: error: package 'a' was compiled by a pre-release version of Kotlin and cannot be loaded by this version of the compiler. Enabled pre-release features: ExplicitBackingFields
+$TESTDATA_DIR$/releaseCompilerAgainstPreReleaseFeature/source.kt:13:5: error: package 'a' was compiled by a pre-release version of Kotlin and cannot be loaded by this version of the compiler. Enabled pre-release features: <!POISONING_LANGUAGE_FEATURE!>
     bar = 239
     ^^^
 COMPILATION_ERROR
diff --git a/native/native.tests/tests/org/jetbrains/kotlin/konan/test/blackbox/CompilerOutputTest.kt b/native/native.tests/tests/org/jetbrains/kotlin/konan/test/blackbox/CompilerOutputTest.kt
index 2eddfcb..87739fa 100644
--- a/native/native.tests/tests/org/jetbrains/kotlin/konan/test/blackbox/CompilerOutputTest.kt
+++ b/native/native.tests/tests/org/jetbrains/kotlin/konan/test/blackbox/CompilerOutputTest.kt
@@ -36,15 +36,7 @@
     fun testReleaseCompilerAgainstPreReleaseLibrary() {
         val rootDir = File("native/native.tests/testData/compilerOutput/releaseCompilerAgainstPreReleaseLibrary")
 
-        doTestPreReleaseKotlinLibrary(rootDir, emptyList())
-    }
-
-    @Test
-    fun testReleaseCompilerAgainstPreReleaseFeature() {
-        val rootDir = File("native/native.tests/testData/compilerOutput/releaseCompilerAgainstPreReleaseFeature")
-
-        // TODO: Sanitize poisoning feature name for data consistency
-        doTestPoisoningKotlinFeature(rootDir, emptyList())
+        doTestPreReleaseKotlinLibrary(rootDir)
     }
 
     @Test
@@ -56,27 +48,26 @@
             File("compiler/testData/compileKotlinAgainstCustomBinaries/releaseCompilerAgainstPreReleaseLibraryJsSkipPrereleaseCheck")
 
         doTestPreReleaseKotlinLibrary(
-            rootDir,
-            listOf("-Xskip-prerelease-check", "-Xsuppress-version-warnings")
+            rootDir = rootDir,
+            additionalOptions = listOf("-Xskip-prerelease-check", "-Xsuppress-version-warnings")
         )
     }
 
-    private fun doTestPreReleaseKotlinLibrary(rootDir: File, additionalOptions: List<String>) {
+    private fun doTestPreReleaseKotlinLibrary(rootDir: File, additionalOptions: List<String> = emptyList()) {
         val someNonStableVersion = LanguageVersion.entries.firstOrNull { it > LanguageVersion.LATEST_STABLE } ?: return
         doTestPreReleaseKotlin(
-            rootDir,
-            listOf("-language-version", someNonStableVersion.versionString, "-Xsuppress-version-warnings"),
-            additionalOptions
+            rootDir = rootDir,
+            libraryOptions = listOf("-language-version", someNonStableVersion.versionString, "-Xsuppress-version-warnings"),
+            additionalOptions = additionalOptions
         )
     }
 
-    private fun doTestPoisoningKotlinFeature(rootDir: File, additionalOptions: List<String>) {
-        val somePoisoningFeature = LanguageFeature.entries.firstOrNull { it.forcesPreReleaseBinariesIfEnabled() } ?: return
-        doTestPreReleaseKotlin(rootDir, listOf("-XXLanguage:+$somePoisoningFeature"), additionalOptions)
-    }
-
-
-    private fun doTestPreReleaseKotlin(rootDir: File, libraryOptions: List<String>, additionalOptions: List<String>) {
+    protected fun doTestPreReleaseKotlin(
+        rootDir: File,
+        libraryOptions: List<String>,
+        additionalOptions: List<String> = emptyList(),
+        sanitizeCompilerOutput: (String) -> String = { it },
+    ) {
         val library = compileLibrary(
             settings = object : Settings(testRunSettings, listOf(PipelineType.DEFAULT)) {},
             source = rootDir.resolve("library"),
@@ -99,7 +90,7 @@
             PipelineType.DEFAULT -> rootDir.resolve("output.fir.txt").takeIf { it.exists() && LanguageVersion.LATEST_STABLE.usesK2 } ?: rootDir.resolve("output.txt")
         }
 
-        KotlinTestUtils.assertEqualsToFile(goldenData, compilationResult.toOutput())
+        KotlinTestUtils.assertEqualsToFile(goldenData, sanitizeCompilerOutput(compilationResult.toOutput()))
     }
 
     @Test
@@ -295,10 +286,23 @@
 @EnforcedProperty(ClassLevelProperty.COMPILER_OUTPUT_INTERCEPTOR, "NONE")
 class ClassicCompilerOutputTest : CompilerOutputTestBase()
 
-@Suppress("JUnitTestCaseWithNoTests")
 @TestDataPath("\$PROJECT_ROOT")
 @EnforcedProperty(ClassLevelProperty.COMPILER_OUTPUT_INTERCEPTOR, "NONE")
-class FirCompilerOutputTest : CompilerOutputTestBase()
+class FirCompilerOutputTest : CompilerOutputTestBase() {
+    @Test
+    fun testReleaseCompilerAgainstPreReleaseFeature() {
+        val rootDir = File("native/native.tests/testData/compilerOutput/releaseCompilerAgainstPreReleaseFeature")
+
+        val arbitraryPoisoningFeature = LanguageFeature.entries.firstOrNull { it.forcesPreReleaseBinariesIfEnabled() } ?: return
+
+        doTestPreReleaseKotlin(
+            rootDir = rootDir,
+            libraryOptions = listOf("-XXLanguage:+$arbitraryPoisoningFeature")
+        ) { compilerOutput ->
+            compilerOutput.replace(arbitraryPoisoningFeature.name, "<!POISONING_LANGUAGE_FEATURE!>")
+        }
+    }
+}
 
 internal fun TestCompilationResult<*>.toOutput(): String {
     check(this is TestCompilationResult.ImmediateResult<*>) { this }