From 7742a3b6970191aeb7f29be35269f4a8b92b5c67 Mon Sep 17 00:00:00 2001 From: Alexander Udalov Date: Wed, 18 Dec 2019 20:03:42 +0100 Subject: [PATCH] Rename UseExperimental->OptIn, Experimental->RequiresOptIn in compiler tests --- ...lAndUseExperimentalWithSameAnnotation.args | 4 +-- ...talAndUseExperimentalWithSameAnnotation.kt | 2 +- .../cli/jvm/experimentalDeprecated.args | 6 ++-- .../cli/jvm/experimentalDeprecated.kt | 8 ++--- .../jvm/experimentalDeprecatedWarning.args | 4 +-- .../cli/jvm/experimentalDeprecatedWarning.kt | 4 +-- .../cli/jvm/experimentalIsNotAnnotation.args | 2 +- .../cli/jvm/experimentalIsNotMarker.args | 2 +- .../testData/cli/jvm/experimentalNested.args | 2 +- .../testData/cli/jvm/experimentalNested.kt | 2 +- .../cli/jvm/experimentalUnresolved.args | 4 +-- .../coroutines/asyncIteratorNullMerge_1_3.kt | 2 +- .../box/coroutines/asyncIteratorToList_1_3.kt | 2 +- .../box/coroutines/asyncIterator_1_3.kt | 2 +- ...uilderInferenceAndGenericArrayAcessCall.kt | 2 +- .../codegen/box/coroutines/kt30858.kt | 2 +- .../codegen/box/coroutines/kt31784.kt | 2 +- .../codegen/box/inference/builderInference.kt | 2 +- .../debug/localVariableCorrectLabel.kt | 2 +- .../callableReferenceToASuspendFunction.kt | 2 +- .../chainCallWithExtensionExplicitTypes.kt | 4 +-- .../chainCallWithExtensionExplicitTypes.txt | 2 +- ...outineInferenceWithCapturedTypeVariable.kt | 4 +-- ...utineInferenceWithCapturedTypeVariable.txt | 2 +- .../coroutines/inference/correctMember.kt | 4 +-- .../coroutines/inference/extensionPriority.kt | 4 +-- .../coroutines/inference/extensionSuspend.kt | 4 +-- .../extensionWithNonValuableConstraints.kt | 4 +-- ...nsWithNonValuableConstraintsGenericBase.kt | 4 +-- .../coroutines/inference/incorrectCalls.kt | 4 +-- .../inferenceFromMethodInsideLocalVariable.kt | 4 +-- ...inferenceFromMethodInsideLocalVariable.txt | 2 +- .../inference/recursiveGenerators.kt | 4 +-- .../inference/recursiveGenerators2.kt | 4 +-- .../inference/returnTypeInference2.kt | 4 +-- ...everalCandidatesWithDifferentVisibility.kt | 4 +-- .../coroutines/inference/simpleGenerator.kt | 4 +-- .../inference/suspendCallsWithErrors.kt | 4 +-- .../inference/twoReceiversInScope.kt | 4 +-- .../coroutines/inference/typeFromReceiver.kt | 4 +-- .../variableCallInsideBuilderFunction.kt | 4 +-- .../variableCallInsideBuilderFunction.txt | 2 +- .../inference/variableOfAFunctionTypeCall.kt | 4 +-- .../inference/variableOfAFunctionTypeCall.txt | 2 +- .../coroutines/inference/withParameter.kt | 4 +-- .../testsWithStdLib/coroutines/kt28658.kt | 4 +-- .../testsWithStdLib/coroutines/kt28658.txt | 2 +- .../restrictSuspension/outerYield_1_3.kt | 4 +-- .../experimental/annotation.fir.kt | 28 ++++++++--------- .../experimental/annotation.kt | 28 ++++++++--------- .../experimental/annotation.txt | 24 +++++++-------- .../experimental/bodyUsages.fir.kt | 10 +++---- .../experimental/bodyUsages.kt | 10 +++---- .../experimental/bodyUsages.txt | 8 ++--- .../experimental/bodyUsagesAndInline.fir.kt | 4 +-- .../experimental/bodyUsagesAndInline.kt | 4 +-- .../experimental/bodyUsagesAndInline.txt | 2 +- .../experimental/classMembers.fir.kt | 8 ++--- .../experimental/classMembers.kt | 8 ++--- .../experimental/classMembers.txt | 6 ++-- .../classMembersOverlyExperimental.fir.kt | 4 +-- .../classMembersOverlyExperimental.kt | 4 +-- .../classMembersOverlyExperimental.txt | 2 +- .../experimental/constVal.fir.kt | 6 ++-- .../testsWithStdLib/experimental/constVal.kt | 6 ++-- .../testsWithStdLib/experimental/constVal.txt | 2 +- .../experimental/deeplyNestedClass.fir.kt | 8 ++--- .../experimental/deeplyNestedClass.kt | 8 ++--- .../experimental/deeplyNestedClass.txt | 6 ++-- .../experimental/errors.fir.kt | 4 +-- .../testsWithStdLib/experimental/errors.kt | 4 +-- .../testsWithStdLib/experimental/errors.txt | 2 +- .../experimentalIsNotEnabled.fir.kt | 4 +-- .../experimental/experimentalIsNotEnabled.kt | 4 +-- .../experimental/experimentalIsNotEnabled.txt | 4 +-- .../experimentalOnWholeModule.fir.kt | 4 +-- .../experimental/experimentalOnWholeModule.kt | 4 +-- .../experimentalOnWholeModule.txt | 2 +- .../experimentalUnsignedLiterals.fir.kt | 4 +-- .../experimentalUnsignedLiterals.kt | 4 +-- .../experimental/fullFqNameUsage.fir.kt | 6 ++-- .../experimental/fullFqNameUsage.kt | 6 ++-- .../experimental/fullFqNameUsage.txt | 4 +-- .../experimental/importStatement.fir.kt | 4 +-- .../experimental/importStatement.kt | 4 +-- .../experimental/importStatement.txt | 2 +- ...ectTargetsForExperimentalAnnotation.fir.kt | 10 +++---- ...correctTargetsForExperimentalAnnotation.kt | 10 +++---- ...orrectTargetsForExperimentalAnnotation.txt | 8 ++--- .../incorrectUseExperimental.fir.kt | 6 ++-- .../experimental/incorrectUseExperimental.kt | 6 ++-- .../experimental/incorrectUseExperimental.txt | 4 +-- .../experimental/override.fir.kt | 4 +-- .../testsWithStdLib/experimental/override.kt | 4 +-- .../testsWithStdLib/experimental/override.txt | 2 +- .../overrideDifferentExperimentalities.fir.kt | 6 ++-- .../overrideDifferentExperimentalities.kt | 6 ++-- .../overrideDifferentExperimentalities.txt | 4 +-- .../testsWithStdLib/experimental/scripts.kts | 6 ++-- .../testsWithStdLib/experimental/scripts.txt | 2 +- .../experimental/topLevel.fir.kt | 8 ++--- .../testsWithStdLib/experimental/topLevel.kt | 8 ++--- .../testsWithStdLib/experimental/topLevel.txt | 4 +-- .../experimental/typealias.fir.kt | 4 +-- .../testsWithStdLib/experimental/typealias.kt | 4 +-- .../experimental/typealias.txt | 2 +- .../experimental/usageNotAsAnnotation.fir.kt | 30 +++++++++---------- .../experimental/usageNotAsAnnotation.kt | 30 +++++++++---------- .../experimental/usageNotAsAnnotation.txt | 18 +++++------ .../experimental/useExperimentalOnFile.fir.kt | 8 ++--- .../experimental/useExperimentalOnFile.kt | 8 ++--- .../experimental/useExperimentalOnFile.txt | 4 +-- ...talOnFileWithVeryExperimentalMarker.fir.kt | 8 ++--- ...imentalOnFileWithVeryExperimentalMarker.kt | 8 ++--- ...mentalOnFileWithVeryExperimentalMarker.txt | 4 +-- .../useExperimentalOnWholeModule.fir.kt | 4 +-- .../useExperimentalOnWholeModule.kt | 4 +-- .../useExperimentalOnWholeModule.txt | 2 +- .../useExperimentalTargets.fir.kt | 24 +++++++-------- .../experimental/useExperimentalTargets.kt | 24 +++++++-------- .../experimental/useExperimentalTargets.txt | 16 +++++----- ...eExperimentalWithSeveralAnnotations.fir.kt | 16 +++++----- .../useExperimentalWithSeveralAnnotations.kt | 16 +++++----- .../useExperimentalWithSeveralAnnotations.txt | 12 ++++---- .../experimental/wasExperimental.fir.kt | 18 +++++------ .../experimental/wasExperimental.kt | 18 +++++------ .../experimental/wasExperimental.txt | 14 ++++----- .../testsWithStdLib/regression/kt34391.fir.kt | 2 +- .../testsWithStdLib/regression/kt34391.kt | 2 +- .../testsWithStdLib/regression/kt34391.txt | 2 +- .../jsExperimentalModule/lib/lib.kt | 2 +- .../jvmExperimentalModule/lib/lib.kt | 2 +- .../moduleProtoBuf/experimental/main.kt | 6 ++-- .../optionalExpectation/common.kt | 2 +- .../optionalExpectationIncorrectUse/common.kt | 2 +- .../kotlin/codegen/JvmModuleProtoBufTest.kt | 4 +-- .../compiler/ExperimentalIntegrationTest.kt | 4 +-- 137 files changed, 416 insertions(+), 416 deletions(-) diff --git a/compiler/testData/cli/jvm/experimentalAndUseExperimentalWithSameAnnotation.args b/compiler/testData/cli/jvm/experimentalAndUseExperimentalWithSameAnnotation.args index d54ee0e360c..f613672c9c4 100644 --- a/compiler/testData/cli/jvm/experimentalAndUseExperimentalWithSameAnnotation.args +++ b/compiler/testData/cli/jvm/experimentalAndUseExperimentalWithSameAnnotation.args @@ -1,6 +1,6 @@ $TESTDATA_DIR$/experimentalAndUseExperimentalWithSameAnnotation.kt -d $TEMP_DIR$ --Xuse-experimental=kotlin.Experimental +-Xopt-in=kotlin.RequiresOptIn -Xexperimental=org.test.ExperimentalAPI --Xuse-experimental=org.test.ExperimentalAPI +-Xopt-in=org.test.ExperimentalAPI diff --git a/compiler/testData/cli/jvm/experimentalAndUseExperimentalWithSameAnnotation.kt b/compiler/testData/cli/jvm/experimentalAndUseExperimentalWithSameAnnotation.kt index 652dc8678a1..3ccd144f895 100644 --- a/compiler/testData/cli/jvm/experimentalAndUseExperimentalWithSameAnnotation.kt +++ b/compiler/testData/cli/jvm/experimentalAndUseExperimentalWithSameAnnotation.kt @@ -1,4 +1,4 @@ package org.test -@Experimental +@RequiresOptIn annotation class ExperimentalAPI diff --git a/compiler/testData/cli/jvm/experimentalDeprecated.args b/compiler/testData/cli/jvm/experimentalDeprecated.args index 733cfeea9f6..403c209f09a 100644 --- a/compiler/testData/cli/jvm/experimentalDeprecated.args +++ b/compiler/testData/cli/jvm/experimentalDeprecated.args @@ -1,8 +1,8 @@ $TESTDATA_DIR$/experimentalDeprecated.kt -d $TEMP_DIR$ --Xuse-experimental=kotlin.Experimental +-Xopt-in=kotlin.RequiresOptIn -Xexperimental=org.test.Error1 -Xexperimental=org.test.Hidden1 --Xuse-experimental=org.test.Error2 --Xuse-experimental=org.test.Hidden2 +-Xopt-in=org.test.Error2 +-Xopt-in=org.test.Hidden2 diff --git a/compiler/testData/cli/jvm/experimentalDeprecated.kt b/compiler/testData/cli/jvm/experimentalDeprecated.kt index e29c9c463a2..54b17ff1142 100644 --- a/compiler/testData/cli/jvm/experimentalDeprecated.kt +++ b/compiler/testData/cli/jvm/experimentalDeprecated.kt @@ -1,17 +1,17 @@ package org.test @Deprecated("Error1", level = DeprecationLevel.ERROR) -@Experimental +@RequiresOptIn annotation class Error1 @Deprecated("Error2", level = DeprecationLevel.ERROR) -@Experimental +@RequiresOptIn annotation class Error2 @Deprecated("Hidden1", level = DeprecationLevel.HIDDEN) -@Experimental +@RequiresOptIn annotation class Hidden1 @Deprecated("Hidden2", level = DeprecationLevel.HIDDEN) -@Experimental +@RequiresOptIn annotation class Hidden2 diff --git a/compiler/testData/cli/jvm/experimentalDeprecatedWarning.args b/compiler/testData/cli/jvm/experimentalDeprecatedWarning.args index 8cece954a32..a20c699fb90 100644 --- a/compiler/testData/cli/jvm/experimentalDeprecatedWarning.args +++ b/compiler/testData/cli/jvm/experimentalDeprecatedWarning.args @@ -1,6 +1,6 @@ $TESTDATA_DIR$/experimentalDeprecatedWarning.kt -d $TEMP_DIR$ --Xuse-experimental=kotlin.Experimental --Xuse-experimental=org.test.Warning1 +-Xopt-in=kotlin.RequiresOptIn +-Xopt-in=org.test.Warning1 -Xexperimental=org.test.Warning2 diff --git a/compiler/testData/cli/jvm/experimentalDeprecatedWarning.kt b/compiler/testData/cli/jvm/experimentalDeprecatedWarning.kt index 88bf0c946f1..dd37cdcd25c 100644 --- a/compiler/testData/cli/jvm/experimentalDeprecatedWarning.kt +++ b/compiler/testData/cli/jvm/experimentalDeprecatedWarning.kt @@ -1,9 +1,9 @@ package org.test @Deprecated("Warning1", level = DeprecationLevel.WARNING) -@Experimental +@RequiresOptIn annotation class Warning1 @Deprecated("Warning2", level = DeprecationLevel.WARNING) -@Experimental +@RequiresOptIn annotation class Warning2 diff --git a/compiler/testData/cli/jvm/experimentalIsNotAnnotation.args b/compiler/testData/cli/jvm/experimentalIsNotAnnotation.args index 2188937e234..0402de43742 100644 --- a/compiler/testData/cli/jvm/experimentalIsNotAnnotation.args +++ b/compiler/testData/cli/jvm/experimentalIsNotAnnotation.args @@ -2,4 +2,4 @@ $TESTDATA_DIR$/experimentalIsNotAnnotation.kt -d $TEMP_DIR$ -Xexperimental=org.test.NotAnAnnotation1 --Xuse-experimental=org.test.NotAnAnnotation2 +-Xopt-in=org.test.NotAnAnnotation2 diff --git a/compiler/testData/cli/jvm/experimentalIsNotMarker.args b/compiler/testData/cli/jvm/experimentalIsNotMarker.args index cea647058b2..e87a4c10781 100644 --- a/compiler/testData/cli/jvm/experimentalIsNotMarker.args +++ b/compiler/testData/cli/jvm/experimentalIsNotMarker.args @@ -2,4 +2,4 @@ $TESTDATA_DIR$/experimentalIsNotMarker.kt -d $TEMP_DIR$ -Xexperimental=org.test.NotAMarker1 --Xuse-experimental=org.test.NotAMarker2 +-Xopt-in=org.test.NotAMarker2 diff --git a/compiler/testData/cli/jvm/experimentalNested.args b/compiler/testData/cli/jvm/experimentalNested.args index 649751ca75e..38403dab00e 100644 --- a/compiler/testData/cli/jvm/experimentalNested.args +++ b/compiler/testData/cli/jvm/experimentalNested.args @@ -1,5 +1,5 @@ $TESTDATA_DIR$/experimentalNested.kt -d $TEMP_DIR$ --Xuse-experimental=kotlin.Experimental +-Xopt-in=kotlin.RequiresOptIn -Xexperimental=org.test.Outer.Nested diff --git a/compiler/testData/cli/jvm/experimentalNested.kt b/compiler/testData/cli/jvm/experimentalNested.kt index d577cb31f28..86f162043c7 100644 --- a/compiler/testData/cli/jvm/experimentalNested.kt +++ b/compiler/testData/cli/jvm/experimentalNested.kt @@ -1,7 +1,7 @@ package org.test class Outer { - @Experimental + @RequiresOptIn annotation class Nested } diff --git a/compiler/testData/cli/jvm/experimentalUnresolved.args b/compiler/testData/cli/jvm/experimentalUnresolved.args index b164e2b3c85..6738efe980c 100644 --- a/compiler/testData/cli/jvm/experimentalUnresolved.args +++ b/compiler/testData/cli/jvm/experimentalUnresolved.args @@ -1,6 +1,6 @@ $TESTDATA_DIR$/experimentalUnresolved.kt -d $TEMP_DIR$ --Xuse-experimental=org.test.Unresolved1 +-Xopt-in=org.test.Unresolved1 -Xexperimental=org.test.Unresolved2 --Xuse-experimental=org.test.Unresolved3 +-Xopt-in=org.test.Unresolved3 diff --git a/compiler/testData/codegen/box/coroutines/asyncIteratorNullMerge_1_3.kt b/compiler/testData/codegen/box/coroutines/asyncIteratorNullMerge_1_3.kt index 9b90d7673bf..e0b252392c9 100644 --- a/compiler/testData/codegen/box/coroutines/asyncIteratorNullMerge_1_3.kt +++ b/compiler/testData/codegen/box/coroutines/asyncIteratorNullMerge_1_3.kt @@ -20,7 +20,7 @@ interface AsyncIterator { operator suspend fun next(): T } -@UseExperimental(ExperimentalTypeInference::class) +@OptIn(ExperimentalTypeInference::class) fun asyncGenerate(@BuilderInference block: suspend AsyncGenerator.() -> Unit): AsyncSequence = object : AsyncSequence { override fun iterator(): AsyncIterator { val iterator = AsyncGeneratorIterator() diff --git a/compiler/testData/codegen/box/coroutines/asyncIteratorToList_1_3.kt b/compiler/testData/codegen/box/coroutines/asyncIteratorToList_1_3.kt index 63195283c44..00e64d050f7 100644 --- a/compiler/testData/codegen/box/coroutines/asyncIteratorToList_1_3.kt +++ b/compiler/testData/codegen/box/coroutines/asyncIteratorToList_1_3.kt @@ -21,7 +21,7 @@ interface AsyncIterator { operator suspend fun next(): T } -@UseExperimental(ExperimentalTypeInference::class) +@OptIn(ExperimentalTypeInference::class) fun asyncGenerate(@BuilderInference block: suspend AsyncGenerator.() -> Unit): AsyncSequence = object : AsyncSequence { override fun iterator(): AsyncIterator { val iterator = AsyncGeneratorIterator() diff --git a/compiler/testData/codegen/box/coroutines/asyncIterator_1_3.kt b/compiler/testData/codegen/box/coroutines/asyncIterator_1_3.kt index 3bcf2ab28eb..22b9748e909 100644 --- a/compiler/testData/codegen/box/coroutines/asyncIterator_1_3.kt +++ b/compiler/testData/codegen/box/coroutines/asyncIterator_1_3.kt @@ -20,7 +20,7 @@ interface AsyncIterator { operator suspend fun next(): T } -@UseExperimental(ExperimentalTypeInference::class) +@OptIn(ExperimentalTypeInference::class) fun asyncGenerate(@BuilderInference block: suspend AsyncGenerator.() -> Unit): AsyncSequence = object : AsyncSequence { override fun iterator(): AsyncIterator { val iterator = AsyncGeneratorIterator() diff --git a/compiler/testData/codegen/box/coroutines/builderInferenceAndGenericArrayAcessCall.kt b/compiler/testData/codegen/box/coroutines/builderInferenceAndGenericArrayAcessCall.kt index 25ade3c76fd..0726ae52f75 100644 --- a/compiler/testData/codegen/box/coroutines/builderInferenceAndGenericArrayAcessCall.kt +++ b/compiler/testData/codegen/box/coroutines/builderInferenceAndGenericArrayAcessCall.kt @@ -8,7 +8,7 @@ interface Foo class FooImpl : Foo -@UseExperimental(ExperimentalTypeInference::class) +@OptIn(ExperimentalTypeInference::class) fun myflow(@BuilderInference block: Foo.() -> Unit): Foo { val impl = FooImpl() impl.block() diff --git a/compiler/testData/codegen/box/coroutines/kt30858.kt b/compiler/testData/codegen/box/coroutines/kt30858.kt index 5b80ed54cb3..2df8206edcc 100644 --- a/compiler/testData/codegen/box/coroutines/kt30858.kt +++ b/compiler/testData/codegen/box/coroutines/kt30858.kt @@ -16,7 +16,7 @@ fun myLaunch( block: suspend MyCoroutineScope.() -> Unit ) {} -@UseExperimental(kotlin.experimental.ExperimentalTypeInference::class) +@OptIn(kotlin.experimental.ExperimentalTypeInference::class) public fun myProduce(@BuilderInference block: suspend MyProducerScope.() -> Unit) {} fun MyReceiveChannel.debounce(period: Long) { diff --git a/compiler/testData/codegen/box/coroutines/kt31784.kt b/compiler/testData/codegen/box/coroutines/kt31784.kt index f7b3eb0fd52..1f79ae151cb 100644 --- a/compiler/testData/codegen/box/coroutines/kt31784.kt +++ b/compiler/testData/codegen/box/coroutines/kt31784.kt @@ -2,7 +2,7 @@ // IGNORE_BACKEND_FIR: JVM_IR // WITH_RUNTIME -@file:UseExperimental(ExperimentalTypeInference::class) +@file:OptIn(ExperimentalTypeInference::class) package test diff --git a/compiler/testData/codegen/box/inference/builderInference.kt b/compiler/testData/codegen/box/inference/builderInference.kt index ea110b05da6..56601e295f6 100644 --- a/compiler/testData/codegen/box/inference/builderInference.kt +++ b/compiler/testData/codegen/box/inference/builderInference.kt @@ -22,7 +22,7 @@ interface LiveDataScope { suspend fun emit(value: T) } -@UseExperimental(ExperimentalTypeInference::class) +@OptIn(ExperimentalTypeInference::class) fun liveData(@BuilderInference block: suspend LiveDataScope.() -> Unit): LiveData = null!! fun Flow.asLiveData() = liveData { diff --git a/compiler/testData/codegen/bytecodeText/coroutines/debug/localVariableCorrectLabel.kt b/compiler/testData/codegen/bytecodeText/coroutines/debug/localVariableCorrectLabel.kt index 9cddea32b95..c42f30e1e80 100644 --- a/compiler/testData/codegen/bytecodeText/coroutines/debug/localVariableCorrectLabel.kt +++ b/compiler/testData/codegen/bytecodeText/coroutines/debug/localVariableCorrectLabel.kt @@ -10,7 +10,7 @@ fun main(args: Array) { println(s.toList()) } -@UseExperimental(ExperimentalTypeInference::class) +@OptIn(ExperimentalTypeInference::class) @BuilderInference suspend fun SequenceScope.awaitSeq(): Int = 42 diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/callableReferenceToASuspendFunction.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/callableReferenceToASuspendFunction.kt index 13ddbd6fb28..fe50e80173d 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/callableReferenceToASuspendFunction.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/callableReferenceToASuspendFunction.kt @@ -1,6 +1,6 @@ // !LANGUAGE: +NewInference // !DIAGNOSTICS: -UNUSED_PARAMETER -// !USE_EXPERIMENTAL: kotlin.Experimental +// !USE_EXPERIMENTAL: kotlin.RequiresOptIn import kotlin.reflect.KSuspendFunction0 import kotlin.reflect.KSuspendFunction1 diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/chainCallWithExtensionExplicitTypes.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/chainCallWithExtensionExplicitTypes.kt index 61830449b3b..88944aa04a6 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/chainCallWithExtensionExplicitTypes.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/chainCallWithExtensionExplicitTypes.kt @@ -1,6 +1,6 @@ // !LANGUAGE: +NewInference // !DIAGNOSTICS: -UNUSED_PARAMETER -// !USE_EXPERIMENTAL: kotlin.Experimental +// !USE_EXPERIMENTAL: kotlin.RequiresOptIn import kotlin.experimental.ExperimentalTypeInference @@ -12,7 +12,7 @@ interface ProducerScope { class CoroutineScope class ReceiveChannel -@UseExperimental(ExperimentalTypeInference::class) +@OptIn(ExperimentalTypeInference::class) public fun produce(@BuilderInference block: suspend ProducerScope.() -> Unit): ProducerScope = TODO() fun test(ls: List) = diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/chainCallWithExtensionExplicitTypes.txt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/chainCallWithExtensionExplicitTypes.txt index 70a82dbcf0e..48566025776 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/chainCallWithExtensionExplicitTypes.txt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/chainCallWithExtensionExplicitTypes.txt @@ -1,6 +1,6 @@ package -@kotlin.UseExperimental(markerClass = {kotlin.experimental.ExperimentalTypeInference::class}) public fun produce(/*0*/ @kotlin.BuilderInference block: suspend ProducerScope.() -> kotlin.Unit): ProducerScope +@kotlin.OptIn(markerClass = {kotlin.experimental.ExperimentalTypeInference::class}) public fun produce(/*0*/ @kotlin.BuilderInference block: suspend ProducerScope.() -> kotlin.Unit): ProducerScope public fun test(/*0*/ ls: kotlin.collections.List): ProducerScope private fun kotlin.collections.Iterable.asReceiveChannel(): ReceiveChannel public suspend fun ReceiveChannel.toChannel(/*0*/ destination: C): C diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/coroutineInferenceWithCapturedTypeVariable.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/coroutineInferenceWithCapturedTypeVariable.kt index 9877057468f..457eef3a633 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/coroutineInferenceWithCapturedTypeVariable.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/coroutineInferenceWithCapturedTypeVariable.kt @@ -1,6 +1,6 @@ // !LANGUAGE: +NewInference // !DIAGNOSTICS: -UNUSED_PARAMETER -// !USE_EXPERIMENTAL: kotlin.Experimental +// !USE_EXPERIMENTAL: kotlin.RequiresOptIn import kotlin.experimental.ExperimentalTypeInference @@ -9,7 +9,7 @@ suspend fun main() { } -@UseExperimental(ExperimentalTypeInference::class) +@OptIn(ExperimentalTypeInference::class) fun iFlow(@BuilderInference block: suspend iFlowCollector.() -> Unit): iFlow = TODO() interface iFlowCollector { diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/coroutineInferenceWithCapturedTypeVariable.txt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/coroutineInferenceWithCapturedTypeVariable.txt index 2b136bdb067..b9fd3273e00 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/coroutineInferenceWithCapturedTypeVariable.txt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/coroutineInferenceWithCapturedTypeVariable.txt @@ -1,6 +1,6 @@ package -@kotlin.UseExperimental(markerClass = {kotlin.experimental.ExperimentalTypeInference::class}) public fun iFlow(/*0*/ @kotlin.BuilderInference block: suspend iFlowCollector.() -> kotlin.Unit): iFlow +@kotlin.OptIn(markerClass = {kotlin.experimental.ExperimentalTypeInference::class}) public fun iFlow(/*0*/ @kotlin.BuilderInference block: suspend iFlowCollector.() -> kotlin.Unit): iFlow public suspend fun main(): kotlin.Unit public interface iFlow { diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/correctMember.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/correctMember.kt index 8b6e02cddad..eec10acfb95 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/correctMember.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/correctMember.kt @@ -1,7 +1,7 @@ -// !USE_EXPERIMENTAL: kotlin.Experimental +// !USE_EXPERIMENTAL: kotlin.RequiresOptIn // !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE -@file:UseExperimental(ExperimentalTypeInference::class) +@file:OptIn(ExperimentalTypeInference::class) import kotlin.experimental.ExperimentalTypeInference diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/extensionPriority.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/extensionPriority.kt index 55564abcd47..2a88a3c9544 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/extensionPriority.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/extensionPriority.kt @@ -1,7 +1,7 @@ -// !USE_EXPERIMENTAL: kotlin.Experimental +// !USE_EXPERIMENTAL: kotlin.RequiresOptIn // !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE -@file:UseExperimental(ExperimentalTypeInference::class) +@file:OptIn(ExperimentalTypeInference::class) import kotlin.experimental.ExperimentalTypeInference diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/extensionSuspend.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/extensionSuspend.kt index cd532cf8649..e34a1dc5931 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/extensionSuspend.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/extensionSuspend.kt @@ -1,7 +1,7 @@ -// !USE_EXPERIMENTAL: kotlin.Experimental +// !USE_EXPERIMENTAL: kotlin.RequiresOptIn // !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE -@file:UseExperimental(ExperimentalTypeInference::class) +@file:OptIn(ExperimentalTypeInference::class) import kotlin.experimental.ExperimentalTypeInference diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/extensionWithNonValuableConstraints.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/extensionWithNonValuableConstraints.kt index 7aafbff5bdd..492567df776 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/extensionWithNonValuableConstraints.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/extensionWithNonValuableConstraints.kt @@ -1,9 +1,9 @@ // !DIAGNOSTICS: -UNUSED_PARAMETER -// !USE_EXPERIMENTAL: kotlin.Experimental +// !USE_EXPERIMENTAL: kotlin.RequiresOptIn // !WITH_NEW_INFERENCE // NI_EXPECTED_FILE -@file:UseExperimental(ExperimentalTypeInference::class) +@file:OptIn(ExperimentalTypeInference::class) import kotlin.experimental.ExperimentalTypeInference diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/extensionsWithNonValuableConstraintsGenericBase.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/extensionsWithNonValuableConstraintsGenericBase.kt index 3f73c93a76d..dbab0a5e154 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/extensionsWithNonValuableConstraintsGenericBase.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/extensionsWithNonValuableConstraintsGenericBase.kt @@ -1,9 +1,9 @@ // !DIAGNOSTICS: -UNUSED_PARAMETER -// !USE_EXPERIMENTAL: kotlin.Experimental +// !USE_EXPERIMENTAL: kotlin.RequiresOptIn // !WITH_NEW_INFERENCE // NI_EXPECTED_FILE -@file:UseExperimental(ExperimentalTypeInference::class) +@file:OptIn(ExperimentalTypeInference::class) import kotlin.experimental.ExperimentalTypeInference diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/incorrectCalls.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/incorrectCalls.kt index b341dcc9ea3..215138feb4e 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/incorrectCalls.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/incorrectCalls.kt @@ -1,9 +1,9 @@ -// !USE_EXPERIMENTAL: kotlin.Experimental +// !USE_EXPERIMENTAL: kotlin.RequiresOptIn // !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE // !WITH_NEW_INFERENCE // NI_EXPECTED_FILE -@file:UseExperimental(ExperimentalTypeInference::class) +@file:OptIn(ExperimentalTypeInference::class) import kotlin.experimental.ExperimentalTypeInference diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/inferenceFromMethodInsideLocalVariable.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/inferenceFromMethodInsideLocalVariable.kt index 809f121ef91..783131e780c 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/inferenceFromMethodInsideLocalVariable.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/inferenceFromMethodInsideLocalVariable.kt @@ -1,5 +1,5 @@ // !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE -// !USE_EXPERIMENTAL: kotlin.Experimental +// !USE_EXPERIMENTAL: kotlin.RequiresOptIn import kotlin.experimental.ExperimentalTypeInference @@ -7,7 +7,7 @@ interface Inv { fun send(e: T) } -@UseExperimental(ExperimentalTypeInference::class) +@OptIn(ExperimentalTypeInference::class) fun foo(@BuilderInference block: Inv.() -> Unit) {} fun test(i: Int) { diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/inferenceFromMethodInsideLocalVariable.txt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/inferenceFromMethodInsideLocalVariable.txt index 7bfb5b55085..c5ef7968688 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/inferenceFromMethodInsideLocalVariable.txt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/inferenceFromMethodInsideLocalVariable.txt @@ -1,6 +1,6 @@ package -@kotlin.UseExperimental(markerClass = {kotlin.experimental.ExperimentalTypeInference::class}) public fun foo(/*0*/ @kotlin.BuilderInference block: Inv.() -> kotlin.Unit): kotlin.Unit +@kotlin.OptIn(markerClass = {kotlin.experimental.ExperimentalTypeInference::class}) public fun foo(/*0*/ @kotlin.BuilderInference block: Inv.() -> kotlin.Unit): kotlin.Unit public fun test(/*0*/ i: kotlin.Int): kotlin.Unit public interface Inv { diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/recursiveGenerators.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/recursiveGenerators.kt index 759478526f2..2e0b05e1a85 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/recursiveGenerators.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/recursiveGenerators.kt @@ -1,7 +1,7 @@ -// !USE_EXPERIMENTAL: kotlin.Experimental +// !USE_EXPERIMENTAL: kotlin.RequiresOptIn // !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE -@file:UseExperimental(ExperimentalTypeInference::class) +@file:OptIn(ExperimentalTypeInference::class) import kotlin.experimental.ExperimentalTypeInference diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/recursiveGenerators2.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/recursiveGenerators2.kt index a5f83cb7109..7be80eb1d6e 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/recursiveGenerators2.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/recursiveGenerators2.kt @@ -1,9 +1,9 @@ -// !USE_EXPERIMENTAL: kotlin.Experimental +// !USE_EXPERIMENTAL: kotlin.RequiresOptIn // !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE // !WITH_NEW_INFERENCE // NI_EXPECTED_FILE -@file:UseExperimental(ExperimentalTypeInference::class) +@file:OptIn(ExperimentalTypeInference::class) import kotlin.experimental.ExperimentalTypeInference diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/returnTypeInference2.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/returnTypeInference2.kt index 44ad4ad0c4d..a07ead124ad 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/returnTypeInference2.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/returnTypeInference2.kt @@ -1,7 +1,7 @@ -// !USE_EXPERIMENTAL: kotlin.Experimental +// !USE_EXPERIMENTAL: kotlin.RequiresOptIn // !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE -@file:UseExperimental(ExperimentalTypeInference::class) +@file:OptIn(ExperimentalTypeInference::class) import kotlin.experimental.ExperimentalTypeInference diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/severalCandidatesWithDifferentVisibility.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/severalCandidatesWithDifferentVisibility.kt index becec001691..5fab846cd57 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/severalCandidatesWithDifferentVisibility.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/severalCandidatesWithDifferentVisibility.kt @@ -1,4 +1,4 @@ -// !USE_EXPERIMENTAL: kotlin.Experimental +// !USE_EXPERIMENTAL: kotlin.RequiresOptIn // !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE // FILE: a.kt @@ -19,7 +19,7 @@ public class Queue { // FILE: c.kt -@file:UseExperimental(ExperimentalTypeInference::class) +@file:OptIn(ExperimentalTypeInference::class) package c diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/simpleGenerator.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/simpleGenerator.kt index 2af8b1a1f94..a120873a563 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/simpleGenerator.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/simpleGenerator.kt @@ -1,7 +1,7 @@ -// !USE_EXPERIMENTAL: kotlin.Experimental +// !USE_EXPERIMENTAL: kotlin.RequiresOptIn // !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE -@file:UseExperimental(ExperimentalTypeInference::class) +@file:OptIn(ExperimentalTypeInference::class) import kotlin.experimental.ExperimentalTypeInference diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/suspendCallsWithErrors.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/suspendCallsWithErrors.kt index 4cb4d3a2642..006b57f0ff3 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/suspendCallsWithErrors.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/suspendCallsWithErrors.kt @@ -1,9 +1,9 @@ -// !USE_EXPERIMENTAL: kotlin.Experimental +// !USE_EXPERIMENTAL: kotlin.RequiresOptIn // !DIAGNOSTICS: -UNUSED_PARAMETER // !WITH_NEW_INFERENCE // NI_EXPECTED_FILE -@file:UseExperimental(ExperimentalTypeInference::class) +@file:OptIn(ExperimentalTypeInference::class) import kotlin.experimental.ExperimentalTypeInference diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/twoReceiversInScope.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/twoReceiversInScope.kt index 264c95ec57f..f1ff3d9f549 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/twoReceiversInScope.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/twoReceiversInScope.kt @@ -1,7 +1,7 @@ -// !USE_EXPERIMENTAL: kotlin.Experimental +// !USE_EXPERIMENTAL: kotlin.RequiresOptIn // !DIAGNOSTICS: -UNUSED_PARAMETER -@file:UseExperimental(ExperimentalTypeInference::class) +@file:OptIn(ExperimentalTypeInference::class) import kotlin.experimental.ExperimentalTypeInference diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/typeFromReceiver.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/typeFromReceiver.kt index 46960ae0e1a..6f6efda3035 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/typeFromReceiver.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/typeFromReceiver.kt @@ -1,7 +1,7 @@ -// !USE_EXPERIMENTAL: kotlin.Experimental +// !USE_EXPERIMENTAL: kotlin.RequiresOptIn // !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE -@file:UseExperimental(ExperimentalTypeInference::class) +@file:OptIn(ExperimentalTypeInference::class) import kotlin.experimental.ExperimentalTypeInference diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/variableCallInsideBuilderFunction.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/variableCallInsideBuilderFunction.kt index 17ba9ad9d2f..875bc67b821 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/variableCallInsideBuilderFunction.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/variableCallInsideBuilderFunction.kt @@ -1,6 +1,6 @@ // !LANGUAGE: +NewInference // !DIAGNOSTICS: -UNUSED_PARAMETER -// !USE_EXPERIMENTAL: kotlin.Experimental +// !USE_EXPERIMENTAL: kotlin.RequiresOptIn import kotlin.experimental.ExperimentalTypeInference @@ -8,7 +8,7 @@ interface ProducerScope { fun yield(e: E) } -@UseExperimental(ExperimentalTypeInference::class) +@OptIn(ExperimentalTypeInference::class) fun produce(@BuilderInference block: ProducerScope.() -> Unit): ProducerScope = TODO() fun filter(e: K, predicate: (K) -> Boolean) = diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/variableCallInsideBuilderFunction.txt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/variableCallInsideBuilderFunction.txt index b25dc46daed..0ada6c88a4f 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/variableCallInsideBuilderFunction.txt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/variableCallInsideBuilderFunction.txt @@ -1,7 +1,7 @@ package public fun filter(/*0*/ e: K, /*1*/ predicate: (K) -> kotlin.Boolean): ProducerScope -@kotlin.UseExperimental(markerClass = {kotlin.experimental.ExperimentalTypeInference::class}) public fun produce(/*0*/ @kotlin.BuilderInference block: ProducerScope.() -> kotlin.Unit): ProducerScope +@kotlin.OptIn(markerClass = {kotlin.experimental.ExperimentalTypeInference::class}) public fun produce(/*0*/ @kotlin.BuilderInference block: ProducerScope.() -> kotlin.Unit): ProducerScope public interface ProducerScope { public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/variableOfAFunctionTypeCall.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/variableOfAFunctionTypeCall.kt index ab366f7d6a7..1ad60cefafc 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/variableOfAFunctionTypeCall.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/variableOfAFunctionTypeCall.kt @@ -1,7 +1,7 @@ // !USE_EXPERIMENTAL: kotlin.Experimental // !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE -@file:UseExperimental(ExperimentalTypeInference::class) +@file:OptIn(ExperimentalTypeInference::class) import kotlin.experimental.ExperimentalTypeInference @@ -9,7 +9,7 @@ interface ProducerScope { fun yield(e: E) } -@UseExperimental(ExperimentalTypeInference::class) +@OptIn(ExperimentalTypeInference::class) fun produce(@BuilderInference block: ProducerScope.() -> Unit): ProducerScope = TODO() fun filter(e: K, predicate: (K) -> Boolean) = diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/variableOfAFunctionTypeCall.txt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/variableOfAFunctionTypeCall.txt index b25dc46daed..0ada6c88a4f 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/variableOfAFunctionTypeCall.txt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/variableOfAFunctionTypeCall.txt @@ -1,7 +1,7 @@ package public fun filter(/*0*/ e: K, /*1*/ predicate: (K) -> kotlin.Boolean): ProducerScope -@kotlin.UseExperimental(markerClass = {kotlin.experimental.ExperimentalTypeInference::class}) public fun produce(/*0*/ @kotlin.BuilderInference block: ProducerScope.() -> kotlin.Unit): ProducerScope +@kotlin.OptIn(markerClass = {kotlin.experimental.ExperimentalTypeInference::class}) public fun produce(/*0*/ @kotlin.BuilderInference block: ProducerScope.() -> kotlin.Unit): ProducerScope public interface ProducerScope { public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/withParameter.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/withParameter.kt index 6e27d1c2e98..3694584cbc4 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/withParameter.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/withParameter.kt @@ -1,7 +1,7 @@ -// !USE_EXPERIMENTAL: kotlin.Experimental +// !USE_EXPERIMENTAL: kotlin.RequiresOptIn // !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE -@file:UseExperimental(ExperimentalTypeInference::class) +@file:OptIn(ExperimentalTypeInference::class) import kotlin.experimental.ExperimentalTypeInference diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/kt28658.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/kt28658.kt index 625b84328f5..65cf42a412b 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/kt28658.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/kt28658.kt @@ -1,5 +1,5 @@ // !LANGUAGE: +NewInference -// !USE_EXPERIMENTAL: kotlin.Experimental +// !USE_EXPERIMENTAL: kotlin.RequiresOptIn // !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE import kotlin.experimental.ExperimentalTypeInference @@ -18,7 +18,7 @@ class Foo fun f1(f: Foo.() -> Unit) {} -@UseExperimental(ExperimentalTypeInference::class) +@OptIn(ExperimentalTypeInference::class) fun f2(@BuilderInference f: Foo.() -> Unit) { } diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/kt28658.txt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/kt28658.txt index e529389a5a3..8493bf7b6b3 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/kt28658.txt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/kt28658.txt @@ -1,7 +1,7 @@ package public fun f1(/*0*/ f: Foo.() -> kotlin.Unit): kotlin.Unit -@kotlin.UseExperimental(markerClass = {kotlin.experimental.ExperimentalTypeInference::class}) public fun f2(/*0*/ @kotlin.BuilderInference f: Foo.() -> kotlin.Unit): kotlin.Unit +@kotlin.OptIn(markerClass = {kotlin.experimental.ExperimentalTypeInference::class}) public fun f2(/*0*/ @kotlin.BuilderInference f: Foo.() -> kotlin.Unit): kotlin.Unit public fun test1(): kotlin.Unit public fun test2(): [ERROR : Error function type] public fun test3(): kotlin.Unit diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/outerYield_1_3.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/outerYield_1_3.kt index 78f976ce875..198c4d0995e 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/outerYield_1_3.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/outerYield_1_3.kt @@ -1,8 +1,8 @@ // !LANGUAGE: +ReleaseCoroutines +ExperimentalBuilderInference -// !USE_EXPERIMENTAL: kotlin.Experimental +// !USE_EXPERIMENTAL: kotlin.RequiresOptIn // SKIP_TXT -@file:UseExperimental(ExperimentalTypeInference::class) +@file:OptIn(ExperimentalTypeInference::class) import kotlin.experimental.ExperimentalTypeInference diff --git a/compiler/testData/diagnostics/testsWithStdLib/experimental/annotation.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/experimental/annotation.fir.kt index 031c167292b..e34d1f49fff 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/experimental/annotation.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/experimental/annotation.fir.kt @@ -1,10 +1,10 @@ -// !USE_EXPERIMENTAL: kotlin.Experimental +// !USE_EXPERIMENTAL: kotlin.RequiresOptIn // !DIAGNOSTICS: -UNUSED_PARAMETER // FILE: api.kt package api -@Experimental(Experimental.Level.WARNING) +@RequiresOptIn(RequiresOptIn.Level.WARNING) @Target(AnnotationTarget.TYPE, AnnotationTarget.CLASS, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY, AnnotationTarget.TYPEALIAS, AnnotationTarget.VALUE_PARAMETER) annotation class ExperimentalAPI @@ -65,41 +65,41 @@ package usage2 import api.* -@UseExperimental(ExperimentalAPI::class) +@OptIn(ExperimentalAPI::class) @EAnno fun function() {} -@UseExperimental(ExperimentalAPI::class) +@OptIn(ExperimentalAPI::class) fun parameter(@EAnno p: String) {} -@UseExperimental(ExperimentalAPI::class) +@OptIn(ExperimentalAPI::class) fun parameterType(p: @EAnno String) {} -@UseExperimental(ExperimentalAPI::class) +@OptIn(ExperimentalAPI::class) fun returnType(): @EAnno Unit {} -@UseExperimental(ExperimentalAPI::class) +@OptIn(ExperimentalAPI::class) @EAnno val property = "" -@UseExperimental(ExperimentalAPI::class) +@OptIn(ExperimentalAPI::class) @EAnno typealias Typealias = Unit -@UseExperimental(ExperimentalAPI::class) +@OptIn(ExperimentalAPI::class) @EAnno class Klass -@UseExperimental(ExperimentalAPI::class) +@OptIn(ExperimentalAPI::class) annotation class AnnotationArgument(val p: EAnno) fun insideBody() { - @UseExperimental(ExperimentalAPI::class) @EAnno fun local() {} + @OptIn(ExperimentalAPI::class) @EAnno fun local() {} } -fun inDefaultArgument(@UseExperimental(ExperimentalAPI::class) f: () -> Unit = @EAnno fun() {}) {} +fun inDefaultArgument(@OptIn(ExperimentalAPI::class) f: () -> Unit = @EAnno fun() {}) {} -@UseExperimental(ExperimentalAPI::class) +@OptIn(ExperimentalAPI::class) val inProperty = @EAnno fun() {} val inPropertyAccessor: () -> Unit - @UseExperimental(ExperimentalAPI::class) + @OptIn(ExperimentalAPI::class) get() = @EAnno fun() {} // FILE: usage-none.kt diff --git a/compiler/testData/diagnostics/testsWithStdLib/experimental/annotation.kt b/compiler/testData/diagnostics/testsWithStdLib/experimental/annotation.kt index d93f889eb88..778f4d0a394 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/experimental/annotation.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/experimental/annotation.kt @@ -1,10 +1,10 @@ -// !USE_EXPERIMENTAL: kotlin.Experimental +// !USE_EXPERIMENTAL: kotlin.RequiresOptIn // !DIAGNOSTICS: -UNUSED_PARAMETER // FILE: api.kt package api -@Experimental(Experimental.Level.WARNING) +@RequiresOptIn(RequiresOptIn.Level.WARNING) @Target(AnnotationTarget.TYPE, AnnotationTarget.CLASS, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY, AnnotationTarget.TYPEALIAS, AnnotationTarget.VALUE_PARAMETER) annotation class ExperimentalAPI @@ -65,41 +65,41 @@ package usage2 import api.* -@UseExperimental(ExperimentalAPI::class) +@OptIn(ExperimentalAPI::class) @EAnno fun function() {} -@UseExperimental(ExperimentalAPI::class) +@OptIn(ExperimentalAPI::class) fun parameter(@EAnno p: String) {} -@UseExperimental(ExperimentalAPI::class) +@OptIn(ExperimentalAPI::class) fun parameterType(p: @EAnno String) {} -@UseExperimental(ExperimentalAPI::class) +@OptIn(ExperimentalAPI::class) fun returnType(): @EAnno Unit {} -@UseExperimental(ExperimentalAPI::class) +@OptIn(ExperimentalAPI::class) @EAnno val property = "" -@UseExperimental(ExperimentalAPI::class) +@OptIn(ExperimentalAPI::class) @EAnno typealias Typealias = Unit -@UseExperimental(ExperimentalAPI::class) +@OptIn(ExperimentalAPI::class) @EAnno class Klass -@UseExperimental(ExperimentalAPI::class) +@OptIn(ExperimentalAPI::class) annotation class AnnotationArgument(val p: EAnno) fun insideBody() { - @UseExperimental(ExperimentalAPI::class) @EAnno fun local() {} + @OptIn(ExperimentalAPI::class) @EAnno fun local() {} } -fun inDefaultArgument(@UseExperimental(ExperimentalAPI::class) f: () -> Unit = @EAnno fun() {}) {} +fun inDefaultArgument(@OptIn(ExperimentalAPI::class) f: () -> Unit = @EAnno fun() {}) {} -@UseExperimental(ExperimentalAPI::class) +@OptIn(ExperimentalAPI::class) val inProperty = @EAnno fun() {} val inPropertyAccessor: () -> Unit - @UseExperimental(ExperimentalAPI::class) + @OptIn(ExperimentalAPI::class) get() = @EAnno fun() {} // FILE: usage-none.kt diff --git a/compiler/testData/diagnostics/testsWithStdLib/experimental/annotation.txt b/compiler/testData/diagnostics/testsWithStdLib/experimental/annotation.txt index 2cd816dd88c..8985d3d18f1 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/experimental/annotation.txt +++ b/compiler/testData/diagnostics/testsWithStdLib/experimental/annotation.txt @@ -9,7 +9,7 @@ package api { public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } - @kotlin.Experimental(level = Level.WARNING) @kotlin.annotation.Target(allowedTargets = {AnnotationTarget.TYPE, AnnotationTarget.CLASS, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY, AnnotationTarget.TYPEALIAS, AnnotationTarget.VALUE_PARAMETER}) public final annotation class ExperimentalAPI : kotlin.Annotation { + @kotlin.RequiresOptIn(level = Level.WARNING) @kotlin.annotation.Target(allowedTargets = {AnnotationTarget.TYPE, AnnotationTarget.CLASS, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY, AnnotationTarget.TYPEALIAS, AnnotationTarget.VALUE_PARAMETER}) public final annotation class ExperimentalAPI : kotlin.Annotation { public constructor ExperimentalAPI() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int @@ -46,17 +46,17 @@ package usage1 { } package usage2 { - @kotlin.UseExperimental(markerClass = {api.ExperimentalAPI::class}) public val inProperty: () -> kotlin.Unit - @get:kotlin.UseExperimental(markerClass = {api.ExperimentalAPI::class}) public val inPropertyAccessor: () -> kotlin.Unit - @kotlin.UseExperimental(markerClass = {api.ExperimentalAPI::class}) @api.EAnno public val property: kotlin.String = "" - @kotlin.UseExperimental(markerClass = {api.ExperimentalAPI::class}) @api.EAnno public fun function(): kotlin.Unit - public fun inDefaultArgument(/*0*/ @kotlin.UseExperimental(markerClass = {api.ExperimentalAPI::class}) f: () -> kotlin.Unit = ...): kotlin.Unit + @kotlin.OptIn(markerClass = {api.ExperimentalAPI::class}) public val inProperty: () -> kotlin.Unit + @get:kotlin.OptIn(markerClass = {api.ExperimentalAPI::class}) public val inPropertyAccessor: () -> kotlin.Unit + @kotlin.OptIn(markerClass = {api.ExperimentalAPI::class}) @api.EAnno public val property: kotlin.String = "" + @kotlin.OptIn(markerClass = {api.ExperimentalAPI::class}) @api.EAnno public fun function(): kotlin.Unit + public fun inDefaultArgument(/*0*/ @kotlin.OptIn(markerClass = {api.ExperimentalAPI::class}) f: () -> kotlin.Unit = ...): kotlin.Unit public fun insideBody(): kotlin.Unit - @kotlin.UseExperimental(markerClass = {api.ExperimentalAPI::class}) public fun parameter(/*0*/ @api.EAnno p: kotlin.String): kotlin.Unit - @kotlin.UseExperimental(markerClass = {api.ExperimentalAPI::class}) public fun parameterType(/*0*/ p: @api.EAnno kotlin.String): kotlin.Unit - @kotlin.UseExperimental(markerClass = {api.ExperimentalAPI::class}) public fun returnType(): @api.EAnno kotlin.Unit + @kotlin.OptIn(markerClass = {api.ExperimentalAPI::class}) public fun parameter(/*0*/ @api.EAnno p: kotlin.String): kotlin.Unit + @kotlin.OptIn(markerClass = {api.ExperimentalAPI::class}) public fun parameterType(/*0*/ p: @api.EAnno kotlin.String): kotlin.Unit + @kotlin.OptIn(markerClass = {api.ExperimentalAPI::class}) public fun returnType(): @api.EAnno kotlin.Unit - @kotlin.UseExperimental(markerClass = {api.ExperimentalAPI::class}) public final annotation class AnnotationArgument : kotlin.Annotation { + @kotlin.OptIn(markerClass = {api.ExperimentalAPI::class}) public final annotation class AnnotationArgument : kotlin.Annotation { public constructor AnnotationArgument(/*0*/ p: api.EAnno) public final val p: api.EAnno public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean @@ -64,13 +64,13 @@ package usage2 { public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } - @kotlin.UseExperimental(markerClass = {api.ExperimentalAPI::class}) @api.EAnno public final class Klass { + @kotlin.OptIn(markerClass = {api.ExperimentalAPI::class}) @api.EAnno public final class Klass { public constructor Klass() 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 } - @kotlin.UseExperimental(markerClass = {api.ExperimentalAPI::class}) @api.EAnno public typealias Typealias = kotlin.Unit + @kotlin.OptIn(markerClass = {api.ExperimentalAPI::class}) @api.EAnno public typealias Typealias = kotlin.Unit } package usage3 { diff --git a/compiler/testData/diagnostics/testsWithStdLib/experimental/bodyUsages.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/experimental/bodyUsages.fir.kt index 0e2663bf6bd..89296f28d77 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/experimental/bodyUsages.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/experimental/bodyUsages.fir.kt @@ -1,9 +1,9 @@ -// !USE_EXPERIMENTAL: kotlin.Experimental +// !USE_EXPERIMENTAL: kotlin.RequiresOptIn // FILE: api.kt package api -@Experimental(Experimental.Level.WARNING) +@RequiresOptIn(RequiresOptIn.Level.WARNING) annotation class ExperimentalAPI interface I @@ -19,12 +19,12 @@ import api.* open class Base(val i: I) -@UseExperimental(ExperimentalAPI::class) +@OptIn(ExperimentalAPI::class) class Derived : Base(Impl()) -@UseExperimental(ExperimentalAPI::class) +@OptIn(ExperimentalAPI::class) class Delegated : I by Impl() -@UseExperimental(ExperimentalAPI::class) +@OptIn(ExperimentalAPI::class) val delegatedProperty by Impl() operator fun I.getValue(x: Any?, y: Any?) = null diff --git a/compiler/testData/diagnostics/testsWithStdLib/experimental/bodyUsages.kt b/compiler/testData/diagnostics/testsWithStdLib/experimental/bodyUsages.kt index 0e2663bf6bd..89296f28d77 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/experimental/bodyUsages.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/experimental/bodyUsages.kt @@ -1,9 +1,9 @@ -// !USE_EXPERIMENTAL: kotlin.Experimental +// !USE_EXPERIMENTAL: kotlin.RequiresOptIn // FILE: api.kt package api -@Experimental(Experimental.Level.WARNING) +@RequiresOptIn(RequiresOptIn.Level.WARNING) annotation class ExperimentalAPI interface I @@ -19,12 +19,12 @@ import api.* open class Base(val i: I) -@UseExperimental(ExperimentalAPI::class) +@OptIn(ExperimentalAPI::class) class Derived : Base(Impl()) -@UseExperimental(ExperimentalAPI::class) +@OptIn(ExperimentalAPI::class) class Delegated : I by Impl() -@UseExperimental(ExperimentalAPI::class) +@OptIn(ExperimentalAPI::class) val delegatedProperty by Impl() operator fun I.getValue(x: Any?, y: Any?) = null diff --git a/compiler/testData/diagnostics/testsWithStdLib/experimental/bodyUsages.txt b/compiler/testData/diagnostics/testsWithStdLib/experimental/bodyUsages.txt index 4f34d72a93a..9f4882f54a3 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/experimental/bodyUsages.txt +++ b/compiler/testData/diagnostics/testsWithStdLib/experimental/bodyUsages.txt @@ -2,7 +2,7 @@ package package api { - @kotlin.Experimental(level = Level.WARNING) public final annotation class ExperimentalAPI : kotlin.Annotation { + @kotlin.RequiresOptIn(level = Level.WARNING) public final annotation class ExperimentalAPI : kotlin.Annotation { public constructor ExperimentalAPI() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int @@ -24,7 +24,7 @@ package api { } package usage { - @kotlin.UseExperimental(markerClass = {api.ExperimentalAPI::class}) public val delegatedProperty: kotlin.Nothing? + @kotlin.OptIn(markerClass = {api.ExperimentalAPI::class}) public val delegatedProperty: kotlin.Nothing? public operator fun api.I.getValue(/*0*/ x: kotlin.Any?, /*1*/ y: kotlin.Any?): kotlin.Nothing? public open class Base { @@ -35,14 +35,14 @@ package usage { public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } - @kotlin.UseExperimental(markerClass = {api.ExperimentalAPI::class}) public final class Delegated : api.I { + @kotlin.OptIn(markerClass = {api.ExperimentalAPI::class}) public final class Delegated : api.I { public constructor Delegated() 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 } - @kotlin.UseExperimental(markerClass = {api.ExperimentalAPI::class}) public final class Derived : usage.Base { + @kotlin.OptIn(markerClass = {api.ExperimentalAPI::class}) public final class Derived : usage.Base { public constructor Derived() public final override /*1*/ /*fake_override*/ val i: api.I public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean diff --git a/compiler/testData/diagnostics/testsWithStdLib/experimental/bodyUsagesAndInline.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/experimental/bodyUsagesAndInline.fir.kt index d9629d2f927..3c65b6e3809 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/experimental/bodyUsagesAndInline.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/experimental/bodyUsagesAndInline.fir.kt @@ -1,10 +1,10 @@ // !DIAGNOSTICS: -NOTHING_TO_INLINE -UNUSED_PARAMETER -// !USE_EXPERIMENTAL: kotlin.Experimental +// !USE_EXPERIMENTAL: kotlin.RequiresOptIn // FILE: api.kt package api -@Experimental(Experimental.Level.WARNING) +@RequiresOptIn(RequiresOptIn.Level.WARNING) annotation class API @API diff --git a/compiler/testData/diagnostics/testsWithStdLib/experimental/bodyUsagesAndInline.kt b/compiler/testData/diagnostics/testsWithStdLib/experimental/bodyUsagesAndInline.kt index f7c65ee8867..4b4e880a362 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/experimental/bodyUsagesAndInline.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/experimental/bodyUsagesAndInline.kt @@ -1,10 +1,10 @@ // !DIAGNOSTICS: -NOTHING_TO_INLINE -UNUSED_PARAMETER -// !USE_EXPERIMENTAL: kotlin.Experimental +// !USE_EXPERIMENTAL: kotlin.RequiresOptIn // FILE: api.kt package api -@Experimental(Experimental.Level.WARNING) +@RequiresOptIn(RequiresOptIn.Level.WARNING) annotation class API @API diff --git a/compiler/testData/diagnostics/testsWithStdLib/experimental/bodyUsagesAndInline.txt b/compiler/testData/diagnostics/testsWithStdLib/experimental/bodyUsagesAndInline.txt index dbe8624350a..21da806a978 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/experimental/bodyUsagesAndInline.txt +++ b/compiler/testData/diagnostics/testsWithStdLib/experimental/bodyUsagesAndInline.txt @@ -3,7 +3,7 @@ package package api { @api.API public fun f(): kotlin.Unit - @kotlin.Experimental(level = Level.WARNING) public final annotation class API : kotlin.Annotation { + @kotlin.RequiresOptIn(level = Level.WARNING) public final annotation class API : kotlin.Annotation { public constructor API() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int diff --git a/compiler/testData/diagnostics/testsWithStdLib/experimental/classMembers.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/experimental/classMembers.fir.kt index 0c8699c638b..9d690c4f626 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/experimental/classMembers.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/experimental/classMembers.fir.kt @@ -1,9 +1,9 @@ -// !USE_EXPERIMENTAL: kotlin.Experimental +// !USE_EXPERIMENTAL: kotlin.RequiresOptIn // FILE: api.kt package api -@Experimental(Experimental.Level.WARNING) +@RequiresOptIn(RequiresOptIn.Level.WARNING) @Target(AnnotationTarget.CLASS, AnnotationTarget.FUNCTION) annotation class ExperimentalAPI @@ -51,7 +51,7 @@ package usage2 import api.* -@UseExperimental(ExperimentalAPI::class) +@OptIn(ExperimentalAPI::class) fun useAll() { val c: C = C() c.function() @@ -61,7 +61,7 @@ fun useAll() { c.extension() } -@UseExperimental(ExperimentalAPI::class) +@OptIn(ExperimentalAPI::class) class Use { fun useAll(c: C) { c.function() diff --git a/compiler/testData/diagnostics/testsWithStdLib/experimental/classMembers.kt b/compiler/testData/diagnostics/testsWithStdLib/experimental/classMembers.kt index fb217d7d6e0..a57c4ff562b 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/experimental/classMembers.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/experimental/classMembers.kt @@ -1,9 +1,9 @@ -// !USE_EXPERIMENTAL: kotlin.Experimental +// !USE_EXPERIMENTAL: kotlin.RequiresOptIn // FILE: api.kt package api -@Experimental(Experimental.Level.WARNING) +@RequiresOptIn(RequiresOptIn.Level.WARNING) @Target(AnnotationTarget.CLASS, AnnotationTarget.FUNCTION) annotation class ExperimentalAPI @@ -51,7 +51,7 @@ package usage2 import api.* -@UseExperimental(ExperimentalAPI::class) +@OptIn(ExperimentalAPI::class) fun useAll() { val c: C = C() c.function() @@ -61,7 +61,7 @@ fun useAll() { c.extension() } -@UseExperimental(ExperimentalAPI::class) +@OptIn(ExperimentalAPI::class) class Use { fun useAll(c: C) { c.function() diff --git a/compiler/testData/diagnostics/testsWithStdLib/experimental/classMembers.txt b/compiler/testData/diagnostics/testsWithStdLib/experimental/classMembers.txt index fa5680dddc9..1f4fb126cf5 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/experimental/classMembers.txt +++ b/compiler/testData/diagnostics/testsWithStdLib/experimental/classMembers.txt @@ -26,7 +26,7 @@ package api { } } - @kotlin.Experimental(level = Level.WARNING) @kotlin.annotation.Target(allowedTargets = {AnnotationTarget.CLASS, AnnotationTarget.FUNCTION}) public final annotation class ExperimentalAPI : kotlin.Annotation { + @kotlin.RequiresOptIn(level = Level.WARNING) @kotlin.annotation.Target(allowedTargets = {AnnotationTarget.CLASS, AnnotationTarget.FUNCTION}) public final annotation class ExperimentalAPI : kotlin.Annotation { public constructor ExperimentalAPI() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int @@ -47,9 +47,9 @@ package usage1 { } package usage2 { - @kotlin.UseExperimental(markerClass = {api.ExperimentalAPI::class}) public fun useAll(): kotlin.Unit + @kotlin.OptIn(markerClass = {api.ExperimentalAPI::class}) public fun useAll(): kotlin.Unit - @kotlin.UseExperimental(markerClass = {api.ExperimentalAPI::class}) public final class Use { + @kotlin.OptIn(markerClass = {api.ExperimentalAPI::class}) public final class Use { public constructor Use() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int diff --git a/compiler/testData/diagnostics/testsWithStdLib/experimental/classMembersOverlyExperimental.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/experimental/classMembersOverlyExperimental.fir.kt index ca6192f1c87..247dc8d9a5c 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/experimental/classMembersOverlyExperimental.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/experimental/classMembersOverlyExperimental.fir.kt @@ -1,9 +1,9 @@ -// !USE_EXPERIMENTAL: kotlin.Experimental +// !USE_EXPERIMENTAL: kotlin.RequiresOptIn // FILE: api.kt package api -@Experimental(Experimental.Level.WARNING) +@RequiresOptIn(RequiresOptIn.Level.WARNING) @Target(AnnotationTarget.CLASS, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY) annotation class ExperimentalAPI diff --git a/compiler/testData/diagnostics/testsWithStdLib/experimental/classMembersOverlyExperimental.kt b/compiler/testData/diagnostics/testsWithStdLib/experimental/classMembersOverlyExperimental.kt index 5e696c60714..1bc33ff2897 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/experimental/classMembersOverlyExperimental.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/experimental/classMembersOverlyExperimental.kt @@ -1,9 +1,9 @@ -// !USE_EXPERIMENTAL: kotlin.Experimental +// !USE_EXPERIMENTAL: kotlin.RequiresOptIn // FILE: api.kt package api -@Experimental(Experimental.Level.WARNING) +@RequiresOptIn(RequiresOptIn.Level.WARNING) @Target(AnnotationTarget.CLASS, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY) annotation class ExperimentalAPI diff --git a/compiler/testData/diagnostics/testsWithStdLib/experimental/classMembersOverlyExperimental.txt b/compiler/testData/diagnostics/testsWithStdLib/experimental/classMembersOverlyExperimental.txt index b49e39c8179..8ae8ef25a75 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/experimental/classMembersOverlyExperimental.txt +++ b/compiler/testData/diagnostics/testsWithStdLib/experimental/classMembersOverlyExperimental.txt @@ -19,7 +19,7 @@ package api { } } - @kotlin.Experimental(level = Level.WARNING) @kotlin.annotation.Target(allowedTargets = {AnnotationTarget.CLASS, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY}) public final annotation class ExperimentalAPI : kotlin.Annotation { + @kotlin.RequiresOptIn(level = Level.WARNING) @kotlin.annotation.Target(allowedTargets = {AnnotationTarget.CLASS, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY}) public final annotation class ExperimentalAPI : kotlin.Annotation { public constructor ExperimentalAPI() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int diff --git a/compiler/testData/diagnostics/testsWithStdLib/experimental/constVal.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/experimental/constVal.fir.kt index 229705b4db8..a1a4798b589 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/experimental/constVal.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/experimental/constVal.fir.kt @@ -1,9 +1,9 @@ -// !USE_EXPERIMENTAL: kotlin.Experimental +// !USE_EXPERIMENTAL: kotlin.RequiresOptIn // FILE: api.kt package api -@Experimental(Experimental.Level.WARNING) +@RequiresOptIn(RequiresOptIn.Level.WARNING) @Target(AnnotationTarget.PROPERTY, AnnotationTarget.FUNCTION) annotation class ExperimentalAPI @@ -24,7 +24,7 @@ fun usage() {} // FILE: usage-use.kt -@file:UseExperimental(ExperimentalAPI::class) +@file:OptIn(ExperimentalAPI::class) package usage2 import api.* diff --git a/compiler/testData/diagnostics/testsWithStdLib/experimental/constVal.kt b/compiler/testData/diagnostics/testsWithStdLib/experimental/constVal.kt index 7d042dddf61..6b2714f68d3 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/experimental/constVal.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/experimental/constVal.kt @@ -1,9 +1,9 @@ -// !USE_EXPERIMENTAL: kotlin.Experimental +// !USE_EXPERIMENTAL: kotlin.RequiresOptIn // FILE: api.kt package api -@Experimental(Experimental.Level.WARNING) +@RequiresOptIn(RequiresOptIn.Level.WARNING) @Target(AnnotationTarget.PROPERTY, AnnotationTarget.FUNCTION) annotation class ExperimentalAPI @@ -24,7 +24,7 @@ fun usage() {} // FILE: usage-use.kt -@file:UseExperimental(ExperimentalAPI::class) +@file:OptIn(ExperimentalAPI::class) package usage2 import api.* diff --git a/compiler/testData/diagnostics/testsWithStdLib/experimental/constVal.txt b/compiler/testData/diagnostics/testsWithStdLib/experimental/constVal.txt index c04082be358..38722e634e9 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/experimental/constVal.txt +++ b/compiler/testData/diagnostics/testsWithStdLib/experimental/constVal.txt @@ -11,7 +11,7 @@ package api { public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } - @kotlin.Experimental(level = Level.WARNING) @kotlin.annotation.Target(allowedTargets = {AnnotationTarget.PROPERTY, AnnotationTarget.FUNCTION}) public final annotation class ExperimentalAPI : kotlin.Annotation { + @kotlin.RequiresOptIn(level = Level.WARNING) @kotlin.annotation.Target(allowedTargets = {AnnotationTarget.PROPERTY, AnnotationTarget.FUNCTION}) public final annotation class ExperimentalAPI : kotlin.Annotation { public constructor ExperimentalAPI() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int diff --git a/compiler/testData/diagnostics/testsWithStdLib/experimental/deeplyNestedClass.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/experimental/deeplyNestedClass.fir.kt index 518fe17fea4..dff3ba9322f 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/experimental/deeplyNestedClass.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/experimental/deeplyNestedClass.fir.kt @@ -1,9 +1,9 @@ -// !USE_EXPERIMENTAL: kotlin.Experimental +// !USE_EXPERIMENTAL: kotlin.RequiresOptIn // FILE: api.kt package api -@Experimental(Experimental.Level.WARNING) +@RequiresOptIn(RequiresOptIn.Level.WARNING) @Target(AnnotationTarget.CLASS, AnnotationTarget.FUNCTION) annotation class ExperimentalAPI @@ -36,12 +36,12 @@ package usage2 import api.* -@UseExperimental(ExperimentalAPI::class) +@OptIn(ExperimentalAPI::class) fun use1() { C.D.E.F() } -@UseExperimental(ExperimentalAPI::class) +@OptIn(ExperimentalAPI::class) fun use2(f: C.D.E.F) = f.hashCode() // FILE: usage-none.kt diff --git a/compiler/testData/diagnostics/testsWithStdLib/experimental/deeplyNestedClass.kt b/compiler/testData/diagnostics/testsWithStdLib/experimental/deeplyNestedClass.kt index b6c94ec2ddf..a4a76dfee8d 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/experimental/deeplyNestedClass.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/experimental/deeplyNestedClass.kt @@ -1,9 +1,9 @@ -// !USE_EXPERIMENTAL: kotlin.Experimental +// !USE_EXPERIMENTAL: kotlin.RequiresOptIn // FILE: api.kt package api -@Experimental(Experimental.Level.WARNING) +@RequiresOptIn(RequiresOptIn.Level.WARNING) @Target(AnnotationTarget.CLASS, AnnotationTarget.FUNCTION) annotation class ExperimentalAPI @@ -36,12 +36,12 @@ package usage2 import api.* -@UseExperimental(ExperimentalAPI::class) +@OptIn(ExperimentalAPI::class) fun use1() { C.D.E.F() } -@UseExperimental(ExperimentalAPI::class) +@OptIn(ExperimentalAPI::class) fun use2(f: C.D.E.F) = f.hashCode() // FILE: usage-none.kt diff --git a/compiler/testData/diagnostics/testsWithStdLib/experimental/deeplyNestedClass.txt b/compiler/testData/diagnostics/testsWithStdLib/experimental/deeplyNestedClass.txt index 3d4eeda281f..7505d09cf20 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/experimental/deeplyNestedClass.txt +++ b/compiler/testData/diagnostics/testsWithStdLib/experimental/deeplyNestedClass.txt @@ -30,7 +30,7 @@ package api { } } - @kotlin.Experimental(level = Level.WARNING) @kotlin.annotation.Target(allowedTargets = {AnnotationTarget.CLASS, AnnotationTarget.FUNCTION}) public final annotation class ExperimentalAPI : kotlin.Annotation { + @kotlin.RequiresOptIn(level = Level.WARNING) @kotlin.annotation.Target(allowedTargets = {AnnotationTarget.CLASS, AnnotationTarget.FUNCTION}) public final annotation class ExperimentalAPI : kotlin.Annotation { public constructor ExperimentalAPI() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int @@ -44,8 +44,8 @@ package usage1 { } package usage2 { - @kotlin.UseExperimental(markerClass = {api.ExperimentalAPI::class}) public fun use1(): kotlin.Unit - @kotlin.UseExperimental(markerClass = {api.ExperimentalAPI::class}) public fun use2(/*0*/ f: api.C.D.E.F): kotlin.Int + @kotlin.OptIn(markerClass = {api.ExperimentalAPI::class}) public fun use1(): kotlin.Unit + @kotlin.OptIn(markerClass = {api.ExperimentalAPI::class}) public fun use2(/*0*/ f: api.C.D.E.F): kotlin.Int } package usage3 { diff --git a/compiler/testData/diagnostics/testsWithStdLib/experimental/errors.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/experimental/errors.fir.kt index 1152354a790..607d2281796 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/experimental/errors.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/experimental/errors.fir.kt @@ -1,9 +1,9 @@ -// !USE_EXPERIMENTAL: kotlin.Experimental +// !USE_EXPERIMENTAL: kotlin.RequiresOptIn // FILE: api.kt package api -@Experimental +@RequiresOptIn annotation class E open class Base { diff --git a/compiler/testData/diagnostics/testsWithStdLib/experimental/errors.kt b/compiler/testData/diagnostics/testsWithStdLib/experimental/errors.kt index 434c7f1c6e6..e2db43c83c9 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/experimental/errors.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/experimental/errors.kt @@ -1,9 +1,9 @@ -// !USE_EXPERIMENTAL: kotlin.Experimental +// !USE_EXPERIMENTAL: kotlin.RequiresOptIn // FILE: api.kt package api -@Experimental +@RequiresOptIn annotation class E open class Base { diff --git a/compiler/testData/diagnostics/testsWithStdLib/experimental/errors.txt b/compiler/testData/diagnostics/testsWithStdLib/experimental/errors.txt index 434d6cef32a..7f71b618832 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/experimental/errors.txt +++ b/compiler/testData/diagnostics/testsWithStdLib/experimental/errors.txt @@ -10,7 +10,7 @@ package api { public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } - @kotlin.Experimental public final annotation class E : kotlin.Annotation { + @kotlin.RequiresOptIn public final annotation class E : kotlin.Annotation { public constructor E() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int diff --git a/compiler/testData/diagnostics/testsWithStdLib/experimental/experimentalIsNotEnabled.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/experimental/experimentalIsNotEnabled.fir.kt index 4c9a92f8f84..4dada25aec0 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/experimental/experimentalIsNotEnabled.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/experimental/experimentalIsNotEnabled.fir.kt @@ -1,6 +1,6 @@ // FILE: api.kt -@Experimental +@RequiresOptIn annotation class Marker @Marker @@ -17,7 +17,7 @@ fun use2() { f() } -@UseExperimental(Marker::class) +@OptIn(Marker::class) fun use3() { f() } diff --git a/compiler/testData/diagnostics/testsWithStdLib/experimental/experimentalIsNotEnabled.kt b/compiler/testData/diagnostics/testsWithStdLib/experimental/experimentalIsNotEnabled.kt index 0f6612355ab..5b45f36b6b3 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/experimental/experimentalIsNotEnabled.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/experimental/experimentalIsNotEnabled.kt @@ -1,6 +1,6 @@ // FILE: api.kt -@Experimental +@RequiresOptIn annotation class Marker @Marker @@ -17,7 +17,7 @@ fun use2() { f() } -@UseExperimental(Marker::class) +@OptIn(Marker::class) fun use3() { f() } diff --git a/compiler/testData/diagnostics/testsWithStdLib/experimental/experimentalIsNotEnabled.txt b/compiler/testData/diagnostics/testsWithStdLib/experimental/experimentalIsNotEnabled.txt index 43578fca0a9..f192792172e 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/experimental/experimentalIsNotEnabled.txt +++ b/compiler/testData/diagnostics/testsWithStdLib/experimental/experimentalIsNotEnabled.txt @@ -3,9 +3,9 @@ package @Marker public fun f(): kotlin.Unit public fun use1(): kotlin.Unit @Marker public fun use2(): kotlin.Unit -@kotlin.UseExperimental(markerClass = {Marker::class}) public fun use3(): kotlin.Unit +@kotlin.OptIn(markerClass = {Marker::class}) public fun use3(): kotlin.Unit -@kotlin.Experimental public final annotation class Marker : kotlin.Annotation { +@kotlin.RequiresOptIn 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 diff --git a/compiler/testData/diagnostics/testsWithStdLib/experimental/experimentalOnWholeModule.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/experimental/experimentalOnWholeModule.fir.kt index b05884b7a67..09eaf8dff8e 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/experimental/experimentalOnWholeModule.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/experimental/experimentalOnWholeModule.fir.kt @@ -1,11 +1,11 @@ -// !USE_EXPERIMENTAL: kotlin.Experimental +// !USE_EXPERIMENTAL: kotlin.RequiresOptIn // !EXPERIMENTAL: api.ExperimentalAPI // MODULE: api // FILE: api.kt package api -@Experimental +@RequiresOptIn annotation class ExperimentalAPI @ExperimentalAPI diff --git a/compiler/testData/diagnostics/testsWithStdLib/experimental/experimentalOnWholeModule.kt b/compiler/testData/diagnostics/testsWithStdLib/experimental/experimentalOnWholeModule.kt index b05884b7a67..09eaf8dff8e 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/experimental/experimentalOnWholeModule.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/experimental/experimentalOnWholeModule.kt @@ -1,11 +1,11 @@ -// !USE_EXPERIMENTAL: kotlin.Experimental +// !USE_EXPERIMENTAL: kotlin.RequiresOptIn // !EXPERIMENTAL: api.ExperimentalAPI // MODULE: api // FILE: api.kt package api -@Experimental +@RequiresOptIn annotation class ExperimentalAPI @ExperimentalAPI diff --git a/compiler/testData/diagnostics/testsWithStdLib/experimental/experimentalOnWholeModule.txt b/compiler/testData/diagnostics/testsWithStdLib/experimental/experimentalOnWholeModule.txt index f383dbf207a..0a986b5f95c 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/experimental/experimentalOnWholeModule.txt +++ b/compiler/testData/diagnostics/testsWithStdLib/experimental/experimentalOnWholeModule.txt @@ -4,7 +4,7 @@ package package api { @api.ExperimentalAPI public fun function(): kotlin.String - @kotlin.Experimental public final annotation class ExperimentalAPI : kotlin.Annotation { + @kotlin.RequiresOptIn public final annotation class ExperimentalAPI : kotlin.Annotation { public constructor ExperimentalAPI() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int diff --git a/compiler/testData/diagnostics/testsWithStdLib/experimental/experimentalUnsignedLiterals.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/experimental/experimentalUnsignedLiterals.fir.kt index 2542462f639..58c62035861 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/experimental/experimentalUnsignedLiterals.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/experimental/experimentalUnsignedLiterals.fir.kt @@ -1,4 +1,4 @@ -// !USE_EXPERIMENTAL: kotlin.Experimental +// !USE_EXPERIMENTAL: kotlin.RequiresOptIn // !DIAGNOSTICS: -UNUSED_EXPRESSION, -UNUSED_VARIABLE, -UNUSED_PARAMETER fun test() { @@ -18,7 +18,7 @@ fun test() { 5u ) - @UseExperimental(ExperimentalUnsignedTypes::class) 42u + @OptIn(ExperimentalUnsignedTypes::class) 42u } fun takeAll( diff --git a/compiler/testData/diagnostics/testsWithStdLib/experimental/experimentalUnsignedLiterals.kt b/compiler/testData/diagnostics/testsWithStdLib/experimental/experimentalUnsignedLiterals.kt index 7ef2bae7e4e..b3727e9ce19 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/experimental/experimentalUnsignedLiterals.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/experimental/experimentalUnsignedLiterals.kt @@ -1,4 +1,4 @@ -// !USE_EXPERIMENTAL: kotlin.Experimental +// !USE_EXPERIMENTAL: kotlin.RequiresOptIn // !DIAGNOSTICS: -UNUSED_EXPRESSION, -UNUSED_VARIABLE, -UNUSED_PARAMETER fun test() { @@ -18,7 +18,7 @@ fun test() { 5u ) - @UseExperimental(ExperimentalUnsignedTypes::class) 42u + @OptIn(ExperimentalUnsignedTypes::class) 42u } fun takeAll( diff --git a/compiler/testData/diagnostics/testsWithStdLib/experimental/fullFqNameUsage.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/experimental/fullFqNameUsage.fir.kt index f3ef9111d2c..bcfdc99323b 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/experimental/fullFqNameUsage.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/experimental/fullFqNameUsage.fir.kt @@ -1,11 +1,11 @@ -// !USE_EXPERIMENTAL: kotlin.Experimental +// !USE_EXPERIMENTAL: kotlin.RequiresOptIn package test.abc -@Experimental +@RequiresOptIn annotation class E -@UseExperimental(test.abc.E::class) +@OptIn(test.abc.E::class) fun f() {} @test.abc.E diff --git a/compiler/testData/diagnostics/testsWithStdLib/experimental/fullFqNameUsage.kt b/compiler/testData/diagnostics/testsWithStdLib/experimental/fullFqNameUsage.kt index f3ef9111d2c..bcfdc99323b 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/experimental/fullFqNameUsage.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/experimental/fullFqNameUsage.kt @@ -1,11 +1,11 @@ -// !USE_EXPERIMENTAL: kotlin.Experimental +// !USE_EXPERIMENTAL: kotlin.RequiresOptIn package test.abc -@Experimental +@RequiresOptIn annotation class E -@UseExperimental(test.abc.E::class) +@OptIn(test.abc.E::class) fun f() {} @test.abc.E diff --git a/compiler/testData/diagnostics/testsWithStdLib/experimental/fullFqNameUsage.txt b/compiler/testData/diagnostics/testsWithStdLib/experimental/fullFqNameUsage.txt index a7d408f9197..ff68fc7a431 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/experimental/fullFqNameUsage.txt +++ b/compiler/testData/diagnostics/testsWithStdLib/experimental/fullFqNameUsage.txt @@ -3,10 +3,10 @@ package package test { package test.abc { - @kotlin.UseExperimental(markerClass = {test.abc.E::class}) public fun f(): kotlin.Unit + @kotlin.OptIn(markerClass = {test.abc.E::class}) public fun f(): kotlin.Unit @test.abc.E public fun g(): kotlin.Unit - @kotlin.Experimental public final annotation class E : kotlin.Annotation { + @kotlin.RequiresOptIn public final annotation class E : kotlin.Annotation { public constructor E() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int diff --git a/compiler/testData/diagnostics/testsWithStdLib/experimental/importStatement.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/experimental/importStatement.fir.kt index 724647e4367..4b18824c5bc 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/experimental/importStatement.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/experimental/importStatement.fir.kt @@ -1,9 +1,9 @@ -// !USE_EXPERIMENTAL: kotlin.Experimental +// !USE_EXPERIMENTAL: kotlin.RequiresOptIn // FILE: api.kt package feature.experimental.self -@Experimental +@RequiresOptIn annotation class ImportedMarker @ImportedMarker diff --git a/compiler/testData/diagnostics/testsWithStdLib/experimental/importStatement.kt b/compiler/testData/diagnostics/testsWithStdLib/experimental/importStatement.kt index 724647e4367..4b18824c5bc 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/experimental/importStatement.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/experimental/importStatement.kt @@ -1,9 +1,9 @@ -// !USE_EXPERIMENTAL: kotlin.Experimental +// !USE_EXPERIMENTAL: kotlin.RequiresOptIn // FILE: api.kt package feature.experimental.self -@Experimental +@RequiresOptIn annotation class ImportedMarker @ImportedMarker diff --git a/compiler/testData/diagnostics/testsWithStdLib/experimental/importStatement.txt b/compiler/testData/diagnostics/testsWithStdLib/experimental/importStatement.txt index 95bd83d66d3..3a8144ca653 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/experimental/importStatement.txt +++ b/compiler/testData/diagnostics/testsWithStdLib/experimental/importStatement.txt @@ -16,7 +16,7 @@ package feature { public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } - @kotlin.Experimental public final annotation class ImportedMarker : kotlin.Annotation { + @kotlin.RequiresOptIn public final annotation class ImportedMarker : kotlin.Annotation { public constructor ImportedMarker() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int diff --git a/compiler/testData/diagnostics/testsWithStdLib/experimental/incorrectTargetsForExperimentalAnnotation.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/experimental/incorrectTargetsForExperimentalAnnotation.fir.kt index 72719d13e86..384d0e37f0e 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/experimental/incorrectTargetsForExperimentalAnnotation.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/experimental/incorrectTargetsForExperimentalAnnotation.fir.kt @@ -1,25 +1,25 @@ -// !USE_EXPERIMENTAL: kotlin.Experimental +// !USE_EXPERIMENTAL: kotlin.RequiresOptIn // FILE: api.kt package api import kotlin.annotation.AnnotationTarget.* -@Experimental(Experimental.Level.WARNING) +@RequiresOptIn(RequiresOptIn.Level.WARNING) @Target(CLASS, ANNOTATION_CLASS, TYPE_PARAMETER, PROPERTY, FIELD, LOCAL_VARIABLE, VALUE_PARAMETER, CONSTRUCTOR, FUNCTION, PROPERTY_GETTER, PROPERTY_SETTER, TYPE, TYPEALIAS) annotation class E1 -@Experimental(Experimental.Level.WARNING) +@RequiresOptIn(RequiresOptIn.Level.WARNING) @Target(FILE) annotation class E2 -@Experimental(Experimental.Level.WARNING) +@RequiresOptIn(RequiresOptIn.Level.WARNING) @Target(EXPRESSION) @Retention(AnnotationRetention.SOURCE) annotation class E3 -@Experimental(Experimental.Level.WARNING) +@RequiresOptIn(RequiresOptIn.Level.WARNING) @Target(FILE, EXPRESSION) @Retention(AnnotationRetention.SOURCE) annotation class E4 diff --git a/compiler/testData/diagnostics/testsWithStdLib/experimental/incorrectTargetsForExperimentalAnnotation.kt b/compiler/testData/diagnostics/testsWithStdLib/experimental/incorrectTargetsForExperimentalAnnotation.kt index 8e25491a8bd..2e0c8e15551 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/experimental/incorrectTargetsForExperimentalAnnotation.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/experimental/incorrectTargetsForExperimentalAnnotation.kt @@ -1,25 +1,25 @@ -// !USE_EXPERIMENTAL: kotlin.Experimental +// !USE_EXPERIMENTAL: kotlin.RequiresOptIn // FILE: api.kt package api import kotlin.annotation.AnnotationTarget.* -@Experimental(Experimental.Level.WARNING) +@RequiresOptIn(RequiresOptIn.Level.WARNING) @Target(CLASS, ANNOTATION_CLASS, TYPE_PARAMETER, PROPERTY, FIELD, LOCAL_VARIABLE, VALUE_PARAMETER, CONSTRUCTOR, FUNCTION, PROPERTY_GETTER, PROPERTY_SETTER, TYPE, TYPEALIAS) annotation class E1 -@Experimental(Experimental.Level.WARNING) +@RequiresOptIn(RequiresOptIn.Level.WARNING) @Target(FILE) annotation class E2 -@Experimental(Experimental.Level.WARNING) +@RequiresOptIn(RequiresOptIn.Level.WARNING) @Target(EXPRESSION) @Retention(AnnotationRetention.SOURCE) annotation class E3 -@Experimental(Experimental.Level.WARNING) +@RequiresOptIn(RequiresOptIn.Level.WARNING) @Target(FILE, EXPRESSION) @Retention(AnnotationRetention.SOURCE) annotation class E4 diff --git a/compiler/testData/diagnostics/testsWithStdLib/experimental/incorrectTargetsForExperimentalAnnotation.txt b/compiler/testData/diagnostics/testsWithStdLib/experimental/incorrectTargetsForExperimentalAnnotation.txt index 8e584841c67..8ff5d4813e9 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/experimental/incorrectTargetsForExperimentalAnnotation.txt +++ b/compiler/testData/diagnostics/testsWithStdLib/experimental/incorrectTargetsForExperimentalAnnotation.txt @@ -2,28 +2,28 @@ package package api { - @kotlin.Experimental(level = Level.WARNING) @kotlin.annotation.Target(allowedTargets = {AnnotationTarget.CLASS, AnnotationTarget.ANNOTATION_CLASS, AnnotationTarget.TYPE_PARAMETER, AnnotationTarget.PROPERTY, AnnotationTarget.FIELD, AnnotationTarget.LOCAL_VARIABLE, AnnotationTarget.VALUE_PARAMETER, AnnotationTarget.CONSTRUCTOR, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER, AnnotationTarget.TYPE, AnnotationTarget.TYPEALIAS}) public final annotation class E1 : kotlin.Annotation { + @kotlin.RequiresOptIn(level = Level.WARNING) @kotlin.annotation.Target(allowedTargets = {AnnotationTarget.CLASS, AnnotationTarget.ANNOTATION_CLASS, AnnotationTarget.TYPE_PARAMETER, AnnotationTarget.PROPERTY, AnnotationTarget.FIELD, AnnotationTarget.LOCAL_VARIABLE, AnnotationTarget.VALUE_PARAMETER, AnnotationTarget.CONSTRUCTOR, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER, AnnotationTarget.TYPE, AnnotationTarget.TYPEALIAS}) public final annotation class E1 : kotlin.Annotation { public constructor E1() 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 } - @kotlin.Experimental(level = Level.WARNING) @kotlin.annotation.Target(allowedTargets = {AnnotationTarget.FILE}) public final annotation class E2 : kotlin.Annotation { + @kotlin.RequiresOptIn(level = Level.WARNING) @kotlin.annotation.Target(allowedTargets = {AnnotationTarget.FILE}) public final annotation class E2 : kotlin.Annotation { public constructor E2() 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 } - @kotlin.Experimental(level = Level.WARNING) @kotlin.annotation.Target(allowedTargets = {AnnotationTarget.EXPRESSION}) @kotlin.annotation.Retention(value = AnnotationRetention.SOURCE) public final annotation class E3 : kotlin.Annotation { + @kotlin.RequiresOptIn(level = Level.WARNING) @kotlin.annotation.Target(allowedTargets = {AnnotationTarget.EXPRESSION}) @kotlin.annotation.Retention(value = AnnotationRetention.SOURCE) public final annotation class E3 : kotlin.Annotation { public constructor E3() 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 } - @kotlin.Experimental(level = Level.WARNING) @kotlin.annotation.Target(allowedTargets = {AnnotationTarget.FILE, AnnotationTarget.EXPRESSION}) @kotlin.annotation.Retention(value = AnnotationRetention.SOURCE) public final annotation class E4 : kotlin.Annotation { + @kotlin.RequiresOptIn(level = Level.WARNING) @kotlin.annotation.Target(allowedTargets = {AnnotationTarget.FILE, AnnotationTarget.EXPRESSION}) @kotlin.annotation.Retention(value = AnnotationRetention.SOURCE) public final annotation class E4 : kotlin.Annotation { public constructor E4() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int diff --git a/compiler/testData/diagnostics/testsWithStdLib/experimental/incorrectUseExperimental.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/experimental/incorrectUseExperimental.fir.kt index afe947cad08..5154dcec394 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/experimental/incorrectUseExperimental.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/experimental/incorrectUseExperimental.fir.kt @@ -1,9 +1,9 @@ -// !USE_EXPERIMENTAL: kotlin.Experimental +// !USE_EXPERIMENTAL: kotlin.RequiresOptIn annotation class NotAMarker -@UseExperimental +@OptIn fun f1() {} -@UseExperimental(NotAMarker::class) +@OptIn(NotAMarker::class) fun f2() {} diff --git a/compiler/testData/diagnostics/testsWithStdLib/experimental/incorrectUseExperimental.kt b/compiler/testData/diagnostics/testsWithStdLib/experimental/incorrectUseExperimental.kt index 9d10de7a486..96f5e61ae04 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/experimental/incorrectUseExperimental.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/experimental/incorrectUseExperimental.kt @@ -1,9 +1,9 @@ -// !USE_EXPERIMENTAL: kotlin.Experimental +// !USE_EXPERIMENTAL: kotlin.RequiresOptIn annotation class NotAMarker -@UseExperimental +@OptIn fun f1() {} -@UseExperimental(NotAMarker::class) +@OptIn(NotAMarker::class) fun f2() {} diff --git a/compiler/testData/diagnostics/testsWithStdLib/experimental/incorrectUseExperimental.txt b/compiler/testData/diagnostics/testsWithStdLib/experimental/incorrectUseExperimental.txt index c210e94bb87..634d9f86998 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/experimental/incorrectUseExperimental.txt +++ b/compiler/testData/diagnostics/testsWithStdLib/experimental/incorrectUseExperimental.txt @@ -1,7 +1,7 @@ package -@kotlin.UseExperimental(markerClass = {}) public fun f1(): kotlin.Unit -@kotlin.UseExperimental(markerClass = {NotAMarker::class}) public fun f2(): kotlin.Unit +@kotlin.OptIn(markerClass = {}) public fun f1(): kotlin.Unit +@kotlin.OptIn(markerClass = {NotAMarker::class}) public fun f2(): kotlin.Unit public final annotation class NotAMarker : kotlin.Annotation { public constructor NotAMarker() diff --git a/compiler/testData/diagnostics/testsWithStdLib/experimental/override.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/experimental/override.fir.kt index 5af4512d79f..a8ba479ebbd 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/experimental/override.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/experimental/override.fir.kt @@ -1,9 +1,9 @@ -// !USE_EXPERIMENTAL: kotlin.Experimental +// !USE_EXPERIMENTAL: kotlin.RequiresOptIn // FILE: api.kt package api -@Experimental(Experimental.Level.WARNING) +@RequiresOptIn(RequiresOptIn.Level.WARNING) annotation class E open class Base { diff --git a/compiler/testData/diagnostics/testsWithStdLib/experimental/override.kt b/compiler/testData/diagnostics/testsWithStdLib/experimental/override.kt index d6982906597..be6181b8740 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/experimental/override.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/experimental/override.kt @@ -1,9 +1,9 @@ -// !USE_EXPERIMENTAL: kotlin.Experimental +// !USE_EXPERIMENTAL: kotlin.RequiresOptIn // FILE: api.kt package api -@Experimental(Experimental.Level.WARNING) +@RequiresOptIn(RequiresOptIn.Level.WARNING) annotation class E open class Base { diff --git a/compiler/testData/diagnostics/testsWithStdLib/experimental/override.txt b/compiler/testData/diagnostics/testsWithStdLib/experimental/override.txt index e77abeb327a..100b7f17435 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/experimental/override.txt +++ b/compiler/testData/diagnostics/testsWithStdLib/experimental/override.txt @@ -18,7 +18,7 @@ package api { public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } - @kotlin.Experimental(level = Level.WARNING) public final annotation class E : kotlin.Annotation { + @kotlin.RequiresOptIn(level = Level.WARNING) public final annotation class E : kotlin.Annotation { public constructor E() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int diff --git a/compiler/testData/diagnostics/testsWithStdLib/experimental/overrideDifferentExperimentalities.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/experimental/overrideDifferentExperimentalities.fir.kt index a0702b4b150..e50a444a7b7 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/experimental/overrideDifferentExperimentalities.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/experimental/overrideDifferentExperimentalities.fir.kt @@ -1,8 +1,8 @@ -// !USE_EXPERIMENTAL: kotlin.Experimental +// !USE_EXPERIMENTAL: kotlin.RequiresOptIn -@Experimental(Experimental.Level.WARNING) +@RequiresOptIn(RequiresOptIn.Level.WARNING) annotation class E1 -@Experimental(Experimental.Level.WARNING) +@RequiresOptIn(RequiresOptIn.Level.WARNING) annotation class E3 interface Base1 { diff --git a/compiler/testData/diagnostics/testsWithStdLib/experimental/overrideDifferentExperimentalities.kt b/compiler/testData/diagnostics/testsWithStdLib/experimental/overrideDifferentExperimentalities.kt index 340b13b50fd..31a5a112682 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/experimental/overrideDifferentExperimentalities.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/experimental/overrideDifferentExperimentalities.kt @@ -1,8 +1,8 @@ -// !USE_EXPERIMENTAL: kotlin.Experimental +// !USE_EXPERIMENTAL: kotlin.RequiresOptIn -@Experimental(Experimental.Level.WARNING) +@RequiresOptIn(RequiresOptIn.Level.WARNING) annotation class E1 -@Experimental(Experimental.Level.WARNING) +@RequiresOptIn(RequiresOptIn.Level.WARNING) annotation class E3 interface Base1 { diff --git a/compiler/testData/diagnostics/testsWithStdLib/experimental/overrideDifferentExperimentalities.txt b/compiler/testData/diagnostics/testsWithStdLib/experimental/overrideDifferentExperimentalities.txt index 873a7597194..67499a50027 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/experimental/overrideDifferentExperimentalities.txt +++ b/compiler/testData/diagnostics/testsWithStdLib/experimental/overrideDifferentExperimentalities.txt @@ -45,14 +45,14 @@ public final class DerivedC : Base1, Base2, Base3 { public open override /*3*/ /*fake_override*/ fun toString(): kotlin.String } -@kotlin.Experimental(level = Level.WARNING) public final annotation class E1 : kotlin.Annotation { +@kotlin.RequiresOptIn(level = Level.WARNING) public final annotation class E1 : kotlin.Annotation { public constructor E1() 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 } -@kotlin.Experimental(level = Level.WARNING) public final annotation class E3 : kotlin.Annotation { +@kotlin.RequiresOptIn(level = Level.WARNING) public final annotation class E3 : kotlin.Annotation { public constructor E3() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int diff --git a/compiler/testData/diagnostics/testsWithStdLib/experimental/scripts.kts b/compiler/testData/diagnostics/testsWithStdLib/experimental/scripts.kts index 0995f670339..f10f81c703e 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/experimental/scripts.kts +++ b/compiler/testData/diagnostics/testsWithStdLib/experimental/scripts.kts @@ -1,10 +1,10 @@ -// !USE_EXPERIMENTAL: kotlin.Experimental +// !USE_EXPERIMENTAL: kotlin.RequiresOptIn // !DIAGNOSTICS: -UNUSED_VARIABLE // FILE: api.kt package api -@Experimental(Experimental.Level.WARNING) +@RequiresOptIn(RequiresOptIn.Level.WARNING) annotation class ExperimentalAPI @ExperimentalAPI @@ -24,7 +24,7 @@ fun use() { // FILE: usage-use.kts -@file:UseExperimental(ExperimentalAPI::class) +@file:OptIn(ExperimentalAPI::class) import api.* fun use() { diff --git a/compiler/testData/diagnostics/testsWithStdLib/experimental/scripts.txt b/compiler/testData/diagnostics/testsWithStdLib/experimental/scripts.txt index ca5d14c675e..051c6c30335 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/experimental/scripts.txt +++ b/compiler/testData/diagnostics/testsWithStdLib/experimental/scripts.txt @@ -30,7 +30,7 @@ public final class Usage_use : kotlin.script.templates.standard.ScriptTemplateWi package api { @api.ExperimentalAPI public fun function(): kotlin.String - @kotlin.Experimental(level = Level.WARNING) public final annotation class ExperimentalAPI : kotlin.Annotation { + @kotlin.RequiresOptIn(level = Level.WARNING) public final annotation class ExperimentalAPI : kotlin.Annotation { public constructor ExperimentalAPI() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int diff --git a/compiler/testData/diagnostics/testsWithStdLib/experimental/topLevel.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/experimental/topLevel.fir.kt index 71779d83afa..a0d50df50a7 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/experimental/topLevel.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/experimental/topLevel.fir.kt @@ -1,10 +1,10 @@ -// !USE_EXPERIMENTAL: kotlin.Experimental +// !USE_EXPERIMENTAL: kotlin.RequiresOptIn // !DIAGNOSTICS: -UNUSED_VARIABLE // FILE: api.kt package api -@Experimental(Experimental.Level.WARNING) +@RequiresOptIn(RequiresOptIn.Level.WARNING) @Target(AnnotationTarget.TYPE, AnnotationTarget.CLASS, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY, AnnotationTarget.TYPEALIAS, AnnotationTarget.VALUE_PARAMETER) annotation class ExperimentalAPI @@ -47,7 +47,7 @@ package usage2 import api.* fun useAll() { - @UseExperimental(ExperimentalAPI::class) + @OptIn(ExperimentalAPI::class) { function() property @@ -55,7 +55,7 @@ fun useAll() { }() } -@UseExperimental(ExperimentalAPI::class) +@OptIn(ExperimentalAPI::class) class Use { fun useAll() { function() diff --git a/compiler/testData/diagnostics/testsWithStdLib/experimental/topLevel.kt b/compiler/testData/diagnostics/testsWithStdLib/experimental/topLevel.kt index 60a441da5f7..6bdde3e0fb7 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/experimental/topLevel.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/experimental/topLevel.kt @@ -1,10 +1,10 @@ -// !USE_EXPERIMENTAL: kotlin.Experimental +// !USE_EXPERIMENTAL: kotlin.RequiresOptIn // !DIAGNOSTICS: -UNUSED_VARIABLE // FILE: api.kt package api -@Experimental(Experimental.Level.WARNING) +@RequiresOptIn(RequiresOptIn.Level.WARNING) @Target(AnnotationTarget.TYPE, AnnotationTarget.CLASS, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY, AnnotationTarget.TYPEALIAS, AnnotationTarget.VALUE_PARAMETER) annotation class ExperimentalAPI @@ -47,7 +47,7 @@ package usage2 import api.* fun useAll() { - @UseExperimental(ExperimentalAPI::class) + @OptIn(ExperimentalAPI::class) { function() property @@ -55,7 +55,7 @@ fun useAll() { }() } -@UseExperimental(ExperimentalAPI::class) +@OptIn(ExperimentalAPI::class) class Use { fun useAll() { function() diff --git a/compiler/testData/diagnostics/testsWithStdLib/experimental/topLevel.txt b/compiler/testData/diagnostics/testsWithStdLib/experimental/topLevel.txt index d60b25ae6fa..9010130875f 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/experimental/topLevel.txt +++ b/compiler/testData/diagnostics/testsWithStdLib/experimental/topLevel.txt @@ -4,7 +4,7 @@ package api { @api.ExperimentalAPI public val property: kotlin.String = "" @api.ExperimentalAPI public fun function(): kotlin.String - @kotlin.Experimental(level = Level.WARNING) @kotlin.annotation.Target(allowedTargets = {AnnotationTarget.TYPE, AnnotationTarget.CLASS, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY, AnnotationTarget.TYPEALIAS, AnnotationTarget.VALUE_PARAMETER}) public final annotation class ExperimentalAPI : kotlin.Annotation { + @kotlin.RequiresOptIn(level = Level.WARNING) @kotlin.annotation.Target(allowedTargets = {AnnotationTarget.TYPE, AnnotationTarget.CLASS, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY, AnnotationTarget.TYPEALIAS, AnnotationTarget.VALUE_PARAMETER}) public final annotation class ExperimentalAPI : kotlin.Annotation { public constructor ExperimentalAPI() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int @@ -28,7 +28,7 @@ package usage1 { package usage2 { public fun useAll(): kotlin.Unit - @kotlin.UseExperimental(markerClass = {api.ExperimentalAPI::class}) public final class Use { + @kotlin.OptIn(markerClass = {api.ExperimentalAPI::class}) public final class Use { public constructor Use() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int diff --git a/compiler/testData/diagnostics/testsWithStdLib/experimental/typealias.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/experimental/typealias.fir.kt index b101b799956..66d9461bcdf 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/experimental/typealias.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/experimental/typealias.fir.kt @@ -1,9 +1,9 @@ -// !USE_EXPERIMENTAL: kotlin.Experimental +// !USE_EXPERIMENTAL: kotlin.RequiresOptIn // FILE: api.kt package api -@Experimental +@RequiresOptIn @Target(AnnotationTarget.CLASS) annotation class ExperimentalAPI diff --git a/compiler/testData/diagnostics/testsWithStdLib/experimental/typealias.kt b/compiler/testData/diagnostics/testsWithStdLib/experimental/typealias.kt index 3b8902c9a3a..8454f3ad510 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/experimental/typealias.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/experimental/typealias.kt @@ -1,9 +1,9 @@ -// !USE_EXPERIMENTAL: kotlin.Experimental +// !USE_EXPERIMENTAL: kotlin.RequiresOptIn // FILE: api.kt package api -@Experimental +@RequiresOptIn @Target(AnnotationTarget.CLASS) annotation class ExperimentalAPI diff --git a/compiler/testData/diagnostics/testsWithStdLib/experimental/typealias.txt b/compiler/testData/diagnostics/testsWithStdLib/experimental/typealias.txt index 770d6360eab..b6c7a495ec0 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/experimental/typealias.txt +++ b/compiler/testData/diagnostics/testsWithStdLib/experimental/typealias.txt @@ -2,7 +2,7 @@ package package api { - @kotlin.Experimental @kotlin.annotation.Target(allowedTargets = {AnnotationTarget.CLASS}) public final annotation class ExperimentalAPI : kotlin.Annotation { + @kotlin.RequiresOptIn @kotlin.annotation.Target(allowedTargets = {AnnotationTarget.CLASS}) public final annotation class ExperimentalAPI : kotlin.Annotation { public constructor ExperimentalAPI() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int diff --git a/compiler/testData/diagnostics/testsWithStdLib/experimental/usageNotAsAnnotation.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/experimental/usageNotAsAnnotation.fir.kt index fd4db89d150..d2ef7cacb02 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/experimental/usageNotAsAnnotation.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/experimental/usageNotAsAnnotation.fir.kt @@ -1,5 +1,5 @@ // !LANGUAGE: +NestedClassesInAnnotations -// !USE_EXPERIMENTAL: kotlin.Experimental +// !USE_EXPERIMENTAL: kotlin.RequiresOptIn // !DIAGNOSTICS: -UNUSED_PARAMETER // FILE: api.kt @@ -8,25 +8,25 @@ package test import kotlin.reflect.KClass // Usages in import should be OK -import kotlin.Experimental.Level.* -import kotlin.Experimental.Level -import kotlin.Experimental +import kotlin.RequiresOptIn.Level.* +import kotlin.RequiresOptIn.Level +import kotlin.RequiresOptIn // Usages with FQ names should be OK -@kotlin.Experimental(kotlin.Experimental.Level.ERROR) +@kotlin.RequiresOptIn(kotlin.RequiresOptIn.Level.ERROR) annotation class M // Usages as types should be errors -fun f1(e: Experimental) {} -fun f2(u: UseExperimental?) {} +fun f1(e: RequiresOptIn) {} +fun f2(u: OptIn?) {} -typealias Experimental0 = Experimental -typealias UseExperimental0 = UseExperimental +typealias Experimental0 = RequiresOptIn +typealias OptIn0 = OptIn fun f3(e: Experimental0 /* TODO */) {} -fun f4(u: UseExperimental0 /* TODO */) {} +fun f4(u: OptIn0 /* TODO */) {} // Usages as ::class literals should be errors @@ -34,17 +34,17 @@ fun f4(u: UseExperimental0 /* TODO */) {} annotation class VarargKClasses(vararg val k: KClass<*>) @VarargKClasses( - Experimental::class, - UseExperimental::class, - kotlin.Experimental::class, - kotlin.UseExperimental::class + RequiresOptIn::class, + OptIn::class, + kotlin.RequiresOptIn::class, + kotlin.OptIn::class ) fun f5() {} // Usages of markers as types should be errors -@Experimental +@RequiresOptIn annotation class Marker { class NestedClass diff --git a/compiler/testData/diagnostics/testsWithStdLib/experimental/usageNotAsAnnotation.kt b/compiler/testData/diagnostics/testsWithStdLib/experimental/usageNotAsAnnotation.kt index 6dd19ba3273..a44700b9643 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/experimental/usageNotAsAnnotation.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/experimental/usageNotAsAnnotation.kt @@ -1,5 +1,5 @@ // !LANGUAGE: +NestedClassesInAnnotations -// !USE_EXPERIMENTAL: kotlin.Experimental +// !USE_EXPERIMENTAL: kotlin.RequiresOptIn // !DIAGNOSTICS: -UNUSED_PARAMETER // FILE: api.kt @@ -8,25 +8,25 @@ package test import kotlin.reflect.KClass // Usages in import should be OK -import kotlin.Experimental.Level.* -import kotlin.Experimental.Level -import kotlin.Experimental +import kotlin.RequiresOptIn.Level.* +import kotlin.RequiresOptIn.Level +import kotlin.RequiresOptIn // Usages with FQ names should be OK -@kotlin.Experimental(kotlin.Experimental.Level.ERROR) +@kotlin.RequiresOptIn(kotlin.RequiresOptIn.Level.ERROR) annotation class M // Usages as types should be errors -fun f1(e: Experimental) {} -fun f2(u: UseExperimental?) {} +fun f1(e: RequiresOptIn) {} +fun f2(u: OptIn?) {} -typealias Experimental0 = Experimental -typealias UseExperimental0 = UseExperimental +typealias Experimental0 = RequiresOptIn +typealias OptIn0 = OptIn fun f3(e: Experimental0 /* TODO */) {} -fun f4(u: UseExperimental0 /* TODO */) {} +fun f4(u: OptIn0 /* TODO */) {} // Usages as ::class literals should be errors @@ -34,17 +34,17 @@ fun f4(u: UseExperimental0 /* TODO */) {} annotation class VarargKClasses(vararg val k: KClass<*>) @VarargKClasses( - Experimental::class, - UseExperimental::class, - kotlin.Experimental::class, - kotlin.UseExperimental::class + RequiresOptIn::class, + OptIn::class, + kotlin.RequiresOptIn::class, + kotlin.OptIn::class ) fun f5() {} // Usages of markers as types should be errors -@Experimental +@RequiresOptIn annotation class Marker { class NestedClass diff --git a/compiler/testData/diagnostics/testsWithStdLib/experimental/usageNotAsAnnotation.txt b/compiler/testData/diagnostics/testsWithStdLib/experimental/usageNotAsAnnotation.txt index e667fa24982..808449a8811 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/experimental/usageNotAsAnnotation.txt +++ b/compiler/testData/diagnostics/testsWithStdLib/experimental/usageNotAsAnnotation.txt @@ -1,25 +1,25 @@ package package test { - public fun f1(/*0*/ e: kotlin.Experimental): kotlin.Unit + public fun f1(/*0*/ e: kotlin.RequiresOptIn): kotlin.Unit public fun f10(/*0*/ m: test.Marker.NestedClass): kotlin.Unit - public fun f2(/*0*/ u: kotlin.UseExperimental?): kotlin.Unit - public fun f3(/*0*/ e: test.Experimental0 /* = kotlin.Experimental */): kotlin.Unit - public fun f4(/*0*/ u: test.UseExperimental0 /* = kotlin.UseExperimental */): kotlin.Unit - @test.VarargKClasses(k = {kotlin.Experimental::class, kotlin.UseExperimental::class, kotlin.Experimental::class, kotlin.UseExperimental::class}) public fun f5(): kotlin.Unit + public fun f2(/*0*/ u: kotlin.OptIn?): kotlin.Unit + public fun f3(/*0*/ e: test.Experimental0 /* = kotlin.RequiresOptIn */): kotlin.Unit + public fun f4(/*0*/ u: test.OptIn0 /* = kotlin.OptIn */): kotlin.Unit + @test.VarargKClasses(k = {kotlin.RequiresOptIn::class, kotlin.OptIn::class, kotlin.RequiresOptIn::class, kotlin.OptIn::class}) public fun f5(): kotlin.Unit public fun f6(/*0*/ m: test.Marker): kotlin.Unit public fun f7(): kotlin.collections.List? public fun f8(): test.Marker? public fun f9(/*0*/ m: test.Marker0 /* = test.Marker */): kotlin.Unit - @kotlin.Experimental(level = Level.ERROR) public final annotation class M : kotlin.Annotation { + @kotlin.RequiresOptIn(level = Level.ERROR) public final annotation class M : kotlin.Annotation { public constructor M() 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 } - @kotlin.Experimental public final annotation class Marker : kotlin.Annotation { + @kotlin.RequiresOptIn 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 @@ -48,7 +48,7 @@ package test { public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } - public typealias Experimental0 = kotlin.Experimental + public typealias Experimental0 = kotlin.RequiresOptIn public typealias Marker0 = test.Marker - public typealias UseExperimental0 = kotlin.UseExperimental + public typealias OptIn0 = kotlin.OptIn } diff --git a/compiler/testData/diagnostics/testsWithStdLib/experimental/useExperimentalOnFile.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/experimental/useExperimentalOnFile.fir.kt index 4eade3474ec..819bf3a6e07 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/experimental/useExperimentalOnFile.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/experimental/useExperimentalOnFile.fir.kt @@ -1,13 +1,13 @@ -// !USE_EXPERIMENTAL: kotlin.Experimental +// !USE_EXPERIMENTAL: kotlin.RequiresOptIn // FILE: api.kt package api -@Experimental(Experimental.Level.WARNING) +@RequiresOptIn(RequiresOptIn.Level.WARNING) @Target(AnnotationTarget.FUNCTION) annotation class ExperimentalAPI1 -@Experimental(Experimental.Level.WARNING) +@RequiresOptIn(RequiresOptIn.Level.WARNING) @Target(AnnotationTarget.FUNCTION) annotation class ExperimentalAPI2 @@ -19,7 +19,7 @@ fun runtime() {} // FILE: usage.kt -@file:UseExperimental(ExperimentalAPI1::class) +@file:OptIn(ExperimentalAPI1::class) package usage import api.* diff --git a/compiler/testData/diagnostics/testsWithStdLib/experimental/useExperimentalOnFile.kt b/compiler/testData/diagnostics/testsWithStdLib/experimental/useExperimentalOnFile.kt index 59004a5b0ac..f05ba2f28ac 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/experimental/useExperimentalOnFile.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/experimental/useExperimentalOnFile.kt @@ -1,13 +1,13 @@ -// !USE_EXPERIMENTAL: kotlin.Experimental +// !USE_EXPERIMENTAL: kotlin.RequiresOptIn // FILE: api.kt package api -@Experimental(Experimental.Level.WARNING) +@RequiresOptIn(RequiresOptIn.Level.WARNING) @Target(AnnotationTarget.FUNCTION) annotation class ExperimentalAPI1 -@Experimental(Experimental.Level.WARNING) +@RequiresOptIn(RequiresOptIn.Level.WARNING) @Target(AnnotationTarget.FUNCTION) annotation class ExperimentalAPI2 @@ -19,7 +19,7 @@ fun runtime() {} // FILE: usage.kt -@file:UseExperimental(ExperimentalAPI1::class) +@file:OptIn(ExperimentalAPI1::class) package usage import api.* diff --git a/compiler/testData/diagnostics/testsWithStdLib/experimental/useExperimentalOnFile.txt b/compiler/testData/diagnostics/testsWithStdLib/experimental/useExperimentalOnFile.txt index 1e0dee68665..4ff26cea44a 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/experimental/useExperimentalOnFile.txt +++ b/compiler/testData/diagnostics/testsWithStdLib/experimental/useExperimentalOnFile.txt @@ -4,14 +4,14 @@ package api { @api.ExperimentalAPI1 public fun compilation(): kotlin.Unit @api.ExperimentalAPI2 public fun runtime(): kotlin.Unit - @kotlin.Experimental(level = Level.WARNING) @kotlin.annotation.Target(allowedTargets = {AnnotationTarget.FUNCTION}) public final annotation class ExperimentalAPI1 : kotlin.Annotation { + @kotlin.RequiresOptIn(level = Level.WARNING) @kotlin.annotation.Target(allowedTargets = {AnnotationTarget.FUNCTION}) public final annotation class ExperimentalAPI1 : kotlin.Annotation { public constructor ExperimentalAPI1() 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 } - @kotlin.Experimental(level = Level.WARNING) @kotlin.annotation.Target(allowedTargets = {AnnotationTarget.FUNCTION}) public final annotation class ExperimentalAPI2 : kotlin.Annotation { + @kotlin.RequiresOptIn(level = Level.WARNING) @kotlin.annotation.Target(allowedTargets = {AnnotationTarget.FUNCTION}) public final annotation class ExperimentalAPI2 : kotlin.Annotation { public constructor ExperimentalAPI2() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int diff --git a/compiler/testData/diagnostics/testsWithStdLib/experimental/useExperimentalOnFileWithVeryExperimentalMarker.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/experimental/useExperimentalOnFileWithVeryExperimentalMarker.fir.kt index 02dea53ad33..7b5956ed159 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/experimental/useExperimentalOnFileWithVeryExperimentalMarker.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/experimental/useExperimentalOnFileWithVeryExperimentalMarker.fir.kt @@ -1,13 +1,13 @@ -// !USE_EXPERIMENTAL: kotlin.Experimental +// !USE_EXPERIMENTAL: kotlin.RequiresOptIn // FILE: api.kt package api -@Experimental(Experimental.Level.WARNING) +@RequiresOptIn(RequiresOptIn.Level.WARNING) annotation class ExperimentalAPI @ExperimentalAPI -@Experimental(Experimental.Level.WARNING) +@RequiresOptIn(RequiresOptIn.Level.WARNING) annotation class VeryExperimentalAPI @ExperimentalAPI @@ -19,7 +19,7 @@ fun g() {} // FILE: usage.kt -@file:UseExperimental(ExperimentalAPI::class, VeryExperimentalAPI::class) +@file:OptIn(ExperimentalAPI::class, VeryExperimentalAPI::class) package usage import api.* diff --git a/compiler/testData/diagnostics/testsWithStdLib/experimental/useExperimentalOnFileWithVeryExperimentalMarker.kt b/compiler/testData/diagnostics/testsWithStdLib/experimental/useExperimentalOnFileWithVeryExperimentalMarker.kt index 02dea53ad33..7b5956ed159 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/experimental/useExperimentalOnFileWithVeryExperimentalMarker.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/experimental/useExperimentalOnFileWithVeryExperimentalMarker.kt @@ -1,13 +1,13 @@ -// !USE_EXPERIMENTAL: kotlin.Experimental +// !USE_EXPERIMENTAL: kotlin.RequiresOptIn // FILE: api.kt package api -@Experimental(Experimental.Level.WARNING) +@RequiresOptIn(RequiresOptIn.Level.WARNING) annotation class ExperimentalAPI @ExperimentalAPI -@Experimental(Experimental.Level.WARNING) +@RequiresOptIn(RequiresOptIn.Level.WARNING) annotation class VeryExperimentalAPI @ExperimentalAPI @@ -19,7 +19,7 @@ fun g() {} // FILE: usage.kt -@file:UseExperimental(ExperimentalAPI::class, VeryExperimentalAPI::class) +@file:OptIn(ExperimentalAPI::class, VeryExperimentalAPI::class) package usage import api.* diff --git a/compiler/testData/diagnostics/testsWithStdLib/experimental/useExperimentalOnFileWithVeryExperimentalMarker.txt b/compiler/testData/diagnostics/testsWithStdLib/experimental/useExperimentalOnFileWithVeryExperimentalMarker.txt index 9b62008bbe6..6485db9b0eb 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/experimental/useExperimentalOnFileWithVeryExperimentalMarker.txt +++ b/compiler/testData/diagnostics/testsWithStdLib/experimental/useExperimentalOnFileWithVeryExperimentalMarker.txt @@ -4,14 +4,14 @@ package api { @api.ExperimentalAPI @api.VeryExperimentalAPI public fun f(): kotlin.Unit @api.ExperimentalAPI public fun g(): kotlin.Unit - @kotlin.Experimental(level = Level.WARNING) public final annotation class ExperimentalAPI : kotlin.Annotation { + @kotlin.RequiresOptIn(level = Level.WARNING) public final annotation class ExperimentalAPI : kotlin.Annotation { public constructor ExperimentalAPI() 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 } - @api.ExperimentalAPI @kotlin.Experimental(level = Level.WARNING) public final annotation class VeryExperimentalAPI : kotlin.Annotation { + @api.ExperimentalAPI @kotlin.RequiresOptIn(level = Level.WARNING) public final annotation class VeryExperimentalAPI : kotlin.Annotation { public constructor VeryExperimentalAPI() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int diff --git a/compiler/testData/diagnostics/testsWithStdLib/experimental/useExperimentalOnWholeModule.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/experimental/useExperimentalOnWholeModule.fir.kt index ceef76351ea..5db3e27b54e 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/experimental/useExperimentalOnWholeModule.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/experimental/useExperimentalOnWholeModule.fir.kt @@ -1,10 +1,10 @@ -// !USE_EXPERIMENTAL: kotlin.Experimental api.ExperimentalAPI +// !USE_EXPERIMENTAL: kotlin.RequiresOptIn api.ExperimentalAPI // MODULE: api // FILE: api.kt package api -@Experimental(Experimental.Level.ERROR) +@RequiresOptIn(RequiresOptIn.Level.ERROR) annotation class ExperimentalAPI @ExperimentalAPI diff --git a/compiler/testData/diagnostics/testsWithStdLib/experimental/useExperimentalOnWholeModule.kt b/compiler/testData/diagnostics/testsWithStdLib/experimental/useExperimentalOnWholeModule.kt index ceef76351ea..5db3e27b54e 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/experimental/useExperimentalOnWholeModule.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/experimental/useExperimentalOnWholeModule.kt @@ -1,10 +1,10 @@ -// !USE_EXPERIMENTAL: kotlin.Experimental api.ExperimentalAPI +// !USE_EXPERIMENTAL: kotlin.RequiresOptIn api.ExperimentalAPI // MODULE: api // FILE: api.kt package api -@Experimental(Experimental.Level.ERROR) +@RequiresOptIn(RequiresOptIn.Level.ERROR) annotation class ExperimentalAPI @ExperimentalAPI diff --git a/compiler/testData/diagnostics/testsWithStdLib/experimental/useExperimentalOnWholeModule.txt b/compiler/testData/diagnostics/testsWithStdLib/experimental/useExperimentalOnWholeModule.txt index 8c3b49b17b1..f3f4d5ae8c3 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/experimental/useExperimentalOnWholeModule.txt +++ b/compiler/testData/diagnostics/testsWithStdLib/experimental/useExperimentalOnWholeModule.txt @@ -4,7 +4,7 @@ package package api { @api.ExperimentalAPI public fun function(): kotlin.String - @kotlin.Experimental(level = Level.ERROR) public final annotation class ExperimentalAPI : kotlin.Annotation { + @kotlin.RequiresOptIn(level = Level.ERROR) public final annotation class ExperimentalAPI : kotlin.Annotation { public constructor ExperimentalAPI() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int diff --git a/compiler/testData/diagnostics/testsWithStdLib/experimental/useExperimentalTargets.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/experimental/useExperimentalTargets.fir.kt index ca8d9b387c9..c11c525ac07 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/experimental/useExperimentalTargets.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/experimental/useExperimentalTargets.fir.kt @@ -1,10 +1,10 @@ -// !USE_EXPERIMENTAL: kotlin.Experimental +// !USE_EXPERIMENTAL: kotlin.RequiresOptIn // !DIAGNOSTICS: -UNUSED_PARAMETER // FILE: api.kt package api -@Experimental(Experimental.Level.WARNING) +@RequiresOptIn(RequiresOptIn.Level.WARNING) @Target(AnnotationTarget.CLASS) annotation class E @@ -15,7 +15,7 @@ open class Foo(val s: String = "") import api.* -@UseExperimental(E::class) +@OptIn(E::class) class Klass { init { Foo() @@ -23,35 +23,35 @@ class Klass { } class Constructor { - @UseExperimental(E::class) constructor() { + @OptIn(E::class) constructor() { Foo() } } -@UseExperimental(E::class) +@OptIn(E::class) val property = Foo().s -@UseExperimental(E::class) +@OptIn(E::class) fun function() { Foo() } -fun valueParameter(@UseExperimental(E::class) p: String = Foo().s): String { - @UseExperimental(E::class) +fun valueParameter(@OptIn(E::class) p: String = Foo().s): String { + @OptIn(E::class) val localVariable: String = Foo().s return localVariable } var propertyAccessors: String - @UseExperimental(E::class) + @OptIn(E::class) get() = Foo().s - @UseExperimental(E::class) + @OptIn(E::class) set(value) { Foo() } fun expression(): String { - val s = @UseExperimental(E::class) Foo().s + val s = @OptIn(E::class) Foo().s return s } -@UseExperimental(E::class) +@OptIn(E::class) typealias TypeAlias = Foo diff --git a/compiler/testData/diagnostics/testsWithStdLib/experimental/useExperimentalTargets.kt b/compiler/testData/diagnostics/testsWithStdLib/experimental/useExperimentalTargets.kt index ca8d9b387c9..c11c525ac07 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/experimental/useExperimentalTargets.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/experimental/useExperimentalTargets.kt @@ -1,10 +1,10 @@ -// !USE_EXPERIMENTAL: kotlin.Experimental +// !USE_EXPERIMENTAL: kotlin.RequiresOptIn // !DIAGNOSTICS: -UNUSED_PARAMETER // FILE: api.kt package api -@Experimental(Experimental.Level.WARNING) +@RequiresOptIn(RequiresOptIn.Level.WARNING) @Target(AnnotationTarget.CLASS) annotation class E @@ -15,7 +15,7 @@ open class Foo(val s: String = "") import api.* -@UseExperimental(E::class) +@OptIn(E::class) class Klass { init { Foo() @@ -23,35 +23,35 @@ class Klass { } class Constructor { - @UseExperimental(E::class) constructor() { + @OptIn(E::class) constructor() { Foo() } } -@UseExperimental(E::class) +@OptIn(E::class) val property = Foo().s -@UseExperimental(E::class) +@OptIn(E::class) fun function() { Foo() } -fun valueParameter(@UseExperimental(E::class) p: String = Foo().s): String { - @UseExperimental(E::class) +fun valueParameter(@OptIn(E::class) p: String = Foo().s): String { + @OptIn(E::class) val localVariable: String = Foo().s return localVariable } var propertyAccessors: String - @UseExperimental(E::class) + @OptIn(E::class) get() = Foo().s - @UseExperimental(E::class) + @OptIn(E::class) set(value) { Foo() } fun expression(): String { - val s = @UseExperimental(E::class) Foo().s + val s = @OptIn(E::class) Foo().s return s } -@UseExperimental(E::class) +@OptIn(E::class) typealias TypeAlias = Foo diff --git a/compiler/testData/diagnostics/testsWithStdLib/experimental/useExperimentalTargets.txt b/compiler/testData/diagnostics/testsWithStdLib/experimental/useExperimentalTargets.txt index 56c37641905..53f8ce03a14 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/experimental/useExperimentalTargets.txt +++ b/compiler/testData/diagnostics/testsWithStdLib/experimental/useExperimentalTargets.txt @@ -1,29 +1,29 @@ package -@kotlin.UseExperimental(markerClass = {api.E::class}) public val property: kotlin.String -@get:kotlin.UseExperimental(markerClass = {api.E::class}) @set:kotlin.UseExperimental(markerClass = {api.E::class}) public var propertyAccessors: kotlin.String +@kotlin.OptIn(markerClass = {api.E::class}) public val property: kotlin.String +@get:kotlin.OptIn(markerClass = {api.E::class}) @set:kotlin.OptIn(markerClass = {api.E::class}) public var propertyAccessors: kotlin.String public fun expression(): kotlin.String -@kotlin.UseExperimental(markerClass = {api.E::class}) public fun function(): kotlin.Unit -public fun valueParameter(/*0*/ @kotlin.UseExperimental(markerClass = {api.E::class}) p: kotlin.String = ...): kotlin.String +@kotlin.OptIn(markerClass = {api.E::class}) public fun function(): kotlin.Unit +public fun valueParameter(/*0*/ @kotlin.OptIn(markerClass = {api.E::class}) p: kotlin.String = ...): kotlin.String public final class Constructor { - @kotlin.UseExperimental(markerClass = {api.E::class}) public constructor Constructor() + @kotlin.OptIn(markerClass = {api.E::class}) public constructor Constructor() 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 } -@kotlin.UseExperimental(markerClass = {api.E::class}) public final class Klass { +@kotlin.OptIn(markerClass = {api.E::class}) public final class Klass { public constructor Klass() 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 } -@kotlin.UseExperimental(markerClass = {api.E::class}) public typealias TypeAlias = api.Foo +@kotlin.OptIn(markerClass = {api.E::class}) public typealias TypeAlias = api.Foo package api { - @kotlin.Experimental(level = Level.WARNING) @kotlin.annotation.Target(allowedTargets = {AnnotationTarget.CLASS}) public final annotation class E : kotlin.Annotation { + @kotlin.RequiresOptIn(level = Level.WARNING) @kotlin.annotation.Target(allowedTargets = {AnnotationTarget.CLASS}) public final annotation class E : kotlin.Annotation { public constructor E() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int diff --git a/compiler/testData/diagnostics/testsWithStdLib/experimental/useExperimentalWithSeveralAnnotations.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/experimental/useExperimentalWithSeveralAnnotations.fir.kt index 6a86758cd63..a9a0c20df36 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/experimental/useExperimentalWithSeveralAnnotations.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/experimental/useExperimentalWithSeveralAnnotations.fir.kt @@ -1,17 +1,17 @@ -// !USE_EXPERIMENTAL: kotlin.Experimental +// !USE_EXPERIMENTAL: kotlin.RequiresOptIn // FILE: api.kt package api -@Experimental(Experimental.Level.WARNING) +@RequiresOptIn(RequiresOptIn.Level.WARNING) @Target(AnnotationTarget.FUNCTION) annotation class E1 -@Experimental(Experimental.Level.WARNING) +@RequiresOptIn(RequiresOptIn.Level.WARNING) @Target(AnnotationTarget.FUNCTION) annotation class E2 -@Experimental(Experimental.Level.WARNING) +@RequiresOptIn(RequiresOptIn.Level.WARNING) @Target(AnnotationTarget.FUNCTION) annotation class E3 @@ -30,21 +30,21 @@ package usage import api.* -@UseExperimental(E1::class, E2::class, E3::class) +@OptIn(E1::class, E2::class, E3::class) fun use1() { e1() e2() e3() } -@UseExperimental(E1::class, E3::class) +@OptIn(E1::class, E3::class) fun use2() { e1() - @UseExperimental(E2::class) e2() + @OptIn(E2::class) e2() e3() } -@UseExperimental(E1::class, E2::class) +@OptIn(E1::class, E2::class) fun use3() { e1() e2() diff --git a/compiler/testData/diagnostics/testsWithStdLib/experimental/useExperimentalWithSeveralAnnotations.kt b/compiler/testData/diagnostics/testsWithStdLib/experimental/useExperimentalWithSeveralAnnotations.kt index 00bfb618c87..6a6cef8dc85 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/experimental/useExperimentalWithSeveralAnnotations.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/experimental/useExperimentalWithSeveralAnnotations.kt @@ -1,17 +1,17 @@ -// !USE_EXPERIMENTAL: kotlin.Experimental +// !USE_EXPERIMENTAL: kotlin.RequiresOptIn // FILE: api.kt package api -@Experimental(Experimental.Level.WARNING) +@RequiresOptIn(RequiresOptIn.Level.WARNING) @Target(AnnotationTarget.FUNCTION) annotation class E1 -@Experimental(Experimental.Level.WARNING) +@RequiresOptIn(RequiresOptIn.Level.WARNING) @Target(AnnotationTarget.FUNCTION) annotation class E2 -@Experimental(Experimental.Level.WARNING) +@RequiresOptIn(RequiresOptIn.Level.WARNING) @Target(AnnotationTarget.FUNCTION) annotation class E3 @@ -30,21 +30,21 @@ package usage import api.* -@UseExperimental(E1::class, E2::class, E3::class) +@OptIn(E1::class, E2::class, E3::class) fun use1() { e1() e2() e3() } -@UseExperimental(E1::class, E3::class) +@OptIn(E1::class, E3::class) fun use2() { e1() - @UseExperimental(E2::class) e2() + @OptIn(E2::class) e2() e3() } -@UseExperimental(E1::class, E2::class) +@OptIn(E1::class, E2::class) fun use3() { e1() e2() diff --git a/compiler/testData/diagnostics/testsWithStdLib/experimental/useExperimentalWithSeveralAnnotations.txt b/compiler/testData/diagnostics/testsWithStdLib/experimental/useExperimentalWithSeveralAnnotations.txt index 3104caafb70..32a65a63c79 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/experimental/useExperimentalWithSeveralAnnotations.txt +++ b/compiler/testData/diagnostics/testsWithStdLib/experimental/useExperimentalWithSeveralAnnotations.txt @@ -5,21 +5,21 @@ package api { @api.E2 public fun e2(): kotlin.Unit @api.E3 public fun e3(): kotlin.Unit - @kotlin.Experimental(level = Level.WARNING) @kotlin.annotation.Target(allowedTargets = {AnnotationTarget.FUNCTION}) public final annotation class E1 : kotlin.Annotation { + @kotlin.RequiresOptIn(level = Level.WARNING) @kotlin.annotation.Target(allowedTargets = {AnnotationTarget.FUNCTION}) public final annotation class E1 : kotlin.Annotation { public constructor E1() 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 } - @kotlin.Experimental(level = Level.WARNING) @kotlin.annotation.Target(allowedTargets = {AnnotationTarget.FUNCTION}) public final annotation class E2 : kotlin.Annotation { + @kotlin.RequiresOptIn(level = Level.WARNING) @kotlin.annotation.Target(allowedTargets = {AnnotationTarget.FUNCTION}) public final annotation class E2 : kotlin.Annotation { public constructor E2() 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 } - @kotlin.Experimental(level = Level.WARNING) @kotlin.annotation.Target(allowedTargets = {AnnotationTarget.FUNCTION}) public final annotation class E3 : kotlin.Annotation { + @kotlin.RequiresOptIn(level = Level.WARNING) @kotlin.annotation.Target(allowedTargets = {AnnotationTarget.FUNCTION}) public final annotation class E3 : kotlin.Annotation { public constructor E3() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int @@ -28,7 +28,7 @@ package api { } package usage { - @kotlin.UseExperimental(markerClass = {api.E1::class, api.E2::class, api.E3::class}) public fun use1(): kotlin.Unit - @kotlin.UseExperimental(markerClass = {api.E1::class, api.E3::class}) public fun use2(): kotlin.Unit - @kotlin.UseExperimental(markerClass = {api.E1::class, api.E2::class}) public fun use3(): kotlin.Unit + @kotlin.OptIn(markerClass = {api.E1::class, api.E2::class, api.E3::class}) public fun use1(): kotlin.Unit + @kotlin.OptIn(markerClass = {api.E1::class, api.E3::class}) public fun use2(): kotlin.Unit + @kotlin.OptIn(markerClass = {api.E1::class, api.E2::class}) public fun use3(): kotlin.Unit } diff --git a/compiler/testData/diagnostics/testsWithStdLib/experimental/wasExperimental.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/experimental/wasExperimental.fir.kt index 258ab24a5e5..97b827d82f5 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/experimental/wasExperimental.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/experimental/wasExperimental.fir.kt @@ -1,27 +1,27 @@ -// !API_VERSION: 1.2 -// !USE_EXPERIMENTAL: kotlin.Experimental +// !API_VERSION: 1.3 +// !USE_EXPERIMENTAL: kotlin.RequiresOptIn // !DIAGNOSTICS: -INVISIBLE_MEMBER -INVISIBLE_REFERENCE -NEWER_VERSION_IN_SINCE_KOTLIN -UNUSED_PARAMETER -@SinceKotlin("1.3") +@SinceKotlin("1.4") fun newPublishedFun() {} -@Experimental +@RequiresOptIn annotation class Marker -@SinceKotlin("1.3") +@SinceKotlin("1.4") @WasExperimental(Marker::class) fun newFunExperimentalInThePast() {} -@SinceKotlin("1.3") +@SinceKotlin("1.4") @WasExperimental(Marker::class) val newValExperimentalInThePast = "" -@SinceKotlin("1.3") +@SinceKotlin("1.4") @WasExperimental(Marker::class) class NewClassExperimentalInThePast -@SinceKotlin("1.3") +@SinceKotlin("1.4") @WasExperimental(Marker::class) typealias TypeAliasToNewClass = NewClassExperimentalInThePast @@ -36,7 +36,7 @@ fun use1( NewClassExperimentalInThePast() } -@UseExperimental(Marker::class) +@OptIn(Marker::class) fun use2( c2: NewClassExperimentalInThePast, t2: TypeAliasToNewClass diff --git a/compiler/testData/diagnostics/testsWithStdLib/experimental/wasExperimental.kt b/compiler/testData/diagnostics/testsWithStdLib/experimental/wasExperimental.kt index ff0991c2663..19d9c9cb670 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/experimental/wasExperimental.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/experimental/wasExperimental.kt @@ -1,27 +1,27 @@ -// !API_VERSION: 1.2 -// !USE_EXPERIMENTAL: kotlin.Experimental +// !API_VERSION: 1.3 +// !USE_EXPERIMENTAL: kotlin.RequiresOptIn // !DIAGNOSTICS: -INVISIBLE_MEMBER -INVISIBLE_REFERENCE -NEWER_VERSION_IN_SINCE_KOTLIN -UNUSED_PARAMETER -@SinceKotlin("1.3") +@SinceKotlin("1.4") fun newPublishedFun() {} -@Experimental +@RequiresOptIn annotation class Marker -@SinceKotlin("1.3") +@SinceKotlin("1.4") @WasExperimental(Marker::class) fun newFunExperimentalInThePast() {} -@SinceKotlin("1.3") +@SinceKotlin("1.4") @WasExperimental(Marker::class) val newValExperimentalInThePast = "" -@SinceKotlin("1.3") +@SinceKotlin("1.4") @WasExperimental(Marker::class) class NewClassExperimentalInThePast -@SinceKotlin("1.3") +@SinceKotlin("1.4") @WasExperimental(Marker::class) typealias TypeAliasToNewClass = NewClassExperimentalInThePast @@ -36,7 +36,7 @@ fun use1( NewClassExperimentalInThePast() } -@UseExperimental(Marker::class) +@OptIn(Marker::class) fun use2( c2: NewClassExperimentalInThePast, t2: TypeAliasToNewClass diff --git a/compiler/testData/diagnostics/testsWithStdLib/experimental/wasExperimental.txt b/compiler/testData/diagnostics/testsWithStdLib/experimental/wasExperimental.txt index 32385bba6b2..56181c45c5b 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/experimental/wasExperimental.txt +++ b/compiler/testData/diagnostics/testsWithStdLib/experimental/wasExperimental.txt @@ -1,23 +1,23 @@ package -@kotlin.SinceKotlin(version = "1.3") @kotlin.WasExperimental(markerClass = {Marker::class}) public val newValExperimentalInThePast: kotlin.String = "" -@kotlin.SinceKotlin(version = "1.3") @kotlin.WasExperimental(markerClass = {Marker::class}) public fun newFunExperimentalInThePast(): kotlin.Unit -@kotlin.SinceKotlin(version = "1.3") public fun newPublishedFun(): kotlin.Unit +@kotlin.SinceKotlin(version = "1.4") @kotlin.WasExperimental(markerClass = {Marker::class}) public val newValExperimentalInThePast: kotlin.String = "" +@kotlin.SinceKotlin(version = "1.4") @kotlin.WasExperimental(markerClass = {Marker::class}) public fun newFunExperimentalInThePast(): kotlin.Unit +@kotlin.SinceKotlin(version = "1.4") public fun newPublishedFun(): kotlin.Unit public fun use1(/*0*/ c1: NewClassExperimentalInThePast, /*1*/ t1: TypeAliasToNewClass /* = NewClassExperimentalInThePast */): kotlin.Unit -@kotlin.UseExperimental(markerClass = {Marker::class}) public fun use2(/*0*/ c2: NewClassExperimentalInThePast, /*1*/ t2: TypeAliasToNewClass /* = NewClassExperimentalInThePast */): kotlin.Unit +@kotlin.OptIn(markerClass = {Marker::class}) public fun use2(/*0*/ c2: NewClassExperimentalInThePast, /*1*/ t2: TypeAliasToNewClass /* = NewClassExperimentalInThePast */): kotlin.Unit @Marker public fun use3(/*0*/ c3: NewClassExperimentalInThePast, /*1*/ t3: TypeAliasToNewClass /* = NewClassExperimentalInThePast */): kotlin.Unit -@kotlin.Experimental public final annotation class Marker : kotlin.Annotation { +@kotlin.RequiresOptIn 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 } -@kotlin.SinceKotlin(version = "1.3") @kotlin.WasExperimental(markerClass = {Marker::class}) public final class NewClassExperimentalInThePast { +@kotlin.SinceKotlin(version = "1.4") @kotlin.WasExperimental(markerClass = {Marker::class}) public final class NewClassExperimentalInThePast { public constructor NewClassExperimentalInThePast() 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 } -@kotlin.SinceKotlin(version = "1.3") @kotlin.WasExperimental(markerClass = {Marker::class}) public typealias TypeAliasToNewClass = NewClassExperimentalInThePast +@kotlin.SinceKotlin(version = "1.4") @kotlin.WasExperimental(markerClass = {Marker::class}) public typealias TypeAliasToNewClass = NewClassExperimentalInThePast diff --git a/compiler/testData/diagnostics/testsWithStdLib/regression/kt34391.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/regression/kt34391.fir.kt index 63db720eb0d..d480fe08794 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/regression/kt34391.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/regression/kt34391.fir.kt @@ -15,5 +15,5 @@ class A { } } -@Experimental(level = Experimental.Level.ERROR) +@RequiresOptIn(level = RequiresOptIn.Level.ERROR) annotation class ExperimentalTime diff --git a/compiler/testData/diagnostics/testsWithStdLib/regression/kt34391.kt b/compiler/testData/diagnostics/testsWithStdLib/regression/kt34391.kt index aa6bcc61dcf..89908ecacf8 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/regression/kt34391.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/regression/kt34391.kt @@ -15,5 +15,5 @@ class A { } } -@Experimental(level = Experimental.Level.ERROR) +@RequiresOptIn(level = RequiresOptIn.Level.ERROR) annotation class ExperimentalTime diff --git a/compiler/testData/diagnostics/testsWithStdLib/regression/kt34391.txt b/compiler/testData/diagnostics/testsWithStdLib/regression/kt34391.txt index 5e9203e57bb..6530940a31e 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/regression/kt34391.txt +++ b/compiler/testData/diagnostics/testsWithStdLib/regression/kt34391.txt @@ -10,7 +10,7 @@ public final class A { public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } -@kotlin.Experimental(level = Level.ERROR) public final annotation class ExperimentalTime : kotlin.Annotation { +@kotlin.RequiresOptIn(level = Level.ERROR) public final annotation class ExperimentalTime : kotlin.Annotation { public constructor ExperimentalTime() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int diff --git a/compiler/testData/experimental/jsExperimentalModule/lib/lib.kt b/compiler/testData/experimental/jsExperimentalModule/lib/lib.kt index 920a5a68bf7..25226281099 100644 --- a/compiler/testData/experimental/jsExperimentalModule/lib/lib.kt +++ b/compiler/testData/experimental/jsExperimentalModule/lib/lib.kt @@ -1,6 +1,6 @@ package lib -@Experimental +@RequiresOptIn annotation class ExperimentalAPI class Foo diff --git a/compiler/testData/experimental/jvmExperimentalModule/lib/lib.kt b/compiler/testData/experimental/jvmExperimentalModule/lib/lib.kt index 920a5a68bf7..25226281099 100644 --- a/compiler/testData/experimental/jvmExperimentalModule/lib/lib.kt +++ b/compiler/testData/experimental/jvmExperimentalModule/lib/lib.kt @@ -1,6 +1,6 @@ package lib -@Experimental +@RequiresOptIn annotation class ExperimentalAPI class Foo diff --git a/compiler/testData/moduleProtoBuf/experimental/main.kt b/compiler/testData/moduleProtoBuf/experimental/main.kt index e237bd95288..80a92563d28 100644 --- a/compiler/testData/moduleProtoBuf/experimental/main.kt +++ b/compiler/testData/moduleProtoBuf/experimental/main.kt @@ -1,12 +1,12 @@ package org.foo -@Experimental +@RequiresOptIn annotation class A class B { - @Experimental + @RequiresOptIn annotation class C } -@Experimental(Experimental.Level.ERROR) +@RequiresOptIn(level = RequiresOptIn.Level.ERROR) annotation class D diff --git a/compiler/testData/multiplatform/optionalExpectation/common.kt b/compiler/testData/multiplatform/optionalExpectation/common.kt index 06d4177a4b3..48c97a027bd 100644 --- a/compiler/testData/multiplatform/optionalExpectation/common.kt +++ b/compiler/testData/multiplatform/optionalExpectation/common.kt @@ -1,5 +1,5 @@ // WITH_RUNTIME -// ADDITIONAL_COMPILER_ARGUMENTS: -Xuse-experimental=kotlin.ExperimentalMultiplatform +// ADDITIONAL_COMPILER_ARGUMENTS: -Xopt-in=kotlin.ExperimentalMultiplatform @OptionalExpectation expect annotation class A() diff --git a/compiler/testData/multiplatform/optionalExpectationIncorrectUse/common.kt b/compiler/testData/multiplatform/optionalExpectationIncorrectUse/common.kt index 37d7f6ad555..5b0b11d7d42 100644 --- a/compiler/testData/multiplatform/optionalExpectationIncorrectUse/common.kt +++ b/compiler/testData/multiplatform/optionalExpectationIncorrectUse/common.kt @@ -1,5 +1,5 @@ // WITH_RUNTIME -// ADDITIONAL_COMPILER_ARGUMENTS: -Xuse-experimental=kotlin.ExperimentalMultiplatform +// ADDITIONAL_COMPILER_ARGUMENTS: -Xopt-in=kotlin.ExperimentalMultiplatform @OptionalExpectation expect annotation class A() diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/JvmModuleProtoBufTest.kt b/compiler/tests/org/jetbrains/kotlin/codegen/JvmModuleProtoBufTest.kt index b7930431019..e1901876002 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/JvmModuleProtoBufTest.kt +++ b/compiler/tests/org/jetbrains/kotlin/codegen/JvmModuleProtoBufTest.kt @@ -99,10 +99,10 @@ class JvmModuleProtoBufTest : KtUsefulTestCase() { fun testExperimental() { doTest( "/moduleProtoBuf/experimental", extraOptions = listOf( - "-Xuse-experimental=kotlin.Experimental", + "-Xopt-in=kotlin.RequiresOptIn", "-Xexperimental=org.foo.A", "-Xexperimental=org.foo.B.C", - "-Xuse-experimental=org.foo.D" + "-Xopt-in=org.foo.D" ) ) } diff --git a/compiler/tests/org/jetbrains/kotlin/jvm/compiler/ExperimentalIntegrationTest.kt b/compiler/tests/org/jetbrains/kotlin/jvm/compiler/ExperimentalIntegrationTest.kt index 11d2af90fdb..fc191007800 100644 --- a/compiler/tests/org/jetbrains/kotlin/jvm/compiler/ExperimentalIntegrationTest.kt +++ b/compiler/tests/org/jetbrains/kotlin/jvm/compiler/ExperimentalIntegrationTest.kt @@ -15,7 +15,7 @@ class ExperimentalIntegrationTest : AbstractKotlinCompilerIntegrationTest() { fun testJvmExperimentalModule() { val lib = compileLibrary( "lib", additionalOptions = listOf( - "-Xuse-experimental=kotlin.Experimental", + "-Xopt-in=kotlin.RequiresOptIn", "-Xexperimental=lib.ExperimentalAPI" ), checkKotlinOutput = { output -> assertTrue(output, output.trimEnd().endsWith("OK")) } @@ -26,7 +26,7 @@ class ExperimentalIntegrationTest : AbstractKotlinCompilerIntegrationTest() { fun testJsExperimentalModule() { val lib = compileJsLibrary( "lib", additionalOptions = listOf( - "-Xuse-experimental=kotlin.Experimental", + "-Xopt-in=kotlin.RequiresOptIn", "-Xexperimental=lib.ExperimentalAPI" ), checkKotlinOutput = { output -> assertTrue(output, output.trimEnd().endsWith("OK")) }