Destructure intention now handles the case with manual destructuring inside #KT-13943 Fixed
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
data class XY(val x: Int, val y: Int)
|
||||
|
||||
fun foo(list: List<XY>) {
|
||||
for (element<caret> in list) {
|
||||
val (x, y) = element
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
data class XY(val x: Int, val y: Int)
|
||||
|
||||
fun foo(list: List<XY>) {
|
||||
for ((x, y) in list) {
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// IS_APPLICABLE: false
|
||||
// WITH_RUNTIME
|
||||
|
||||
data class XY(val x: Int, val y: Int)
|
||||
|
||||
fun foo(list: List<XY>) {
|
||||
for (element<caret> in list) {
|
||||
val z = element.y
|
||||
val (x, y) = element
|
||||
}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
data class XY(val x: Int, val y: Int)
|
||||
|
||||
fun foo(list: List<XY>) {
|
||||
for (element<caret> in list) {
|
||||
val z = element.y
|
||||
val (x) = element
|
||||
}
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
data class XY(val x: Int, val y: Int)
|
||||
|
||||
fun foo(list: List<XY>) {
|
||||
for ((x, z) in list) {
|
||||
}
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
data class XY(val x: Int, val y: Int)
|
||||
|
||||
fun foo(list: List<XY>): Int {
|
||||
var result = 0
|
||||
for (element<caret> in list) {
|
||||
val (x) = element
|
||||
result += x
|
||||
result += element.y
|
||||
}
|
||||
return result
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
data class XY(val x: Int, val y: Int)
|
||||
|
||||
fun foo(list: List<XY>): Int {
|
||||
var result = 0
|
||||
for ((x, y) in list) {
|
||||
result += x
|
||||
result += y
|
||||
}
|
||||
return result
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun foo(map: Map<Int, Int>) {
|
||||
for (entry<caret> in map.entries) {
|
||||
val (key) = entry
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun foo(map: Map<Int, Int>) {
|
||||
for ((key) in map) {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun foo(map: Map<Int, Int>) {
|
||||
for (entry<caret> in map.entries) {
|
||||
val (key, value) = entry
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun foo(map: Map<Int, Int>) {
|
||||
for ((key, value) in map) {
|
||||
}
|
||||
}
|
||||
@@ -191,4 +191,44 @@
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Use destructuring declaration</problem_class>
|
||||
<description>Use destructuring declaration</description>
|
||||
</problem>
|
||||
<problem>
|
||||
<file>DataClassWithDestructuring.kt</file>
|
||||
<line>6</line>
|
||||
<module>light_idea_test_case</module>
|
||||
<entry_point TYPE="file" FQNAME="temp:///src/DataClassWithDestructuring.kt" />
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Use destructuring declaration</problem_class>
|
||||
<description>Use destructuring declaration</description>
|
||||
</problem>
|
||||
<problem>
|
||||
<file>DataClassWithDestructuringFakeConflict.kt</file>
|
||||
<line>6</line>
|
||||
<module>light_idea_test_case</module>
|
||||
<entry_point TYPE="file" FQNAME="temp:///src/DataClassWithDestructuringFakeConflict.kt" />
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Use destructuring declaration</problem_class>
|
||||
<description>Use destructuring declaration</description>
|
||||
</problem>
|
||||
<problem>
|
||||
<file>DataClassWithDestructuringPartial.kt</file>
|
||||
<line>7</line>
|
||||
<module>light_idea_test_case</module>
|
||||
<entry_point TYPE="file" FQNAME="temp:///src/DataClassWithDestructuringPartial.kt" />
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Use destructuring declaration</problem_class>
|
||||
<description>Use destructuring declaration</description>
|
||||
</problem>
|
||||
<problem>
|
||||
<file>KeyOnlyWithDestructuring.kt</file>
|
||||
<line>4</line>
|
||||
<module>light_idea_test_case</module>
|
||||
<entry_point TYPE="file" FQNAME="temp:///src/KeyOnlyWithDestructuring.kt" />
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Use destructuring declaration</problem_class>
|
||||
<description>Use destructuring declaration</description>
|
||||
</problem>
|
||||
<problem>
|
||||
<file>KeyValueWithDestructuring.kt</file>
|
||||
<line>4</line>
|
||||
<module>light_idea_test_case</module>
|
||||
<entry_point TYPE="file" FQNAME="temp:///src/KeyValueWithDestructuring.kt" />
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Use destructuring declaration</problem_class>
|
||||
<description>Use destructuring declaration</description>
|
||||
</problem>
|
||||
</problems>
|
||||
Reference in New Issue
Block a user