Add intention to specify all types explicitly in destructuring assignment

#KT-16260 Fixed
This commit is contained in:
Toshiaki Kameyama
2017-08-17 09:45:36 +09:00
committed by Dmitry Jemerov
parent 3529d61a7d
commit 6b2c22aff1
21 changed files with 197 additions and 4 deletions
@@ -0,0 +1 @@
org.jetbrains.kotlin.idea.intentions.SpecifyTypeExplicitlyInDestructuringAssignmentIntention
@@ -0,0 +1,6 @@
// WITH_RUNTIME
fun test() {
val map = mapOf(1 to "two")
for (<caret>(key, value) in map) {
}
}
@@ -0,0 +1,6 @@
// WITH_RUNTIME
fun test() {
val map = mapOf(1 to "two")
for ((key: Int, value: String<caret>) in map) {
}
}
@@ -0,0 +1,6 @@
// WITH_RUNTIME
fun test() {
val list = emptyList<Pair<Int, String>>()
list.forEach { (i, s)<caret> ->
}
}
@@ -0,0 +1,6 @@
// WITH_RUNTIME
fun test() {
val list = emptyList<Pair<Int, String>>()
list.forEach { (i: Int, s: String)<caret> ->
}
}
@@ -0,0 +1,6 @@
// WITH_RUNTIME
fun test() {
val list = emptyList<Pair<Int, String>>()
list.forEach { (i, s)<caret>: Pair<Int, String> ->
}
}
@@ -0,0 +1,6 @@
// WITH_RUNTIME
fun test() {
val list = emptyList<Pair<Int, String>>()
list.forEach { (i: Int, s: String)<caret>: Pair<Int, String> ->
}
}
@@ -0,0 +1,5 @@
// IS_APPLICABLE: false
// WITH_RUNTIME
fun test() {
val (i: Int, s: String)<caret> = Pair(1, "s")
}
@@ -0,0 +1,4 @@
// WITH_RUNTIME
fun test() {
val (i, s)<caret> = Pair(1, "s")
}
@@ -0,0 +1,4 @@
// WITH_RUNTIME
fun test() {
val (i: Int, s: String<caret>) = Pair(1, "s")
}
@@ -0,0 +1,4 @@
// WITH_RUNTIME
fun test() {
val (i: Int, s) <caret>= Pair(1, "s")
}
@@ -0,0 +1,4 @@
// WITH_RUNTIME
fun test() {
val (i: Int, s: String<caret>) = Pair(1, "s")
}
@@ -0,0 +1,4 @@
// WITH_RUNTIME
fun test() {
val (_, s) =<caret> Pair(1, "s")
}
@@ -0,0 +1,4 @@
// WITH_RUNTIME
fun test() {
val (_: Int, s: String<caret>) = Pair(1, "s")
}