Deprecate EXPERIMENTAL_IS_NOT_ENABLED diagnostic #KT-47638 Fixed
This commit is contained in:
committed by
teamcityserver
parent
5871f3d663
commit
a92ab1bc86
+6
@@ -34513,6 +34513,12 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/experimental/errors.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("experimentalAfterRelease.kt")
|
||||
public void testExperimentalAfterRelease() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/experimental/experimentalAfterRelease.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("experimentalAnnotationOnConstructorProperty.kt")
|
||||
public void testExperimentalAnnotationOnConstructorProperty() throws Exception {
|
||||
|
||||
+6
@@ -34513,6 +34513,12 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/experimental/errors.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("experimentalAfterRelease.kt")
|
||||
public void testExperimentalAfterRelease() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/experimental/experimentalAfterRelease.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("experimentalAnnotationOnConstructorProperty.kt")
|
||||
public void testExperimentalAnnotationOnConstructorProperty() throws Exception {
|
||||
|
||||
+6
-2
@@ -6,6 +6,7 @@
|
||||
package org.jetbrains.kotlin.fir.analysis.checkers.expression
|
||||
|
||||
import org.jetbrains.kotlin.config.AnalysisFlags
|
||||
import org.jetbrains.kotlin.config.LanguageFeature
|
||||
import org.jetbrains.kotlin.fir.FirSourceElement
|
||||
import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext
|
||||
import org.jetbrains.kotlin.fir.analysis.checkers.extractClassesFromArgument
|
||||
@@ -55,8 +56,11 @@ object FirOptInAnnotationCallChecker : FirAnnotationCallChecker() {
|
||||
context: CheckerContext,
|
||||
reporter: DiagnosticReporter
|
||||
) {
|
||||
val useExperimentalFqNames = context.session.languageVersionSettings.getFlag(AnalysisFlags.useExperimental)
|
||||
if (OptInNames.REQUIRES_OPT_IN_FQ_NAME.asString() !in useExperimentalFqNames) {
|
||||
val languageVersionSettings = context.session.languageVersionSettings
|
||||
val useExperimentalFqNames = languageVersionSettings.getFlag(AnalysisFlags.useExperimental)
|
||||
if (!languageVersionSettings.supportsFeature(LanguageFeature.OptInRelease) &&
|
||||
OptInNames.REQUIRES_OPT_IN_FQ_NAME.asString() !in useExperimentalFqNames
|
||||
) {
|
||||
reporter.reportOn(element, FirErrors.EXPERIMENTAL_IS_NOT_ENABLED, context)
|
||||
}
|
||||
}
|
||||
|
||||
+3
-1
@@ -19,6 +19,7 @@ package org.jetbrains.kotlin.resolve.checkers
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.psi.PsiElement
|
||||
import org.jetbrains.kotlin.config.AnalysisFlags
|
||||
import org.jetbrains.kotlin.config.LanguageFeature
|
||||
import org.jetbrains.kotlin.config.LanguageVersionSettings
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.diagnostics.DiagnosticFactory2
|
||||
@@ -404,7 +405,8 @@ class ExperimentalUsageChecker(project: Project) : CallChecker {
|
||||
|
||||
private fun checkUsageOfKotlinExperimentalOrUseExperimental(element: PsiElement, context: CheckerContext) {
|
||||
val useExperimentalFqNames = context.languageVersionSettings.getFlag(AnalysisFlags.useExperimental)
|
||||
if (REQUIRES_OPT_IN_FQ_NAME.asString() !in useExperimentalFqNames &&
|
||||
if (!context.languageVersionSettings.supportsFeature(LanguageFeature.OptInRelease) &&
|
||||
REQUIRES_OPT_IN_FQ_NAME.asString() !in useExperimentalFqNames &&
|
||||
OLD_EXPERIMENTAL_FQ_NAME.asString() !in useExperimentalFqNames
|
||||
) {
|
||||
context.trace.report(Errors.EXPERIMENTAL_IS_NOT_ENABLED.on(element))
|
||||
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
// FIR_IDENTICAL
|
||||
// !LANGUAGE: +OptInRelease
|
||||
|
||||
@RequiresOptIn
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
annotation class Marker
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
package
|
||||
|
||||
@kotlin.RequiresOptIn @kotlin.annotation.Retention(value = AnnotationRetention.BINARY) public final annotation class Marker : kotlin.Annotation {
|
||||
public constructor Marker()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
Generated
+6
@@ -34609,6 +34609,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/experimental/errors.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("experimentalAfterRelease.kt")
|
||||
public void testExperimentalAfterRelease() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/experimental/experimentalAfterRelease.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("experimentalAnnotationOnConstructorProperty.kt")
|
||||
public void testExperimentalAnnotationOnConstructorProperty() throws Exception {
|
||||
|
||||
@@ -214,6 +214,7 @@ enum class LanguageFeature(
|
||||
SafeCallsAreAlwaysNullable(KOTLIN_1_6),
|
||||
ProhibitSimplificationOfNonTrivialConstBooleanExpressions(KOTLIN_1_6),
|
||||
TypeInferenceOnCallsWithSelfTypes(KOTLIN_1_6),
|
||||
OptInRelease(KOTLIN_1_6),
|
||||
|
||||
// Temporarily disabled, see KT-27084/KT-22379
|
||||
SoundSmartcastFromLoopConditionForLoopAssignedVariables(sinceVersion = null, kind = BUG_FIX),
|
||||
|
||||
+6
@@ -34513,6 +34513,12 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/experimental/errors.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("experimentalAfterRelease.kt")
|
||||
public void testExperimentalAfterRelease() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/experimental/experimentalAfterRelease.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("experimentalAnnotationOnConstructorProperty.kt")
|
||||
public void testExperimentalAnnotationOnConstructorProperty() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user