Implement quick-fix replacing parameter name with _
This quick-fix is registered for UNUSED_* diagnostic in places where it can be applied (destructured declarations/lambda parameters) #KT-14431 Fixed
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
// ACTION: Make 'Nested' internal
|
||||
// ACTION: Make 'Nested' public
|
||||
// ACTION: Remove parameter 'arg'
|
||||
// ACTION: Rename to _
|
||||
// ACTION: Convert to expression body
|
||||
// ERROR: 'internal' function exposes its 'private' parameter type argument Nested
|
||||
// ERROR: Cannot access 'Nested': it is private in 'Outer'
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
// "Rename to _" "true"
|
||||
|
||||
data class A(val x: String, val y: Int)
|
||||
|
||||
fun bar() {
|
||||
val (x<caret>, y) = A("", 1)
|
||||
y.hashCode()
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// "Rename to _" "true"
|
||||
|
||||
data class A(val x: String, val y: Int)
|
||||
|
||||
fun bar() {
|
||||
val (_, y) = A("", 1)
|
||||
y.hashCode()
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// "Rename to _" "true"
|
||||
|
||||
data class A(val x: String, val y: Int)
|
||||
|
||||
fun bar(z: List<A>) {
|
||||
for ((x<caret>, y) in z) {
|
||||
y.hashCode()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// "Rename to _" "true"
|
||||
|
||||
data class A(val x: String, val y: Int)
|
||||
|
||||
fun bar(z: List<A>) {
|
||||
for ((_, y) in z) {
|
||||
y.hashCode()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
// "Rename to _" "true"
|
||||
|
||||
data class A(val x: String, val y: Int)
|
||||
|
||||
fun foo(block: (A) -> Unit) {
|
||||
block(A("", 1))
|
||||
}
|
||||
|
||||
fun bar() {
|
||||
foo { (x<caret>, y: Int) ->
|
||||
y.hashCode()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
// "Rename to _" "true"
|
||||
|
||||
data class A(val x: String, val y: Int)
|
||||
|
||||
fun foo(block: (A) -> Unit) {
|
||||
block(A("", 1))
|
||||
}
|
||||
|
||||
fun bar() {
|
||||
foo { (_<caret>, y: Int) ->
|
||||
y.hashCode()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
// "Rename to _" "true"
|
||||
fun foo(block: (String, Int) -> Unit) {
|
||||
block("", 1)
|
||||
}
|
||||
|
||||
fun bar() {
|
||||
foo { x<caret>: String, y: Int ->
|
||||
y.hashCode()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
// "Rename to _" "true"
|
||||
fun foo(block: (String, Int) -> Unit) {
|
||||
block("", 1)
|
||||
}
|
||||
|
||||
fun bar() {
|
||||
foo { _: String, y: Int ->
|
||||
y.hashCode()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// "Rename to _" "false"
|
||||
// ACTION: Remove variable 'x'
|
||||
// ACTION: Specify type explicitly
|
||||
// ACTION: Split property declaration
|
||||
|
||||
fun bar() {
|
||||
val x<caret> = 1
|
||||
}
|
||||
Reference in New Issue
Block a user