Introduce intention to name anonymous parameter #KT-17191 Fixed

This commit is contained in:
Dmitry Neverov
2017-04-24 23:01:35 +03:00
committed by Mikhail Glukhikh
parent bc071bf543
commit 9dd217eee3
25 changed files with 276 additions and 0 deletions
@@ -0,0 +1 @@
org.jetbrains.kotlin.idea.intentions.ReplaceUnderscoreWithParameterNameIntention
@@ -0,0 +1 @@
val f = fun(i: Int, <caret>_: String) = i
@@ -0,0 +1 @@
val f = fun(i: Int, s: String) = i
@@ -0,0 +1,6 @@
// WITH_RUNTIME
fun foo(pair: Pair<Int, Int>) {
val (<caret>_, _) = pair
val first = 42
}
@@ -0,0 +1,6 @@
// WITH_RUNTIME
fun foo(pair: Pair<Int, Int>) {
val (first1, _) = pair
val first = 42
}
@@ -0,0 +1,5 @@
data class Data(val first: Int, val second: Int)
fun foo() {
val (first, <caret>_) = Data(1, 2)
}
@@ -0,0 +1,5 @@
data class Data(val first: Int, val second: Int)
fun foo() {
val (first, second) = Data(1, 2)
}
@@ -0,0 +1,7 @@
data class Data(val first: Int, val second: Int)
fun foo(list: List<Data>) {
for ((<caret>_, _) in list) {
}
}
@@ -0,0 +1,7 @@
data class Data(val first: Int, val second: Int)
fun foo(list: List<Data>) {
for ((first, _) in list) {
}
}
@@ -0,0 +1,7 @@
fun foo(f: (a: Int, b: Int, c: Int) -> Unit) {
f(1, 2, 3)
}
fun bar() {
foo { _, <caret>_, _ -> }
}
@@ -0,0 +1,7 @@
fun foo(f: (a: Int, b: Int, c: Int) -> Unit) {
f(1, 2, 3)
}
fun bar() {
foo { _, b, _ -> }
}
@@ -0,0 +1,7 @@
fun foo(f: (a: Int, b: Int, c: Int) -> Int) {
f(1, 2, 3)
}
fun bar(c: Int) {
foo { _, _, <caret>_ -> c }
}
@@ -0,0 +1,7 @@
fun foo(f: (a: Int, b: Int, c: Int) -> Int) {
f(1, 2, 3)
}
fun bar(c: Int) {
foo { _, _, c1 -> c }
}
@@ -0,0 +1,7 @@
fun foo(f: (Int, Int, Int) -> Unit) {
f(1, 2, 3)
}
fun bar() {
foo { _, <caret>_, _ -> }
}
@@ -0,0 +1,7 @@
fun foo(f: (Int, Int, Int) -> Unit) {
f(1, 2, 3)
}
fun bar() {
foo { _, i, _ -> }
}
@@ -0,0 +1,7 @@
// WITH_RUNTIME
fun foo(map: Map<String, Int>) {
for ((<caret>_, _) in map) {
}
}
@@ -0,0 +1,7 @@
// WITH_RUNTIME
fun foo(map: Map<String, Int>) {
for ((key, _) in map) {
}
}
@@ -0,0 +1,5 @@
// WITH_RUNTIME
fun foo(t: Triple<String, Int, Boolean>) {
val (_, _, <caret>_) = t
}
@@ -0,0 +1,5 @@
// WITH_RUNTIME
fun foo(t: Triple<String, Int, Boolean>) {
val (_, _, third) = t
}