[kotlin] Update SubclassOptInRequired quickFixes following KT-70562 changes

Added tests for SubclassOptInRequired with multiple markers

^KTIJ-31183 Fixed

GitOrigin-RevId: 8f4bb49fc94777c25002dcce3e05ec2453a5e50d
This commit is contained in:
Anastasia Pikalova
2024-09-23 16:37:56 +02:00
committed by intellij-monorepo-bot
parent 5654bdc580
commit f2f5834cda
16 changed files with 159 additions and 50 deletions
@@ -1933,6 +1933,16 @@ public abstract class K2QuickFixTestGenerated extends AbstractK2QuickFixTest {
runTest("../../../idea/tests/testData/quickfix/optIn/propagateOptIn8Fir.kt");
}
@TestMetadata("propagateSubclassOptInMultipleMarkers1.kt")
public void testPropagateSubclassOptInMultipleMarkers1() throws Exception {
runTest("../../../idea/tests/testData/quickfix/optIn/propagateSubclassOptInMultipleMarkers1.kt");
}
@TestMetadata("propagateSubclassOptInMultipleMarkers2.kt")
public void testPropagateSubclassOptInMultipleMarkers2() throws Exception {
runTest("../../../idea/tests/testData/quickfix/optIn/propagateSubclassOptInMultipleMarkers2.kt");
}
@TestMetadata("propagateSubclassOptInRequired.kt")
public void testPropagateSubclassOptInRequired() throws Exception {
runTest("../../../idea/tests/testData/quickfix/optIn/propagateSubclassOptInRequired.kt");
@@ -12678,6 +12678,16 @@ public abstract class K1QuickFixTestGenerated extends AbstractK1QuickFixTest {
runTest("testData/quickfix/optIn/propagateOptIn8Fir.kt");
}
@TestMetadata("propagateSubclassOptInMultipleMarkers1.kt")
public void testPropagateSubclassOptInMultipleMarkers1() throws Exception {
runTest("testData/quickfix/optIn/propagateSubclassOptInMultipleMarkers1.kt");
}
@TestMetadata("propagateSubclassOptInMultipleMarkers2.kt")
public void testPropagateSubclassOptInMultipleMarkers2() throws Exception {
runTest("testData/quickfix/optIn/propagateSubclassOptInMultipleMarkers2.kt");
}
@TestMetadata("propagateSubclassOptInRequired.kt")
public void testPropagateSubclassOptInRequired() throws Exception {
runTest("testData/quickfix/optIn/propagateSubclassOptInRequired.kt");
@@ -1,12 +1,15 @@
// PROBLEM: none
// API_VERSION: 1.8
// WITH_STDLIB
@file:OptIn(UnstableApi::class, ExperimentalSubclassOptIn::class)
@file:OptIn(UnstableApiA::class, UnstableApiB::class, ExperimentalSubclassOptIn::class)
@RequiresOptIn(message = "Interfaces in this library are experimental for implementation")
annotation class UnstableApi
@RequiresOptIn
annotation class UnstableApiA
@SubclassOptInRequired(UnstableApi::class)
@RequiresOptIn
annotation class UnstableApiB
@SubclassOptInRequired(UnstableApiA::class, UnstableApiB::class)
interface CoreLibraryApi
interface SomeImplementation : CoreLibraryApi
@@ -1,29 +1,39 @@
// PROBLEM: none
// API_VERSION: 1.8
// WITH_STDLIB
@file:OptIn(ExperimentalSubclassOptIn::class)
@RequiresOptIn(message = "Interfaces in this library are experimental for implementation")
annotation class UnstableApi
annotation class UnstableApiA
@SubclassOptInRequired(UnstableApi::class)
@RequiresOptIn(message = "Interfaces in this library are experimental for implementation")
annotation class UnstableApiB
@SubclassOptInRequired(UnstableApiA::class, UnstableApiB::class)
interface CoreLibraryApi
@OptIn(UnstableApi::class)
@OptIn(UnstableApiA::class)
@OptIn(UnstableApiB::class)
interface SomeImplementationInterface : CoreLibraryApi
@OptIn(UnstableApi::class)
@OptIn(UnstableApiA::class)
@OptIn(UnstableApiB::class)
object SomeImplementationObject : CoreLibraryApi
@OptIn(UnstableApi::class)
@OptIn(UnstableApiA::class)
@OptIn(UnstableApiB::class)
class SomeImplementationClass : CoreLibraryApi
@OptIn(UnstableApi::class)
@OptIn(UnstableApiA::class)
@OptIn(UnstableApiB::class)
enum class SomeImplementationEnum : CoreLibraryApi
@OptIn(UnstableApi::class)
@OptIn(UnstableApiA::class)
@OptIn(UnstableApiB::class)
val apiUseSiteProperty = object : CoreLibraryApi {}
@OptIn(UnstableApi::class)
@OptIn(UnstableApiA::class)
@OptIn(UnstableApiB::class)
fun test() {
val apiUseSiteProperty = object : CoreLibraryApi {}
}
@@ -1,16 +1,18 @@
// API_VERSION: 1.8
// API_VERSION: 2.1
// WITH_STDLIB
@file:OptIn(ExperimentalSubclassOptIn::class)
@RequiresOptIn(
level = RequiresOptIn.Level.WARNING,
message = "Interfaces in this library are experimental for implementation"
)
annotation class UnstableApi
@RequiresOptIn
annotation class UnstableApiA
@SubclassOptInRequired(UnstableApi::class)
@RequiresOptIn
annotation class UnstableApiB
@SubclassOptInRequired(UnstableApiA::class, UnstableApiB::class)
interface CoreLibraryApi
class ApiUseSiteParameter(
<caret>@OptIn(UnstableApi::class) val foo: CoreLibraryApi
<caret>@OptIn(UnstableApiA::class) val foo: CoreLibraryApi
) {
}
@@ -1,16 +1,18 @@
// API_VERSION: 1.8
// API_VERSION: 2.1
// WITH_STDLIB
@file:OptIn(ExperimentalSubclassOptIn::class)
@RequiresOptIn(
level = RequiresOptIn.Level.WARNING,
message = "Interfaces in this library are experimental for implementation"
)
annotation class UnstableApi
@RequiresOptIn
annotation class UnstableApiA
@SubclassOptInRequired(UnstableApi::class)
@RequiresOptIn
annotation class UnstableApiB
@SubclassOptInRequired(UnstableApiA::class, UnstableApiB::class)
interface CoreLibraryApi
class ApiUseSiteParameter(
val foo: CoreLibraryApi
) {
}
}
@@ -1,15 +1,17 @@
// API_VERSION: 1.8
// API_VERSION: 2.1
// WITH_STDLIB
@file:OptIn(ExperimentalSubclassOptIn::class)
@RequiresOptIn(
level = RequiresOptIn.Level.WARNING,
message = "Interfaces in this library are experimental for implementation"
)
annotation class UnstableApi
@RequiresOptIn
annotation class UnstableApiA
@SubclassOptInRequired(UnstableApi::class)
@RequiresOptIn
annotation class UnstableApiB
@SubclassOptInRequired(UnstableApiA::class, UnstableApiB::class)
interface CoreLibraryApi
@OptIn(UnstableApi::class)<caret>
@OptIn(UnstableApiB::class)<caret>
class ApiUseSiteClass(val foo: CoreLibraryApi) {
}
@@ -1,13 +1,15 @@
// API_VERSION: 1.8
// API_VERSION: 2.1
// WITH_STDLIB
@file:OptIn(ExperimentalSubclassOptIn::class)
@RequiresOptIn(
level = RequiresOptIn.Level.WARNING,
message = "Interfaces in this library are experimental for implementation"
)
annotation class UnstableApi
@RequiresOptIn
annotation class UnstableApiA
@SubclassOptInRequired(UnstableApi::class)
@RequiresOptIn
annotation class UnstableApiB
@SubclassOptInRequired(UnstableApiA::class, UnstableApiB::class)
interface CoreLibraryApi
class ApiUseSiteClass(val foo: CoreLibraryApi) {
@@ -1,4 +1,3 @@
// API_VERSION: 1.8
@file:OptIn(ExperimentalSubclassOptIn::class)
@RequiresOptIn(
@@ -1,4 +1,3 @@
// API_VERSION: 1.8
@file:OptIn(ExperimentalSubclassOptIn::class)
@RequiresOptIn(
@@ -1,4 +1,3 @@
// API_VERSION: 1.8
@file:OptIn(ExperimentalSubclassOptIn::class)
@RequiresOptIn(
@@ -1,4 +1,3 @@
// API_VERSION: 1.8
@file:OptIn(ExperimentalSubclassOptIn::class)
@RequiresOptIn(
@@ -14,4 +13,4 @@ var apiUseSiteProperty: CoreLibraryApi? = null
get() = null
set(value) {
field = value
}
}
@@ -0,0 +1,17 @@
// "Propagate 'SubclassOptInRequired(UnstableApiA::class)' opt-in requirement to 'SomeImplementation'" "true"
// ERROR: This class or interface requires opt-in to be implemented. Its usage must be marked with '@UnstableApiB', '@OptIn(UnstableApiB::class)' or '@SubclassOptInRequired(UnstableApiB::class)'
// WITH_STDLIB
@file:OptIn(ExperimentalSubclassOptIn::class)
@RequiresOptIn
annotation class UnstableApiA
@RequiresOptIn
annotation class UnstableApiB
@SubclassOptInRequired(UnstableApiA::class, UnstableApiB::class)
interface CoreLibraryApi
interface SomeImplementation : CoreLibraryApi<caret>
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.OptInFixes$PropagateOptInAnnotationFix
// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.OptInFixes$PropagateOptInAnnotationFix
@@ -0,0 +1,18 @@
// "Propagate 'SubclassOptInRequired(UnstableApiA::class)' opt-in requirement to 'SomeImplementation'" "true"
// ERROR: This class or interface requires opt-in to be implemented. Its usage must be marked with '@UnstableApiB', '@OptIn(UnstableApiB::class)' or '@SubclassOptInRequired(UnstableApiB::class)'
// WITH_STDLIB
@file:OptIn(ExperimentalSubclassOptIn::class)
@RequiresOptIn
annotation class UnstableApiA
@RequiresOptIn
annotation class UnstableApiB
@SubclassOptInRequired(UnstableApiA::class, UnstableApiB::class)
interface CoreLibraryApi
@SubclassOptInRequired(UnstableApiA::class)
interface SomeImplementation : CoreLibraryApi<caret>
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.OptInFixes$PropagateOptInAnnotationFix
// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.OptInFixes$PropagateOptInAnnotationFix
@@ -0,0 +1,18 @@
// "Propagate 'SubclassOptInRequired(UnstableApiB::class)' opt-in requirement to 'SomeImplementation'" "true"
// WITH_STDLIB
@file:OptIn(ExperimentalSubclassOptIn::class)
@RequiresOptIn
annotation class UnstableApiA
@RequiresOptIn
annotation class UnstableApiB
@SubclassOptInRequired(UnstableApiA::class, UnstableApiB::class)
interface CoreLibraryApi
@OptIn(UnstableApiA::class)
interface SomeImplementation : CoreLibraryApi<caret>
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.OptInFixes$PropagateOptInAnnotationFix
// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.OptInFixes$PropagateOptInAnnotationFix
@@ -0,0 +1,19 @@
// "Propagate 'SubclassOptInRequired(UnstableApiB::class)' opt-in requirement to 'SomeImplementation'" "true"
// WITH_STDLIB
@file:OptIn(ExperimentalSubclassOptIn::class)
@RequiresOptIn
annotation class UnstableApiA
@RequiresOptIn
annotation class UnstableApiB
@SubclassOptInRequired(UnstableApiA::class, UnstableApiB::class)
interface CoreLibraryApi
@SubclassOptInRequired(UnstableApiB::class)
@OptIn(UnstableApiA::class)
interface SomeImplementation : CoreLibraryApi<caret>
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.OptInFixes$PropagateOptInAnnotationFix
// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.OptInFixes$PropagateOptInAnnotationFix