Introduce inspection "replace arrayOf with literal" #KT-17164 Fixed
This commit is contained in:
committed by
Mikhail Glukhikh
parent
fb9d88315a
commit
9990550429
@@ -0,0 +1 @@
|
||||
org.jetbrains.kotlin.idea.inspections.ReplaceArrayOfWithLiteralInspection
|
||||
@@ -0,0 +1,6 @@
|
||||
// ERROR: The feature "array literals in annotations" is only available since language version 1.2
|
||||
|
||||
annotation class Some(val strings: Array<String>)
|
||||
|
||||
@Some(strings = <caret>arrayOf("alpha", "beta", "omega"))
|
||||
class My
|
||||
@@ -0,0 +1,6 @@
|
||||
// ERROR: The feature "array literals in annotations" is only available since language version 1.2
|
||||
|
||||
annotation class Some(val strings: Array<String>)
|
||||
|
||||
@Some(strings = ["alpha", "beta", "omega"])
|
||||
class My
|
||||
@@ -0,0 +1,3 @@
|
||||
// ERROR: The feature "array literals in annotations" is only available since language version 1.2
|
||||
|
||||
annotation class Some(val strings: Array<String> = <caret>arrayOf("default"))
|
||||
@@ -0,0 +1,3 @@
|
||||
// ERROR: The feature "array literals in annotations" is only available since language version 1.2
|
||||
|
||||
annotation class Some(val strings: Array<String> = ["default"])
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
// PROBLEM: none
|
||||
class Some(val strings: Array<String> = <caret>arrayOf("default"))
|
||||
@@ -0,0 +1,6 @@
|
||||
// ERROR: The feature "array literals in annotations" is only available since language version 1.2
|
||||
|
||||
annotation class Some(val strings: Array<String>)
|
||||
|
||||
@Some(strings = <caret>emptyArray())
|
||||
class My
|
||||
@@ -0,0 +1,6 @@
|
||||
// ERROR: The feature "array literals in annotations" is only available since language version 1.2
|
||||
|
||||
annotation class Some(val strings: Array<String>)
|
||||
|
||||
@Some(strings = [])
|
||||
class My
|
||||
@@ -0,0 +1,6 @@
|
||||
// ERROR: The feature "array literals in annotations" is only available since language version 1.2
|
||||
|
||||
annotation class Some(val nums: IntArray)
|
||||
|
||||
@Some(nums = <caret>intArrayOf(1, 2))
|
||||
class My
|
||||
@@ -0,0 +1,6 @@
|
||||
// ERROR: The feature "array literals in annotations" is only available since language version 1.2
|
||||
|
||||
annotation class Some(val nums: IntArray)
|
||||
|
||||
@Some(nums = [1, 2])
|
||||
class My
|
||||
@@ -0,0 +1,5 @@
|
||||
// PROBLEM: none
|
||||
|
||||
fun foo() {
|
||||
val x = <caret>arrayOf("1")
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// PROBLEM: none
|
||||
// ERROR: Type mismatch: inferred type is Int but Array<String> was expected
|
||||
|
||||
annotation class Some(val arg: Array<String>)
|
||||
|
||||
fun create(x: Int) = x
|
||||
|
||||
@Some(arg = <caret>create(123))
|
||||
class My
|
||||
@@ -0,0 +1,6 @@
|
||||
// ERROR: The feature "array literals in annotations" is only available since language version 1.2
|
||||
|
||||
annotation class Some(val strings: Array<String>)
|
||||
|
||||
@Some(<caret>arrayOf("alpha", "beta", "omega"))
|
||||
class My
|
||||
@@ -0,0 +1,6 @@
|
||||
// ERROR: The feature "array literals in annotations" is only available since language version 1.2
|
||||
|
||||
annotation class Some(val strings: Array<String>)
|
||||
|
||||
@Some(["alpha", "beta", "omega"])
|
||||
class My
|
||||
@@ -0,0 +1,6 @@
|
||||
// ERROR: The feature "array literals in annotations" is only available since language version 1.2
|
||||
|
||||
annotation class Some(vararg val strings: String)
|
||||
|
||||
@Some(strings = *<caret>arrayOf("alpha", "beta", "omega"))
|
||||
class My
|
||||
@@ -0,0 +1,6 @@
|
||||
// ERROR: The feature "array literals in annotations" is only available since language version 1.2
|
||||
|
||||
annotation class Some(vararg val strings: String)
|
||||
|
||||
@Some(strings = *["alpha", "beta", "omega"])
|
||||
class My
|
||||
Reference in New Issue
Block a user