mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[kotlin] K2 IDE: Support adding a @OptIn annotation and suggesting to propagate opt-in requirement in quickFixes
^KTIJ-26302 GitOrigin-RevId: 8d463b04322327abd25978d7b6c127ba8de02c44
This commit is contained in:
committed by
intellij-monorepo-bot
parent
cb608444c7
commit
884a41b39f
+35
-11
@@ -18,18 +18,42 @@ import org.junit.runner.RunWith;
|
||||
@TestDataPath("$CONTENT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
@TestMetadata("../../../idea/tests/testData/quickfix/optIn")
|
||||
public class K2MultiFileQuickFixTestGenerated extends AbstractK2MultiFileQuickFixTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTestWithExtraFile, this, testDataFilePath);
|
||||
}
|
||||
public abstract class K2MultiFileQuickFixTestGenerated extends AbstractK2MultiFileQuickFixTest {
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
@TestMetadata("../../../idea/tests/testData/quickfix/optIn/multifile")
|
||||
public static class Multifile extends AbstractK2MultiFileQuickFixTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTestWithExtraFile, this, testDataFilePath);
|
||||
}
|
||||
|
||||
@TestMetadata("reservedKeywordPackage.test")
|
||||
public void testReservedKeywordPackage() throws Exception {
|
||||
runTest("../../../idea/tests/testData/quickfix/optIn/reservedKeywordPackage.test");
|
||||
}
|
||||
@TestMetadata("apiFromJava.test")
|
||||
public void testApiFromJava() throws Exception {
|
||||
runTest("../../../idea/tests/testData/quickfix/optIn/multifile/apiFromJava.test");
|
||||
}
|
||||
|
||||
@TestMetadata("reservedKeywordPackage2.test")
|
||||
public void testReservedKeywordPackage2() throws Exception {
|
||||
runTest("../../../idea/tests/testData/quickfix/optIn/reservedKeywordPackage2.test");
|
||||
@TestMetadata("apiFromJava2.test")
|
||||
public void testApiFromJava2() throws Exception {
|
||||
runTest("../../../idea/tests/testData/quickfix/optIn/multifile/apiFromJava2.test");
|
||||
}
|
||||
|
||||
@TestMetadata("apiFromJava3.test")
|
||||
public void testApiFromJava3() throws Exception {
|
||||
runTest("../../../idea/tests/testData/quickfix/optIn/multifile/apiFromJava3.test");
|
||||
}
|
||||
|
||||
@TestMetadata("apiFromJava4.test")
|
||||
public void testApiFromJava4() throws Exception {
|
||||
runTest("../../../idea/tests/testData/quickfix/optIn/multifile/apiFromJava4.test");
|
||||
}
|
||||
|
||||
@TestMetadata("reservedKeywordPackage.test")
|
||||
public void testReservedKeywordPackage() throws Exception {
|
||||
runTest("../../../idea/tests/testData/quickfix/optIn/multifile/reservedKeywordPackage.test");
|
||||
}
|
||||
|
||||
@TestMetadata("reservedKeywordPackage2.test")
|
||||
public void testReservedKeywordPackage2() throws Exception {
|
||||
runTest("../../../idea/tests/testData/quickfix/optIn/multifile/reservedKeywordPackage2.test");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+30
@@ -847,6 +847,11 @@ public abstract class K2QuickFixTestGenerated extends AbstractK2QuickFixTest {
|
||||
runTest("../../../idea/tests/testData/quickfix/optIn/basicFunctionNotApplicable.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("basicFunctionNotApplicableFir.kt")
|
||||
public void testBasicFunctionNotApplicableFir() throws Exception {
|
||||
runTest("../../../idea/tests/testData/quickfix/optIn/basicFunctionNotApplicableFir.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("basicModule.kt")
|
||||
public void testBasicModule() throws Exception {
|
||||
runTest("../../../idea/tests/testData/quickfix/optIn/basicModule.kt");
|
||||
@@ -957,11 +962,26 @@ public abstract class K2QuickFixTestGenerated extends AbstractK2QuickFixTest {
|
||||
runTest("../../../idea/tests/testData/quickfix/optIn/nestedClasses.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("nestedClassesFir.kt")
|
||||
public void testNestedClassesFir() throws Exception {
|
||||
runTest("../../../idea/tests/testData/quickfix/optIn/nestedClassesFir.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("newFileAnnotationWithPackage.kt")
|
||||
public void testNewFileAnnotationWithPackage() throws Exception {
|
||||
runTest("../../../idea/tests/testData/quickfix/optIn/newFileAnnotationWithPackage.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("nonTopLevelAnnotation.kt")
|
||||
public void testNonTopLevelAnnotation() throws Exception {
|
||||
runTest("../../../idea/tests/testData/quickfix/optIn/nonTopLevelAnnotation.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("nonTopLevelAnnotation2.kt")
|
||||
public void testNonTopLevelAnnotation2() throws Exception {
|
||||
runTest("../../../idea/tests/testData/quickfix/optIn/nonTopLevelAnnotation2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("optInUnused.kt")
|
||||
public void testOptInUnused() throws Exception {
|
||||
runTest("../../../idea/tests/testData/quickfix/optIn/optInUnused.kt");
|
||||
@@ -972,6 +992,11 @@ public abstract class K2QuickFixTestGenerated extends AbstractK2QuickFixTest {
|
||||
runTest("../../../idea/tests/testData/quickfix/optIn/override.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("overrideFir.kt")
|
||||
public void testOverrideFir() throws Exception {
|
||||
runTest("../../../idea/tests/testData/quickfix/optIn/overrideFir.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("propagateOptIn.kt")
|
||||
public void testPropagateOptIn() throws Exception {
|
||||
runTest("../../../idea/tests/testData/quickfix/optIn/propagateOptIn.kt");
|
||||
@@ -1012,6 +1037,11 @@ public abstract class K2QuickFixTestGenerated extends AbstractK2QuickFixTest {
|
||||
runTest("../../../idea/tests/testData/quickfix/optIn/propagateOptIn8.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("propagateOptIn8Fir.kt")
|
||||
public void testPropagateOptIn8Fir() throws Exception {
|
||||
runTest("../../../idea/tests/testData/quickfix/optIn/propagateOptIn8Fir.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("propagateSubclassOptInRequired.kt")
|
||||
public void testPropagateSubclassOptInRequired() throws Exception {
|
||||
runTest("../../../idea/tests/testData/quickfix/optIn/propagateSubclassOptInRequired.kt");
|
||||
|
||||
@@ -267,6 +267,7 @@ class KotlinK2QuickFixRegistrar : KotlinQuickFixRegistrar() {
|
||||
|
||||
registerApplicator(OptInAnnotationWrongTargetFixFactory.optInAnnotationWrongTargetFixFactory)
|
||||
registerApplicators(OptInFileLevelFixFactories.optInFileLevelFixFactories)
|
||||
registerApplicators(OptInFixFactories.optInFixFactories)
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.kotlin.idea.quickfix.fixes
|
||||
|
||||
import com.intellij.psi.JavaPsiFacade
|
||||
import com.intellij.psi.PsiElement
|
||||
import com.intellij.psi.util.findParentOfType
|
||||
import com.intellij.util.containers.addIfNotNull
|
||||
import org.jetbrains.kotlin.analysis.api.KtAnalysisSession
|
||||
import org.jetbrains.kotlin.analysis.api.analyze
|
||||
import org.jetbrains.kotlin.analysis.api.annotations.*
|
||||
import org.jetbrains.kotlin.analysis.api.fir.diagnostics.KtFirDiagnostic
|
||||
import org.jetbrains.kotlin.analysis.api.fir.utils.getActualAnnotationTargets
|
||||
import org.jetbrains.kotlin.idea.base.psi.KotlinPsiHeuristics
|
||||
import org.jetbrains.kotlin.idea.codeinsight.api.applicators.fixes.diagnosticFixFactories
|
||||
import org.jetbrains.kotlin.idea.quickfix.AddAnnotationFix
|
||||
import org.jetbrains.kotlin.idea.quickfix.OptInGeneralUtilsBase
|
||||
import org.jetbrains.kotlin.idea.refactoring.isOpen
|
||||
import org.jetbrains.kotlin.idea.testIntegration.framework.KotlinPsiBasedTestFramework.Companion.asKtClassOrObject
|
||||
import org.jetbrains.kotlin.lexer.KtTokens
|
||||
import org.jetbrains.kotlin.name.ClassId
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.psi.*
|
||||
import org.jetbrains.kotlin.resolve.checkers.OptInNames
|
||||
|
||||
object OptInFixFactories {
|
||||
val optInFixFactories = diagnosticFixFactories(
|
||||
KtFirDiagnostic.OptInUsage::class,
|
||||
KtFirDiagnostic.OptInUsageError::class,
|
||||
KtFirDiagnostic.OptInOverride::class,
|
||||
KtFirDiagnostic.OptInOverrideError::class
|
||||
) { diagnostic -> createQuickFix(diagnostic) }
|
||||
|
||||
context(KtAnalysisSession)
|
||||
private fun createQuickFix(diagnostic: KtFirDiagnostic<PsiElement>): List<AddAnnotationFix> {
|
||||
val element = diagnostic.psi.findParentOfType<KtElement>(strict = false) ?: return emptyList()
|
||||
val annotationFqName = OptInFixUtils.optInMarkerFqName(diagnostic) ?: return emptyList()
|
||||
|
||||
val optInClassId = ClassId.topLevel(OptInFixUtils.optInFqName() ?: return emptyList())
|
||||
val isOverrideError = isOverrideError(diagnostic)
|
||||
val psiClass = JavaPsiFacade.getInstance(element.project).findClass(annotationFqName.asString(), element.resolveScope) ?: return emptyList()
|
||||
val annotationClass = psiClass.asKtClassOrObject()?.getClassOrObjectSymbol() ?: psiClass.getNamedClassSymbol()
|
||||
val annotationClassId = annotationClass?.classIdIfNonLocal ?: return emptyList()
|
||||
val applicableTargets = annotationClass.annotationApplicableTargets
|
||||
val result = mutableListOf<AddAnnotationFix>()
|
||||
|
||||
val candidates = OptInGeneralUtils.collectCandidates(element)
|
||||
|
||||
fun collectPropagateOptInAnnotationFix(targetElement: KtElement, kind: AddAnnotationFix.Kind): AddAnnotationFix? {
|
||||
if (targetElement !is KtDeclaration) return null
|
||||
if (applicableTargets == null) return null
|
||||
|
||||
val actualTargetList = (targetElement as? KtDeclaration)?.getSymbol()?.getActualAnnotationTargets() ?: return null
|
||||
return OptInGeneralUtils.collectPropagateOptInAnnotationFix(
|
||||
targetElement,
|
||||
kind,
|
||||
applicableTargets,
|
||||
actualTargetList,
|
||||
annotationFqName,
|
||||
annotationClassId,
|
||||
isOverrideError
|
||||
)
|
||||
}
|
||||
|
||||
candidates.forEach { (targetElement, kind) ->
|
||||
result.addIfNotNull(collectPropagateOptInAnnotationFix(targetElement, kind))
|
||||
result.add(OptInGeneralUtils.collectUseOptInAnnotationFix(targetElement, kind, optInClassId, annotationClassId.asSingleFqName(), isOverrideError))
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
private fun isOverrideError(diagnostic: KtFirDiagnostic<PsiElement>): Boolean =
|
||||
diagnostic is KtFirDiagnostic.OptInOverride || diagnostic is KtFirDiagnostic.OptInOverrideError
|
||||
}
|
||||
|
||||
private object OptInGeneralUtils : OptInGeneralUtilsBase() {
|
||||
|
||||
override fun KtDeclaration.isSubclassOptPropagateApplicable(annotationFqName: FqName): Boolean {
|
||||
if (this !is KtClass) return false
|
||||
// SubclassOptInRequired is inapplicable on sealed classes and interfaces, final classes,
|
||||
// open local classes, object, enum classes and fun interfaces
|
||||
check(!this.isLocal) { "Local declarations are filtered in OptInFixesFactory.doCreateActions" }
|
||||
if (this.isSealed() || this.hasModifier(KtTokens.FUN_KEYWORD) || !this.isOpen()) return false
|
||||
if (KotlinPsiHeuristics.hasAnnotation(this, OptInNames.SUBCLASS_OPT_IN_REQUIRED_FQ_NAME)) return false
|
||||
|
||||
analyze(this) {
|
||||
return superTypeListEntries.any {
|
||||
val typeReference = it.typeReference
|
||||
val resolvedClass = typeReference?.getKtType()?.expandedClassSymbol ?: return false
|
||||
val classAnnotation = resolvedClass.annotationsByClassId(OptInNames.SUBCLASS_OPT_IN_REQUIRED_CLASS_ID).firstOrNull()
|
||||
val annotationMarkerClass = classAnnotation?.arguments?.find { arg -> arg.name == OptInNames.OPT_IN_ANNOTATION_CLASS }
|
||||
val apiClassId = (annotationMarkerClass?.expression as? KtKClassAnnotationValue.KtNonLocalKClassAnnotationValue)?.classId
|
||||
apiClassId?.asSingleFqName() == annotationFqName
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+2
-3
@@ -4,7 +4,6 @@ package org.jetbrains.kotlin.idea.quickfix
|
||||
|
||||
import com.intellij.psi.PsiElement
|
||||
import org.jetbrains.kotlin.descriptors.annotations.KotlinTarget
|
||||
import org.jetbrains.kotlin.idea.codeinsight.api.classic.quickfixes.KotlinQuickFixAction
|
||||
import org.jetbrains.kotlin.idea.util.findAnnotation
|
||||
import org.jetbrains.kotlin.name.ClassId
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
@@ -27,7 +26,7 @@ abstract class OptInGeneralUtilsBase {
|
||||
annotationFqName: FqName,
|
||||
annotationClassId: ClassId,
|
||||
isOverrideError: Boolean
|
||||
): KotlinQuickFixAction<KtElement>? {
|
||||
): AddAnnotationFix? {
|
||||
if (KtPsiUtil.isLocal(targetElement)) return null
|
||||
if (actualTargetList.none { it in applicableTargets }) return null
|
||||
|
||||
@@ -52,7 +51,7 @@ abstract class OptInGeneralUtilsBase {
|
||||
optInClassId: ClassId,
|
||||
annotationFqName: FqName,
|
||||
isOverrideError: Boolean
|
||||
): KotlinQuickFixAction<KtElement> {
|
||||
): AddAnnotationFix {
|
||||
val existingAnnotationEntry = (targetElement as? KtAnnotated)?.findAnnotation(optInClassId)?.createSmartPointer()
|
||||
|
||||
return if (isOverrideError) {
|
||||
|
||||
+30
@@ -11322,6 +11322,11 @@ public abstract class K1QuickFixTestGenerated extends AbstractK1QuickFixTest {
|
||||
runTest("testData/quickfix/optIn/basicFunctionNotApplicable.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("basicFunctionNotApplicableFir.kt")
|
||||
public void testBasicFunctionNotApplicableFir() throws Exception {
|
||||
runTest("testData/quickfix/optIn/basicFunctionNotApplicableFir.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("basicModule.kt")
|
||||
public void testBasicModule() throws Exception {
|
||||
runTest("testData/quickfix/optIn/basicModule.kt");
|
||||
@@ -11432,11 +11437,26 @@ public abstract class K1QuickFixTestGenerated extends AbstractK1QuickFixTest {
|
||||
runTest("testData/quickfix/optIn/nestedClasses.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("nestedClassesFir.kt")
|
||||
public void testNestedClassesFir() throws Exception {
|
||||
runTest("testData/quickfix/optIn/nestedClassesFir.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("newFileAnnotationWithPackage.kt")
|
||||
public void testNewFileAnnotationWithPackage() throws Exception {
|
||||
runTest("testData/quickfix/optIn/newFileAnnotationWithPackage.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("nonTopLevelAnnotation.kt")
|
||||
public void testNonTopLevelAnnotation() throws Exception {
|
||||
runTest("testData/quickfix/optIn/nonTopLevelAnnotation.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("nonTopLevelAnnotation2.kt")
|
||||
public void testNonTopLevelAnnotation2() throws Exception {
|
||||
runTest("testData/quickfix/optIn/nonTopLevelAnnotation2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("optInUnused.kt")
|
||||
public void testOptInUnused() throws Exception {
|
||||
runTest("testData/quickfix/optIn/optInUnused.kt");
|
||||
@@ -11447,6 +11467,11 @@ public abstract class K1QuickFixTestGenerated extends AbstractK1QuickFixTest {
|
||||
runTest("testData/quickfix/optIn/override.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("overrideFir.kt")
|
||||
public void testOverrideFir() throws Exception {
|
||||
runTest("testData/quickfix/optIn/overrideFir.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("propagateOptIn.kt")
|
||||
public void testPropagateOptIn() throws Exception {
|
||||
runTest("testData/quickfix/optIn/propagateOptIn.kt");
|
||||
@@ -11487,6 +11512,11 @@ public abstract class K1QuickFixTestGenerated extends AbstractK1QuickFixTest {
|
||||
runTest("testData/quickfix/optIn/propagateOptIn8.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("propagateOptIn8Fir.kt")
|
||||
public void testPropagateOptIn8Fir() throws Exception {
|
||||
runTest("testData/quickfix/optIn/propagateOptIn8Fir.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("propagateSubclassOptInRequired.kt")
|
||||
public void testPropagateSubclassOptInRequired() throws Exception {
|
||||
runTest("testData/quickfix/optIn/propagateSubclassOptInRequired.kt");
|
||||
|
||||
+35
-11
@@ -2026,19 +2026,43 @@ public abstract class QuickFixMultiFileTestGenerated extends AbstractQuickFixMul
|
||||
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
@TestMetadata("testData/quickfix/optIn")
|
||||
public static class OptIn extends AbstractQuickFixMultiFileTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTestWithExtraFile, this, testDataFilePath);
|
||||
}
|
||||
public abstract static class OptIn extends AbstractQuickFixMultiFileTest {
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
@TestMetadata("testData/quickfix/optIn/multifile")
|
||||
public static class Multifile extends AbstractQuickFixMultiFileTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTestWithExtraFile, this, testDataFilePath);
|
||||
}
|
||||
|
||||
@TestMetadata("reservedKeywordPackage.test")
|
||||
public void testReservedKeywordPackage() throws Exception {
|
||||
runTest("testData/quickfix/optIn/reservedKeywordPackage.test");
|
||||
}
|
||||
@TestMetadata("apiFromJava.test")
|
||||
public void testApiFromJava() throws Exception {
|
||||
runTest("testData/quickfix/optIn/multifile/apiFromJava.test");
|
||||
}
|
||||
|
||||
@TestMetadata("reservedKeywordPackage2.test")
|
||||
public void testReservedKeywordPackage2() throws Exception {
|
||||
runTest("testData/quickfix/optIn/reservedKeywordPackage2.test");
|
||||
@TestMetadata("apiFromJava2.test")
|
||||
public void testApiFromJava2() throws Exception {
|
||||
runTest("testData/quickfix/optIn/multifile/apiFromJava2.test");
|
||||
}
|
||||
|
||||
@TestMetadata("apiFromJava3.test")
|
||||
public void testApiFromJava3() throws Exception {
|
||||
runTest("testData/quickfix/optIn/multifile/apiFromJava3.test");
|
||||
}
|
||||
|
||||
@TestMetadata("apiFromJava4.test")
|
||||
public void testApiFromJava4() throws Exception {
|
||||
runTest("testData/quickfix/optIn/multifile/apiFromJava4.test");
|
||||
}
|
||||
|
||||
@TestMetadata("reservedKeywordPackage.test")
|
||||
public void testReservedKeywordPackage() throws Exception {
|
||||
runTest("testData/quickfix/optIn/multifile/reservedKeywordPackage.test");
|
||||
}
|
||||
|
||||
@TestMetadata("reservedKeywordPackage2.test")
|
||||
public void testReservedKeywordPackage2() throws Exception {
|
||||
runTest("testData/quickfix/optIn/multifile/reservedKeywordPackage2.test");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
// "Propagate 'TopMarker' opt-in requirement to 'topUserVal'" "true"
|
||||
// IGNORE_FIR
|
||||
// COMPILER_ARGUMENTS: -opt-in=kotlin.RequiresOptIn
|
||||
// WITH_STDLIB
|
||||
|
||||
@RequiresOptIn
|
||||
annotation class TopMarker
|
||||
|
||||
-3
@@ -1,7 +1,4 @@
|
||||
// "Propagate 'TopMarker' opt-in requirement to 'topUserVal'" "true"
|
||||
// IGNORE_FIR
|
||||
// COMPILER_ARGUMENTS: -opt-in=kotlin.RequiresOptIn
|
||||
// WITH_STDLIB
|
||||
|
||||
@RequiresOptIn
|
||||
annotation class TopMarker
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
// "Propagate 'MyExperimentalAPI' opt-in requirement to 'bar'" "true"
|
||||
// IGNORE_FIR
|
||||
// COMPILER_ARGUMENTS: -opt-in=kotlin.RequiresOptIn
|
||||
// WITH_STDLIB
|
||||
|
||||
@RequiresOptIn
|
||||
annotation class MyExperimentalAPI
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
// "Propagate 'MyExperimentalAPI' opt-in requirement to 'bar'" "true"
|
||||
// IGNORE_FIR
|
||||
// COMPILER_ARGUMENTS: -opt-in=kotlin.RequiresOptIn
|
||||
// WITH_STDLIB
|
||||
|
||||
@RequiresOptIn
|
||||
annotation class MyExperimentalAPI
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
// "Propagate 'MyExperimentalAPI' opt-in requirement to containing class 'Bar'" "true"
|
||||
// IGNORE_FIR
|
||||
// COMPILER_ARGUMENTS: -opt-in=kotlin.RequiresOptIn
|
||||
// WITH_STDLIB
|
||||
|
||||
@RequiresOptIn
|
||||
annotation class MyExperimentalAPI
|
||||
|
||||
-3
@@ -1,7 +1,4 @@
|
||||
// "Propagate 'MyExperimentalAPI' opt-in requirement to containing class 'Bar'" "true"
|
||||
// IGNORE_FIR
|
||||
// COMPILER_ARGUMENTS: -opt-in=kotlin.RequiresOptIn
|
||||
// WITH_STDLIB
|
||||
|
||||
@RequiresOptIn
|
||||
annotation class MyExperimentalAPI
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
// "Propagate 'MyExperimentalAPI' opt-in requirement to 'bar'" "false"
|
||||
// IGNORE_FE10
|
||||
// COMPILER_ARGUMENTS: -opt-in=kotlin.RequiresOptIn
|
||||
// WITH_STDLIB
|
||||
// ACTION: Opt in for 'MyExperimentalAPI' in containing file 'basicFunctionNotApplicableFir.kt'
|
||||
// ACTION: Opt in for 'MyExperimentalAPI' on 'bar'
|
||||
// ACTION: Opt in for 'MyExperimentalAPI' on containing class 'Bar'
|
||||
// ACTION: Propagate 'MyExperimentalAPI' opt-in requirement to containing class 'Bar'
|
||||
// ERROR: This declaration needs opt-in. Its usage must be marked with '@MyExperimentalAPI' or '@OptIn(MyExperimentalAPI::class)'
|
||||
// ERROR: This declaration needs opt-in. Its usage must be marked with '@MyExperimentalAPI' or '@OptIn(MyExperimentalAPI::class)'
|
||||
// ERROR: This annotation is not applicable to target 'member function'
|
||||
|
||||
@RequiresOptIn
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
annotation class MyExperimentalAPI
|
||||
|
||||
@MyExperimentalAPI
|
||||
class Some {
|
||||
@MyExperimentalAPI
|
||||
fun foo() {}
|
||||
}
|
||||
|
||||
class Bar {
|
||||
fun bar() {
|
||||
Some().foo<caret>()
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,5 @@
|
||||
// "Opt in for 'MyExperimentalAPI' on 'bar'" "true"
|
||||
// IGNORE_FIR
|
||||
// PRIORITY: HIGH
|
||||
// COMPILER_ARGUMENTS: -opt-in=kotlin.RequiresOptIn
|
||||
// WITH_STDLIB
|
||||
|
||||
package a.b
|
||||
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
// "Opt in for 'MyExperimentalAPI' on 'bar'" "true"
|
||||
// IGNORE_FIR
|
||||
// PRIORITY: HIGH
|
||||
// COMPILER_ARGUMENTS: -opt-in=kotlin.RequiresOptIn
|
||||
// WITH_STDLIB
|
||||
|
||||
package a.b
|
||||
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
// "Opt in for 'MyExperimentalAPI' on containing class 'Bar'" "true"
|
||||
// IGNORE_FIR
|
||||
// PRIORITY: HIGH
|
||||
// COMPILER_ARGUMENTS: -opt-in=kotlin.RequiresOptIn
|
||||
// WITH_STDLIB
|
||||
|
||||
package a.b
|
||||
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
// "Opt in for 'MyExperimentalAPI' on containing class 'Bar'" "true"
|
||||
// IGNORE_FIR
|
||||
// PRIORITY: HIGH
|
||||
// COMPILER_ARGUMENTS: -opt-in=kotlin.RequiresOptIn
|
||||
// WITH_STDLIB
|
||||
|
||||
package a.b
|
||||
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
// "Propagate 'MyExperimentalAPI' opt-in requirement to 'outer'" "true"
|
||||
// IGNORE_FIR
|
||||
// COMPILER_ARGUMENTS: -opt-in=kotlin.RequiresOptIn
|
||||
// WITH_STDLIB
|
||||
|
||||
@RequiresOptIn
|
||||
@Target(AnnotationTarget.FUNCTION)
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
// "Propagate 'MyExperimentalAPI' opt-in requirement to 'outer'" "true"
|
||||
// IGNORE_FIR
|
||||
// COMPILER_ARGUMENTS: -opt-in=kotlin.RequiresOptIn
|
||||
// WITH_STDLIB
|
||||
|
||||
@RequiresOptIn
|
||||
@Target(AnnotationTarget.FUNCTION)
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
// "Opt in for 'B' on 'root'" "true"
|
||||
// IGNORE_FIR
|
||||
// WITH_STDLIB
|
||||
@RequiresOptIn
|
||||
annotation class A
|
||||
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
// "Opt in for 'B' on 'root'" "true"
|
||||
// IGNORE_FIR
|
||||
// WITH_STDLIB
|
||||
@RequiresOptIn
|
||||
annotation class A
|
||||
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
// "Opt in for 'A' on 'root'" "true"
|
||||
// IGNORE_FIR
|
||||
// WITH_STDLIB
|
||||
@RequiresOptIn
|
||||
annotation class A
|
||||
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
// "Opt in for 'A' on 'root'" "true"
|
||||
// IGNORE_FIR
|
||||
// WITH_STDLIB
|
||||
@RequiresOptIn
|
||||
annotation class A
|
||||
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
// "Opt in for 'A' on 'root'" "true"
|
||||
// IGNORE_FIR
|
||||
// WITH_STDLIB
|
||||
@RequiresOptIn
|
||||
annotation class A
|
||||
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
// "Opt in for 'A' on 'root'" "true"
|
||||
// IGNORE_FIR
|
||||
// WITH_STDLIB
|
||||
@RequiresOptIn
|
||||
annotation class A
|
||||
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
// "Opt in for 'B' on containing class 'C'" "true"
|
||||
// IGNORE_FIR
|
||||
// WITH_STDLIB
|
||||
@RequiresOptIn
|
||||
annotation class A
|
||||
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
// "Opt in for 'B' on containing class 'C'" "true"
|
||||
// IGNORE_FIR
|
||||
// WITH_STDLIB
|
||||
@RequiresOptIn
|
||||
annotation class A
|
||||
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
// "Opt in for 'B' on containing class 'C'" "true"
|
||||
// IGNORE_FIR
|
||||
// WITH_STDLIB
|
||||
@RequiresOptIn
|
||||
annotation class A
|
||||
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
// "Opt in for 'B' on containing class 'C'" "true"
|
||||
// IGNORE_FIR
|
||||
// WITH_STDLIB
|
||||
@RequiresOptIn
|
||||
annotation class A
|
||||
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
// "Propagate 'MyExperimentalAPI' opt-in requirement to 'outer'" "true"
|
||||
// IGNORE_FIR
|
||||
// COMPILER_ARGUMENTS: -opt-in=kotlin.RequiresOptIn
|
||||
// WITH_STDLIB
|
||||
|
||||
@RequiresOptIn
|
||||
annotation class MyExperimentalAPI
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
// "Propagate 'MyExperimentalAPI' opt-in requirement to 'outer'" "true"
|
||||
// IGNORE_FIR
|
||||
// COMPILER_ARGUMENTS: -opt-in=kotlin.RequiresOptIn
|
||||
// WITH_STDLIB
|
||||
|
||||
@RequiresOptIn
|
||||
annotation class MyExperimentalAPI
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
// FILE: first.before.kt
|
||||
// "Opt in for 'Api' on 'test'" "true"
|
||||
// ERROR: This declaration needs opt-in. Its usage must be marked with '@foo.Api' or '@OptIn(foo.Api::class)'
|
||||
import foo.Bar
|
||||
|
||||
fun test(){
|
||||
Bar<caret>()
|
||||
}
|
||||
|
||||
// FILE: foo/Api.java
|
||||
// WITH_STDLIB
|
||||
package foo;
|
||||
|
||||
import kotlin.RequiresOptIn;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@RequiresOptIn
|
||||
@Target(ElementType.TYPE)
|
||||
public @interface Api{}
|
||||
|
||||
// FILE: foo/Bar.java
|
||||
package foo;
|
||||
|
||||
@Api
|
||||
public class Bar {}
|
||||
|
||||
// FILE: first.after.kt
|
||||
// "Opt in for 'Api' on 'test'" "true"
|
||||
// ERROR: This declaration needs opt-in. Its usage must be marked with '@foo.Api' or '@OptIn(foo.Api::class)'
|
||||
import foo.Api
|
||||
import foo.Bar
|
||||
|
||||
@OptIn(Api::class)
|
||||
fun test(){
|
||||
Bar<caret>()
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
// FILE: first.before.kt
|
||||
// "Opt in for 'Api' in containing file 'first.before.kt'" "true"
|
||||
// ERROR: This declaration needs opt-in. Its usage must be marked with '@foo.Api' or '@OptIn(foo.Api::class)'
|
||||
import foo.Bar
|
||||
|
||||
fun test(){
|
||||
Bar<caret>()
|
||||
}
|
||||
|
||||
// FILE: foo/Api.java
|
||||
// WITH_STDLIB
|
||||
package foo;
|
||||
|
||||
import kotlin.RequiresOptIn;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@RequiresOptIn
|
||||
@Target(ElementType.TYPE)
|
||||
public @interface Api{}
|
||||
|
||||
// FILE: foo/Bar.java
|
||||
package foo;
|
||||
|
||||
@Api
|
||||
public class Bar {}
|
||||
|
||||
// FILE: first.after.kt
|
||||
// "Opt in for 'Api' in containing file 'first.before.kt'" "true"
|
||||
// ERROR: This declaration needs opt-in. Its usage must be marked with '@foo.Api' or '@OptIn(foo.Api::class)'
|
||||
@file:OptIn(Api::class)
|
||||
|
||||
import foo.Api
|
||||
import foo.Bar
|
||||
|
||||
fun test(){
|
||||
Bar<caret>()
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
// FILE: first.before.kt
|
||||
// "Opt in for 'Api' on containing class 'Main'" "true"
|
||||
// ERROR: This declaration needs opt-in. Its usage must be marked with '@foo.Api' or '@OptIn(foo.Api::class)'
|
||||
import foo.Bar
|
||||
|
||||
class Main {
|
||||
fun test() {
|
||||
Bar<caret>()
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: foo/Api.java
|
||||
// WITH_STDLIB
|
||||
package foo;
|
||||
|
||||
import kotlin.RequiresOptIn;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@RequiresOptIn
|
||||
@Target(ElementType.TYPE)
|
||||
public @interface Api{}
|
||||
|
||||
// FILE: foo/Bar.java
|
||||
package foo;
|
||||
|
||||
@Api
|
||||
public class Bar {}
|
||||
|
||||
// FILE: first.after.kt
|
||||
// "Opt in for 'Api' on containing class 'Main'" "true"
|
||||
// ERROR: This declaration needs opt-in. Its usage must be marked with '@foo.Api' or '@OptIn(foo.Api::class)'
|
||||
import foo.Api
|
||||
import foo.Bar
|
||||
|
||||
@OptIn(Api::class)
|
||||
class Main {
|
||||
fun test() {
|
||||
Bar<caret>()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
// FILE: first.before.kt
|
||||
// "Propagate 'Api' opt-in requirement to containing class 'Main'" "true"
|
||||
// ERROR: This declaration needs opt-in. Its usage must be marked with '@foo.Api' or '@OptIn(foo.Api::class)'
|
||||
import foo.Bar
|
||||
|
||||
class Main {
|
||||
fun test() {
|
||||
Bar<caret>()
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: foo/Api.java
|
||||
// WITH_STDLIB
|
||||
package foo;
|
||||
|
||||
import kotlin.RequiresOptIn;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@RequiresOptIn
|
||||
@Target(ElementType.TYPE)
|
||||
public @interface Api{}
|
||||
|
||||
// FILE: foo/Bar.java
|
||||
package foo;
|
||||
|
||||
@Api
|
||||
public class Bar {}
|
||||
|
||||
// FILE: first.after.kt
|
||||
// "Propagate 'Api' opt-in requirement to containing class 'Main'" "true"
|
||||
// ERROR: This declaration needs opt-in. Its usage must be marked with '@foo.Api' or '@OptIn(foo.Api::class)'
|
||||
import foo.Api
|
||||
import foo.Bar
|
||||
|
||||
@Api
|
||||
class Main {
|
||||
fun test() {
|
||||
Bar<caret>()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
// "Propagate 'MyExperimentalAPI' opt-in requirement to containing class 'Outer'" "false"
|
||||
// IGNORE_FE10
|
||||
// COMPILER_ARGUMENTS: -opt-in=kotlin.RequiresOptIn
|
||||
// WITH_STDLIB
|
||||
// ACTION: Opt in for 'MyExperimentalAPI' in containing file 'nestedClassesFir.kt'
|
||||
// ACTION: Opt in for 'MyExperimentalAPI' on 'bar'
|
||||
// ACTION: Opt in for 'MyExperimentalAPI' on containing class 'Inner'
|
||||
// ACTION: Propagate 'MyExperimentalAPI' opt-in requirement to 'bar'
|
||||
// ACTION: Propagate 'MyExperimentalAPI' opt-in requirement to containing class 'Inner'
|
||||
// ERROR: This declaration needs opt-in. Its usage must be marked with '@MyExperimentalAPI' or '@OptIn(MyExperimentalAPI::class)'
|
||||
|
||||
@RequiresOptIn
|
||||
annotation class MyExperimentalAPI
|
||||
|
||||
@MyExperimentalAPI
|
||||
fun foo() {}
|
||||
|
||||
class Outer {
|
||||
class Bar {
|
||||
class Inner {
|
||||
fun bar() {
|
||||
foo<caret>()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
// "Opt in for 'NestedMarker' on 'main'" "true"
|
||||
|
||||
class TopClass {
|
||||
@RequiresOptIn
|
||||
annotation class NestedMarker
|
||||
}
|
||||
|
||||
@TopClass.NestedMarker
|
||||
class Main
|
||||
|
||||
fun main(){
|
||||
Main<caret>()
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
// "Opt in for 'NestedMarker' on 'main'" "true"
|
||||
|
||||
class TopClass {
|
||||
@RequiresOptIn
|
||||
annotation class NestedMarker
|
||||
}
|
||||
|
||||
@TopClass.NestedMarker
|
||||
class Main
|
||||
|
||||
@OptIn(TopClass.NestedMarker::class)
|
||||
fun main(){
|
||||
Main()
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
// "Opt in for 'NestedMarker' on 'main'" "true"
|
||||
|
||||
package foo
|
||||
|
||||
class TopClass {
|
||||
@RequiresOptIn
|
||||
annotation class NestedMarker
|
||||
}
|
||||
|
||||
@TopClass.NestedMarker
|
||||
class Main
|
||||
|
||||
fun main(){
|
||||
Main<caret>()
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
// "Opt in for 'NestedMarker' on 'main'" "true"
|
||||
|
||||
package foo
|
||||
|
||||
class TopClass {
|
||||
@RequiresOptIn
|
||||
annotation class NestedMarker
|
||||
}
|
||||
|
||||
@TopClass.NestedMarker
|
||||
class Main
|
||||
|
||||
@OptIn(TopClass.NestedMarker::class)
|
||||
fun main(){
|
||||
Main()
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
// "Propagate 'MyExperimentalAPI' opt-in requirement to containing class 'Derived'" "false"
|
||||
// IGNORE_FE10
|
||||
// COMPILER_ARGUMENTS: -opt-in=kotlin.RequiresOptIn
|
||||
// WITH_STDLIB
|
||||
// ACTION: Enable a trailing comma by default in the formatter
|
||||
// ACTION: Go To Super Method
|
||||
// ACTION: Opt in for 'MyExperimentalAPI' in containing file 'overrideFir.kt'
|
||||
// ACTION: Opt in for 'MyExperimentalAPI' on 'foo'
|
||||
// ACTION: Opt in for 'MyExperimentalAPI' on containing class 'Derived'
|
||||
// ACTION: Propagate 'MyExperimentalAPI' opt-in requirement to 'foo'
|
||||
// ERROR: Base declaration of supertype 'Base' needs opt-in. The declaration override must be annotated with '@MyExperimentalAPI' or '@OptIn(MyExperimentalAPI::class)'
|
||||
|
||||
@RequiresOptIn
|
||||
@Target(AnnotationTarget.FUNCTION)
|
||||
annotation class MyExperimentalAPI
|
||||
|
||||
open class Base {
|
||||
@MyExperimentalAPI
|
||||
open fun foo() {}
|
||||
}
|
||||
|
||||
class Derived : Base() {
|
||||
override fun foo<caret>() {}
|
||||
}
|
||||
@@ -1,7 +1,4 @@
|
||||
// "Propagate 'B' opt-in requirement to 'SomeImplementation'" "true"
|
||||
// IGNORE_FIR
|
||||
// COMPILER_ARGUMENTS: -opt-in=kotlin.RequiresOptIn
|
||||
// WITH_STDLIB
|
||||
|
||||
@RequiresOptIn
|
||||
annotation class A
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
// "Propagate 'B' opt-in requirement to 'SomeImplementation'" "true"
|
||||
// IGNORE_FIR
|
||||
// COMPILER_ARGUMENTS: -opt-in=kotlin.RequiresOptIn
|
||||
// WITH_STDLIB
|
||||
|
||||
@RequiresOptIn
|
||||
annotation class A
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
// "Propagate 'UnstableApi' opt-in requirement to containing class 'Derived'" "true"
|
||||
// IGNORE_FIR
|
||||
// COMPILER_ARGUMENTS: -opt-in=kotlin.RequiresOptIn
|
||||
// WITH_STDLIB
|
||||
|
||||
@RequiresOptIn
|
||||
annotation class UnstableApi
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
// "Propagate 'UnstableApi' opt-in requirement to containing class 'Derived'" "true"
|
||||
// IGNORE_FIR
|
||||
// COMPILER_ARGUMENTS: -opt-in=kotlin.RequiresOptIn
|
||||
// WITH_STDLIB
|
||||
|
||||
@RequiresOptIn
|
||||
annotation class UnstableApi
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
// "Propagate 'UnstableApi' opt-in requirement to 'SomeImplementation'" "true"
|
||||
// IGNORE_FIR
|
||||
// COMPILER_ARGUMENTS: -opt-in=kotlin.RequiresOptIn
|
||||
// WITH_STDLIB
|
||||
|
||||
@RequiresOptIn
|
||||
annotation class UnstableApi
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
// "Propagate 'UnstableApi' opt-in requirement to 'SomeImplementation'" "true"
|
||||
// IGNORE_FIR
|
||||
// COMPILER_ARGUMENTS: -opt-in=kotlin.RequiresOptIn
|
||||
// WITH_STDLIB
|
||||
|
||||
@RequiresOptIn
|
||||
annotation class UnstableApi
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
// "Propagate 'UnstableApi' opt-in requirement to 'SomeImplementation'" "true"
|
||||
// IGNORE_FIR
|
||||
// COMPILER_ARGUMENTS: -opt-in=kotlin.RequiresOptIn
|
||||
// WITH_STDLIB
|
||||
|
||||
@RequiresOptIn
|
||||
annotation class UnstableApi
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
// "Propagate 'UnstableApi' opt-in requirement to 'SomeImplementation'" "true"
|
||||
// IGNORE_FIR
|
||||
// COMPILER_ARGUMENTS: -opt-in=kotlin.RequiresOptIn
|
||||
// WITH_STDLIB
|
||||
|
||||
@RequiresOptIn
|
||||
annotation class UnstableApi
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
// "Propagate 'UnstableApi' opt-in requirement to 'SomeImplementation'" "true"
|
||||
// IGNORE_FIR
|
||||
// COMPILER_ARGUMENTS: -opt-in=kotlin.RequiresOptIn
|
||||
// WITH_STDLIB
|
||||
|
||||
@RequiresOptIn
|
||||
annotation class UnstableApi
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
// "Propagate 'UnstableApi' opt-in requirement to 'SomeImplementation'" "true"
|
||||
// IGNORE_FIR
|
||||
// COMPILER_ARGUMENTS: -opt-in=kotlin.RequiresOptIn
|
||||
// WITH_STDLIB
|
||||
|
||||
@RequiresOptIn
|
||||
annotation class UnstableApi
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
// "Propagate 'UnstableApi' opt-in requirement to 'SomeImplementation'" "true"
|
||||
// IGNORE_FIR
|
||||
// COMPILER_ARGUMENTS: -opt-in=kotlin.RequiresOptIn
|
||||
// WITH_STDLIB
|
||||
|
||||
@RequiresOptIn
|
||||
annotation class UnstableApi
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
// "Propagate 'UnstableApi' opt-in requirement to 'SomeImplementation'" "true"
|
||||
// IGNORE_FIR
|
||||
// COMPILER_ARGUMENTS: -opt-in=kotlin.RequiresOptIn
|
||||
// WITH_STDLIB
|
||||
|
||||
@RequiresOptIn
|
||||
annotation class UnstableApi
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
// "Propagate 'UnstableApi' opt-in requirement to 'SomeImplementation'" "true"
|
||||
// IGNORE_FIR
|
||||
// COMPILER_ARGUMENTS: -opt-in=kotlin.RequiresOptIn
|
||||
// WITH_STDLIB
|
||||
|
||||
@RequiresOptIn
|
||||
annotation class UnstableApi
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
// "Propagate 'UnstableApi' opt-in requirement to 'SomeImplementation'" "true"
|
||||
// IGNORE_FIR
|
||||
// COMPILER_ARGUMENTS: -opt-in=kotlin.RequiresOptIn
|
||||
// WITH_STDLIB
|
||||
|
||||
@RequiresOptIn
|
||||
annotation class UnstableApi
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
// "Propagate 'SubclassOptInRequired(UnstableApi::class)' opt-in requirement to 'SomeImplementation'" "false"
|
||||
// IGNORE_FE10
|
||||
// ERROR: This declaration needs opt-in. Its usage must be marked with '@UnstableApi' or '@OptIn(UnstableApi::class)'
|
||||
// ACTION: Opt in for 'UnstableApi' in containing file 'propagateOptIn8Fir.kt'
|
||||
// ACTION: Opt in for 'UnstableApi' on 'foo'
|
||||
// ACTION: Propagate 'UnstableApi' opt-in requirement to 'foo'
|
||||
// COMPILER_ARGUMENTS: -opt-in=kotlin.RequiresOptIn
|
||||
// WITH_STDLIB
|
||||
|
||||
@RequiresOptIn
|
||||
annotation class UnstableApi
|
||||
|
||||
interface MockApi
|
||||
|
||||
@SubclassOptInRequired(UnstableApi::class)
|
||||
interface CoreLibraryApi
|
||||
|
||||
fun foo() {
|
||||
open class LocalClass : CoreLibrary<caret>Api
|
||||
}
|
||||
@@ -1,7 +1,4 @@
|
||||
// "Propagate 'SubclassOptInRequired(UnstableApi::class)' opt-in requirement to 'SomeImplementation'" "true"
|
||||
// IGNORE_FIR
|
||||
// COMPILER_ARGUMENTS: -opt-in=kotlin.RequiresOptIn
|
||||
// WITH_STDLIB
|
||||
|
||||
@RequiresOptIn
|
||||
annotation class UnstableApi
|
||||
|
||||
-3
@@ -1,7 +1,4 @@
|
||||
// "Propagate 'SubclassOptInRequired(UnstableApi::class)' opt-in requirement to 'SomeImplementation'" "true"
|
||||
// IGNORE_FIR
|
||||
// COMPILER_ARGUMENTS: -opt-in=kotlin.RequiresOptIn
|
||||
// WITH_STDLIB
|
||||
|
||||
@RequiresOptIn
|
||||
annotation class UnstableApi
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
// "Propagate 'SubclassOptInRequired(A::class)' opt-in requirement to 'SomeImplementation'" "true"
|
||||
// IGNORE_FIR
|
||||
// COMPILER_ARGUMENTS: -opt-in=kotlin.RequiresOptIn
|
||||
// ERROR: This declaration needs opt-in. Its usage must be marked with '@B' or '@OptIn(B::class)'
|
||||
// WITH_STDLIB
|
||||
|
||||
@RequiresOptIn
|
||||
annotation class A
|
||||
|
||||
-3
@@ -1,8 +1,5 @@
|
||||
// "Propagate 'SubclassOptInRequired(A::class)' opt-in requirement to 'SomeImplementation'" "true"
|
||||
// IGNORE_FIR
|
||||
// COMPILER_ARGUMENTS: -opt-in=kotlin.RequiresOptIn
|
||||
// ERROR: This declaration needs opt-in. Its usage must be marked with '@B' or '@OptIn(B::class)'
|
||||
// WITH_STDLIB
|
||||
|
||||
@RequiresOptIn
|
||||
annotation class A
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
// "Propagate 'SubclassOptInRequired(UnstableApi::class)' opt-in requirement to 'SomeImplementation'" "true"
|
||||
// IGNORE_FIR
|
||||
// COMPILER_ARGUMENTS: -opt-in=kotlin.RequiresOptIn
|
||||
// WITH_STDLIB
|
||||
|
||||
@RequiresOptIn
|
||||
annotation class UnstableApi
|
||||
|
||||
-3
@@ -1,7 +1,4 @@
|
||||
// "Propagate 'SubclassOptInRequired(UnstableApi::class)' opt-in requirement to 'SomeImplementation'" "true"
|
||||
// IGNORE_FIR
|
||||
// COMPILER_ARGUMENTS: -opt-in=kotlin.RequiresOptIn
|
||||
// WITH_STDLIB
|
||||
|
||||
@RequiresOptIn
|
||||
annotation class UnstableApi
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
// "Propagate 'SubclassOptInRequired(UnstableApi::class)' opt-in requirement to 'SomeImplementation'" "true"
|
||||
// IGNORE_FIR
|
||||
// COMPILER_ARGUMENTS: -opt-in=kotlin.RequiresOptIn
|
||||
// WITH_STDLIB
|
||||
|
||||
@RequiresOptIn
|
||||
annotation class UnstableApi
|
||||
|
||||
-3
@@ -1,7 +1,4 @@
|
||||
// "Propagate 'SubclassOptInRequired(UnstableApi::class)' opt-in requirement to 'SomeImplementation'" "true"
|
||||
// IGNORE_FIR
|
||||
// COMPILER_ARGUMENTS: -opt-in=kotlin.RequiresOptIn
|
||||
// WITH_STDLIB
|
||||
|
||||
@RequiresOptIn
|
||||
annotation class UnstableApi
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
// "Propagate 'SubclassOptInRequired(UnstableApi::class)' opt-in requirement to 'SomeImplementation'" "true"
|
||||
// IGNORE_FIR
|
||||
// COMPILER_ARGUMENTS: -opt-in=kotlin.RequiresOptIn
|
||||
// WITH_STDLIB
|
||||
|
||||
@RequiresOptIn
|
||||
annotation class UnstableApi
|
||||
|
||||
-3
@@ -1,7 +1,4 @@
|
||||
// "Propagate 'SubclassOptInRequired(UnstableApi::class)' opt-in requirement to 'SomeImplementation'" "true"
|
||||
// IGNORE_FIR
|
||||
// COMPILER_ARGUMENTS: -opt-in=kotlin.RequiresOptIn
|
||||
// WITH_STDLIB
|
||||
|
||||
@RequiresOptIn
|
||||
annotation class UnstableApi
|
||||
|
||||
@@ -1,18 +1,4 @@
|
||||
// "Propagate 'PropertyTypeMarker' opt-in requirement to constructor" "true"
|
||||
// IGNORE_FIR
|
||||
// COMPILER_ARGUMENTS: -opt-in=kotlin.RequiresOptIn
|
||||
// WITH_STDLIB
|
||||
// ACTION: Add '-opt-in=PropertyTypeMarker' to module light_idea_test_case compiler arguments
|
||||
// ACTION: Convert to secondary constructor
|
||||
// ACTION: Create test
|
||||
// ACTION: Enable a trailing comma by default in the formatter
|
||||
// ACTION: Introduce import alias
|
||||
// ACTION: Move to class body
|
||||
// ACTION: Opt in for 'PropertyTypeMarker' in containing file 'propertyInConstructor.kt'
|
||||
// ACTION: Opt in for 'PropertyTypeMarker' on constructor
|
||||
// ACTION: Opt in for 'PropertyTypeMarker' on containing class 'PropertyTypeContainer'
|
||||
// ACTION: Propagate 'PropertyTypeMarker' opt-in requirement to constructor
|
||||
// ACTION: Propagate 'PropertyTypeMarker' opt-in requirement to containing class 'PropertyTypeContainer'
|
||||
|
||||
@RequiresOptIn
|
||||
annotation class PropertyTypeMarker
|
||||
|
||||
@@ -1,18 +1,4 @@
|
||||
// "Propagate 'PropertyTypeMarker' opt-in requirement to constructor" "true"
|
||||
// IGNORE_FIR
|
||||
// COMPILER_ARGUMENTS: -opt-in=kotlin.RequiresOptIn
|
||||
// WITH_STDLIB
|
||||
// ACTION: Add '-opt-in=PropertyTypeMarker' to module light_idea_test_case compiler arguments
|
||||
// ACTION: Convert to secondary constructor
|
||||
// ACTION: Create test
|
||||
// ACTION: Enable a trailing comma by default in the formatter
|
||||
// ACTION: Introduce import alias
|
||||
// ACTION: Move to class body
|
||||
// ACTION: Opt in for 'PropertyTypeMarker' in containing file 'propertyInConstructor.kt'
|
||||
// ACTION: Opt in for 'PropertyTypeMarker' on constructor
|
||||
// ACTION: Opt in for 'PropertyTypeMarker' on containing class 'PropertyTypeContainer'
|
||||
// ACTION: Propagate 'PropertyTypeMarker' opt-in requirement to constructor
|
||||
// ACTION: Propagate 'PropertyTypeMarker' opt-in requirement to containing class 'PropertyTypeContainer'
|
||||
|
||||
@RequiresOptIn
|
||||
annotation class PropertyTypeMarker
|
||||
|
||||
-14
@@ -1,18 +1,4 @@
|
||||
// "Opt in for 'PropertyTypeMarker' on containing class 'PropertyTypeContainer'" "true"
|
||||
// IGNORE_FIR
|
||||
// COMPILER_ARGUMENTS: -opt-in=kotlin.RequiresOptIn
|
||||
// WITH_STDLIB
|
||||
// ACTION: Add '-opt-in=PropertyTypeMarker' to module light_idea_test_case compiler arguments
|
||||
// ACTION: Convert to secondary constructor
|
||||
// ACTION: Create test
|
||||
// ACTION: Enable a trailing comma by default in the formatter
|
||||
// ACTION: Introduce import alias
|
||||
// ACTION: Move to class body
|
||||
// ACTION: Opt in for 'PropertyTypeMarker' in containing file 'propertyInConstructorAddOptInToClass.kt'
|
||||
// ACTION: Opt in for 'PropertyTypeMarker' on constructor
|
||||
// ACTION: Opt in for 'PropertyTypeMarker' on containing class 'PropertyTypeContainer'
|
||||
// ACTION: Propagate 'PropertyTypeMarker' opt-in requirement to constructor
|
||||
// ACTION: Propagate 'PropertyTypeMarker' opt-in requirement to containing class 'PropertyTypeContainer'
|
||||
|
||||
@RequiresOptIn
|
||||
annotation class PropertyTypeMarker
|
||||
|
||||
-14
@@ -1,18 +1,4 @@
|
||||
// "Opt in for 'PropertyTypeMarker' on containing class 'PropertyTypeContainer'" "true"
|
||||
// IGNORE_FIR
|
||||
// COMPILER_ARGUMENTS: -opt-in=kotlin.RequiresOptIn
|
||||
// WITH_STDLIB
|
||||
// ACTION: Add '-opt-in=PropertyTypeMarker' to module light_idea_test_case compiler arguments
|
||||
// ACTION: Convert to secondary constructor
|
||||
// ACTION: Create test
|
||||
// ACTION: Enable a trailing comma by default in the formatter
|
||||
// ACTION: Introduce import alias
|
||||
// ACTION: Move to class body
|
||||
// ACTION: Opt in for 'PropertyTypeMarker' in containing file 'propertyInConstructorAddOptInToClass.kt'
|
||||
// ACTION: Opt in for 'PropertyTypeMarker' on constructor
|
||||
// ACTION: Opt in for 'PropertyTypeMarker' on containing class 'PropertyTypeContainer'
|
||||
// ACTION: Propagate 'PropertyTypeMarker' opt-in requirement to constructor
|
||||
// ACTION: Propagate 'PropertyTypeMarker' opt-in requirement to containing class 'PropertyTypeContainer'
|
||||
|
||||
@RequiresOptIn
|
||||
annotation class PropertyTypeMarker
|
||||
|
||||
+1
-14
@@ -1,18 +1,5 @@
|
||||
// "Opt in for 'PropertyTypeMarker' on constructor" "true"
|
||||
// IGNORE_FIR
|
||||
// COMPILER_ARGUMENTS: -opt-in=kotlin.RequiresOptIn
|
||||
// WITH_STDLIB
|
||||
// ACTION: Add '-opt-in=PropertyTypeMarker' to module light_idea_test_case compiler arguments
|
||||
// ACTION: Convert to secondary constructor
|
||||
// ACTION: Create test
|
||||
// ACTION: Enable a trailing comma by default in the formatter
|
||||
// ACTION: Introduce import alias
|
||||
// ACTION: Move to class body
|
||||
// ACTION: Opt in for 'PropertyTypeMarker' in containing file 'propertyInConstructorAddOptInToConstructor.kt'
|
||||
// ACTION: Opt in for 'PropertyTypeMarker' on constructor
|
||||
// ACTION: Opt in for 'PropertyTypeMarker' on containing class 'PropertyTypeContainer'
|
||||
// ACTION: Propagate 'PropertyTypeMarker' opt-in requirement to constructor
|
||||
// ACTION: Propagate 'PropertyTypeMarker' opt-in requirement to containing class 'PropertyTypeContainer'
|
||||
|
||||
|
||||
@RequiresOptIn
|
||||
annotation class PropertyTypeMarker
|
||||
|
||||
+1
-14
@@ -1,18 +1,5 @@
|
||||
// "Opt in for 'PropertyTypeMarker' on constructor" "true"
|
||||
// IGNORE_FIR
|
||||
// COMPILER_ARGUMENTS: -opt-in=kotlin.RequiresOptIn
|
||||
// WITH_STDLIB
|
||||
// ACTION: Add '-opt-in=PropertyTypeMarker' to module light_idea_test_case compiler arguments
|
||||
// ACTION: Convert to secondary constructor
|
||||
// ACTION: Create test
|
||||
// ACTION: Enable a trailing comma by default in the formatter
|
||||
// ACTION: Introduce import alias
|
||||
// ACTION: Move to class body
|
||||
// ACTION: Opt in for 'PropertyTypeMarker' in containing file 'propertyInConstructorAddOptInToConstructor.kt'
|
||||
// ACTION: Opt in for 'PropertyTypeMarker' on constructor
|
||||
// ACTION: Opt in for 'PropertyTypeMarker' on containing class 'PropertyTypeContainer'
|
||||
// ACTION: Propagate 'PropertyTypeMarker' opt-in requirement to constructor
|
||||
// ACTION: Propagate 'PropertyTypeMarker' opt-in requirement to containing class 'PropertyTypeContainer'
|
||||
|
||||
|
||||
@RequiresOptIn
|
||||
annotation class PropertyTypeMarker
|
||||
|
||||
@@ -1,11 +1,5 @@
|
||||
// "Opt in for 'AliasMarker' on 'AliasMarkerUsage'" "true"
|
||||
// IGNORE_FIR
|
||||
// COMPILER_ARGUMENTS: -opt-in=kotlin.RequiresOptIn
|
||||
// WITH_STDLIB
|
||||
// ACTION: Add '-opt-in=AliasMarker' to module light_idea_test_case compiler arguments
|
||||
// ACTION: Introduce import alias
|
||||
// ACTION: Opt in for 'AliasMarker' in containing file 'typeAlias.kt'
|
||||
// ACTION: Opt in for 'AliasMarker' on 'AliasMarkerUsage'
|
||||
|
||||
|
||||
@RequiresOptIn
|
||||
annotation class AliasMarker
|
||||
|
||||
@@ -1,11 +1,5 @@
|
||||
// "Opt in for 'AliasMarker' on 'AliasMarkerUsage'" "true"
|
||||
// IGNORE_FIR
|
||||
// COMPILER_ARGUMENTS: -opt-in=kotlin.RequiresOptIn
|
||||
// WITH_STDLIB
|
||||
// ACTION: Add '-opt-in=AliasMarker' to module light_idea_test_case compiler arguments
|
||||
// ACTION: Introduce import alias
|
||||
// ACTION: Opt in for 'AliasMarker' in containing file 'typeAlias.kt'
|
||||
// ACTION: Opt in for 'AliasMarker' on 'AliasMarkerUsage'
|
||||
|
||||
|
||||
@RequiresOptIn
|
||||
annotation class AliasMarker
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
// "Propagate 'TopMarker' opt-in requirement to 'topUserVal'" "true"
|
||||
// IGNORE_FIR
|
||||
// COMPILER_ARGUMENTS: -opt-in=kotlin.RequiresOptIn
|
||||
// WITH_STDLIB
|
||||
|
||||
@RequiresOptIn
|
||||
annotation class TopMarker
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
// "Propagate 'TopMarker' opt-in requirement to 'topUserVal'" "true"
|
||||
// IGNORE_FIR
|
||||
// COMPILER_ARGUMENTS: -opt-in=kotlin.RequiresOptIn
|
||||
// WITH_STDLIB
|
||||
|
||||
@RequiresOptIn
|
||||
annotation class TopMarker
|
||||
|
||||
Reference in New Issue
Block a user