Simplify for intention: applicable of any numbers of properties used #KT-10779 Fixed
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
data class My(val first: String, val second: Int)
|
||||
|
||||
fun foo(list: List<My>) {
|
||||
for (<caret>my in list) {
|
||||
println(my.second)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
data class My(val first: String, val second: Int)
|
||||
|
||||
fun foo(list: List<My>) {
|
||||
for ((first, second) in list) {
|
||||
println(second)
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,3 @@
|
||||
// IS_APPLICABLE: false
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
@@ -6,6 +5,7 @@ fun main(args: Array<String>) {
|
||||
for (<caret>klass in list) {
|
||||
val a = klass.a
|
||||
val c = klass.c
|
||||
println("$a$c")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
val list = listOf(MyClass(1, 2, 3, 4))
|
||||
for ((a, b, c) in list) {
|
||||
println("$a$c")
|
||||
}
|
||||
}
|
||||
|
||||
data class MyClass(val a: Int, val b: Int, val c: Int, val d: Int)
|
||||
@@ -0,0 +1,8 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
val map = hashMapOf(1 to 1)
|
||||
for (<caret>entry in map) {
|
||||
println(entry.key)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
val map = hashMapOf(1 to 1)
|
||||
for ((key) in map) {
|
||||
println(key)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
val map = hashMapOf(1 to 1)
|
||||
for (<caret>entry in map) {
|
||||
println(entry.value)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
val map = hashMapOf(1 to 1)
|
||||
for ((key, value) in map) {
|
||||
println(value)
|
||||
}
|
||||
}
|
||||
@@ -135,4 +135,36 @@
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">'for' that can be simplified using destructing declaration</problem_class>
|
||||
<description>Simplify 'for' using destructing declaration</description>
|
||||
</problem>
|
||||
<problem>
|
||||
<file>ValueOnly.kt</file>
|
||||
<line>5</line>
|
||||
<module>light_idea_test_case</module>
|
||||
<entry_point TYPE="file" FQNAME="temp:///src/ValueOnly.kt" />
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">'for' that can be simplified using destructing declaration</problem_class>
|
||||
<description>Simplify 'for' using destructing declaration</description>
|
||||
</problem>
|
||||
<problem>
|
||||
<file>KeyOnly.kt</file>
|
||||
<line>5</line>
|
||||
<module>light_idea_test_case</module>
|
||||
<entry_point TYPE="file" FQNAME="temp:///src/KeyOnly.kt" />
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">'for' that can be simplified using destructing declaration</problem_class>
|
||||
<description>Simplify 'for' using destructing declaration</description>
|
||||
</problem>
|
||||
<problem>
|
||||
<file>DataClassNotAllPropertiesUsed.kt</file>
|
||||
<line>5</line>
|
||||
<module>light_idea_test_case</module>
|
||||
<entry_point TYPE="file" FQNAME="temp:///src/DataClassNotAllPropertiesUsed.kt" />
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">'for' that can be simplified using destructing declaration</problem_class>
|
||||
<description>Simplify 'for' using destructing declaration</description>
|
||||
</problem>
|
||||
<problem>
|
||||
<file>DataClassLast.kt</file>
|
||||
<line>6</line>
|
||||
<module>light_idea_test_case</module>
|
||||
<entry_point TYPE="file" FQNAME="temp:///src/DataClassLast.kt" />
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">'for' that can be simplified using destructing declaration</problem_class>
|
||||
<description>Simplify 'for' using destructing declaration</description>
|
||||
</problem>
|
||||
</problems>
|
||||
Reference in New Issue
Block a user