ReplaceArrayOfWithLiteralInspection: Remove unnecessary parentheses
#KT-21878 Fixed
This commit is contained in:
committed by
Alexey Sedunov
parent
c95ed9fd20
commit
8271e85dbb
@@ -449,6 +449,8 @@ public class KtPsiUtil {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (parentElement instanceof KtCollectionLiteralExpression) return false;
|
||||
|
||||
if (innerExpression instanceof KtIfExpression) {
|
||||
if (parentElement instanceof KtQualifiedExpression) return true;
|
||||
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
// LANGUAGE_VERSION: 1.2
|
||||
|
||||
import kotlin.reflect.KClass
|
||||
|
||||
class Foo
|
||||
class Bar
|
||||
|
||||
annotation class Ann(val values: Array<KClass<*>>)
|
||||
|
||||
@Ann(values = <caret>arrayOf(Foo::class, Bar::class))
|
||||
class Test
|
||||
@@ -0,0 +1,11 @@
|
||||
// LANGUAGE_VERSION: 1.2
|
||||
|
||||
import kotlin.reflect.KClass
|
||||
|
||||
class Foo
|
||||
class Bar
|
||||
|
||||
annotation class Ann(val values: Array<KClass<*>>)
|
||||
|
||||
@Ann(values = [Foo::class, Bar::class])
|
||||
class Test
|
||||
+5
@@ -3755,6 +3755,11 @@ public class LocalInspectionTestGenerated extends AbstractLocalInspectionTest {
|
||||
runTest("idea/testData/inspectionsLocal/replaceArrayOfWithLiteral/intArray.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kclass.kt")
|
||||
public void testKclass() throws Exception {
|
||||
runTest("idea/testData/inspectionsLocal/replaceArrayOfWithLiteral/kclass.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("noAnnotation.kt")
|
||||
public void testNoAnnotation() throws Exception {
|
||||
runTest("idea/testData/inspectionsLocal/replaceArrayOfWithLiteral/noAnnotation.kt");
|
||||
|
||||
Reference in New Issue
Block a user