Extend fixes of experimental errors to property & type alias
#KT-25525 Fixed #KT-25526 Fixed
This commit is contained in:
@@ -29,7 +29,9 @@ object ExperimentalFixesFactory : KotlinIntentionActionsFactory() {
|
|||||||
val containingDeclaration: KtDeclaration = element.getParentOfTypesAndPredicate(
|
val containingDeclaration: KtDeclaration = element.getParentOfTypesAndPredicate(
|
||||||
true,
|
true,
|
||||||
KtDeclarationWithBody::class.java,
|
KtDeclarationWithBody::class.java,
|
||||||
KtClassOrObject::class.java
|
KtClassOrObject::class.java,
|
||||||
|
KtProperty::class.java,
|
||||||
|
KtTypeAlias::class.java
|
||||||
) {
|
) {
|
||||||
!KtPsiUtil.isLocal(it)
|
!KtPsiUtil.isLocal(it)
|
||||||
} ?: return emptyList()
|
} ?: return emptyList()
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
// "Add '@TopMarker' annotation to 'topUserVal'" "true"
|
||||||
|
// COMPILER_ARGUMENTS: -Xuse-experimental=kotlin.Experimental
|
||||||
|
// WITH_RUNTIME
|
||||||
|
|
||||||
|
@Experimental
|
||||||
|
annotation class TopMarker
|
||||||
|
|
||||||
|
@TopMarker
|
||||||
|
class TopClass
|
||||||
|
|
||||||
|
@Target(AnnotationTarget.TYPE)
|
||||||
|
@TopMarker
|
||||||
|
annotation class TopAnn
|
||||||
|
|
||||||
|
val topUserVal: @<caret>TopAnn TopClass? = null
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
// "Add '@TopMarker' annotation to 'topUserVal'" "true"
|
||||||
|
// COMPILER_ARGUMENTS: -Xuse-experimental=kotlin.Experimental
|
||||||
|
// WITH_RUNTIME
|
||||||
|
|
||||||
|
@Experimental
|
||||||
|
annotation class TopMarker
|
||||||
|
|
||||||
|
@TopMarker
|
||||||
|
class TopClass
|
||||||
|
|
||||||
|
@Target(AnnotationTarget.TYPE)
|
||||||
|
@TopMarker
|
||||||
|
annotation class TopAnn
|
||||||
|
|
||||||
|
@TopMarker
|
||||||
|
val topUserVal: @TopAnn TopClass? = null
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
// "Add '@UseExperimental(AliasMarker::class)' annotation to 'AliasMarkerUsage'" "true"
|
||||||
|
// COMPILER_ARGUMENTS: -Xuse-experimental=kotlin.Experimental
|
||||||
|
// WITH_RUNTIME
|
||||||
|
// ACTION: Add '-Xuse-experimental=AliasMarker' to module light_idea_test_case compiler arguments
|
||||||
|
|
||||||
|
@Experimental
|
||||||
|
annotation class AliasMarker
|
||||||
|
|
||||||
|
@AliasMarker
|
||||||
|
class AliasTarget
|
||||||
|
|
||||||
|
typealias AliasMarkerUsage = <caret>AliasTarget
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
// "Add '@UseExperimental(AliasMarker::class)' annotation to 'AliasMarkerUsage'" "true"
|
||||||
|
// COMPILER_ARGUMENTS: -Xuse-experimental=kotlin.Experimental
|
||||||
|
// WITH_RUNTIME
|
||||||
|
// ACTION: Add '-Xuse-experimental=AliasMarker' to module light_idea_test_case compiler arguments
|
||||||
|
|
||||||
|
@Experimental
|
||||||
|
annotation class AliasMarker
|
||||||
|
|
||||||
|
@AliasMarker
|
||||||
|
class AliasTarget
|
||||||
|
|
||||||
|
@UseExperimental(AliasMarker::class) typealias AliasMarkerUsage = AliasTarget
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
// "Add '@TopMarker' annotation to 'topUserVal'" "true"
|
||||||
|
// COMPILER_ARGUMENTS: -Xuse-experimental=kotlin.Experimental
|
||||||
|
// WITH_RUNTIME
|
||||||
|
|
||||||
|
@Experimental
|
||||||
|
annotation class TopMarker
|
||||||
|
|
||||||
|
@TopMarker
|
||||||
|
class TopClass
|
||||||
|
|
||||||
|
@Target(AnnotationTarget.TYPE)
|
||||||
|
@TopMarker
|
||||||
|
annotation class TopAnn
|
||||||
|
|
||||||
|
val topUserVal: @TopAnn <caret>TopClass? = null
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
// "Add '@TopMarker' annotation to 'topUserVal'" "true"
|
||||||
|
// COMPILER_ARGUMENTS: -Xuse-experimental=kotlin.Experimental
|
||||||
|
// WITH_RUNTIME
|
||||||
|
|
||||||
|
@Experimental
|
||||||
|
annotation class TopMarker
|
||||||
|
|
||||||
|
@TopMarker
|
||||||
|
class TopClass
|
||||||
|
|
||||||
|
@Target(AnnotationTarget.TYPE)
|
||||||
|
@TopMarker
|
||||||
|
annotation class TopAnn
|
||||||
|
|
||||||
|
@TopMarker
|
||||||
|
val topUserVal: @TopAnn TopClass? = null
|
||||||
@@ -6164,6 +6164,11 @@ public class QuickFixTestGenerated extends AbstractQuickFixTest {
|
|||||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/quickfix/experimental"), Pattern.compile("^([\\w\\-_]+)\\.kt$"), TargetBackend.ANY, true);
|
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/quickfix/experimental"), Pattern.compile("^([\\w\\-_]+)\\.kt$"), TargetBackend.ANY, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("annotationInTopLevelProperty.kt")
|
||||||
|
public void testAnnotationInTopLevelProperty() throws Exception {
|
||||||
|
runTest("idea/testData/quickfix/experimental/annotationInTopLevelProperty.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("basicFunction.kt")
|
@TestMetadata("basicFunction.kt")
|
||||||
public void testBasicFunction() throws Exception {
|
public void testBasicFunction() throws Exception {
|
||||||
runTest("idea/testData/quickfix/experimental/basicFunction.kt");
|
runTest("idea/testData/quickfix/experimental/basicFunction.kt");
|
||||||
@@ -6223,6 +6228,16 @@ public class QuickFixTestGenerated extends AbstractQuickFixTest {
|
|||||||
public void testSwitchOn() throws Exception {
|
public void testSwitchOn() throws Exception {
|
||||||
runTest("idea/testData/quickfix/experimental/switchOn.kt");
|
runTest("idea/testData/quickfix/experimental/switchOn.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("typeAlias.kt")
|
||||||
|
public void testTypeAlias() throws Exception {
|
||||||
|
runTest("idea/testData/quickfix/experimental/typeAlias.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("typeInTopLevelProperty.kt")
|
||||||
|
public void testTypeInTopLevelProperty() throws Exception {
|
||||||
|
runTest("idea/testData/quickfix/experimental/typeInTopLevelProperty.kt");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("idea/testData/quickfix/expressions")
|
@TestMetadata("idea/testData/quickfix/expressions")
|
||||||
|
|||||||
Reference in New Issue
Block a user