Name Suggester: Suggest parameter name for the corresponding argument expression

#KT-8111 Fixed
This commit is contained in:
Alexey Sedunov
2015-11-10 15:07:22 +03:00
parent f21603daf2
commit aeee8bafe6
20 changed files with 137 additions and 51 deletions
@@ -1,6 +1,6 @@
open class A(n: Int)
fun foo() {
val i = 1
val x = object : A(i) {}
val n = 1
val x = object : A(n) {}
}
@@ -1,5 +1,5 @@
// WITH_RUNTIME
fun foo(c : Collection<String>){
val function: (String) -> Boolean = { it; false }
c.filter(function)
val predicate: (String) -> Boolean = { it; false }
c.filter(predicate)
}
@@ -3,6 +3,6 @@ class A {
}
fun apply(x: (A) -> Int) = 2
fun test() {
val function: (A) -> Int = { it.foo() }
apply(function)
val x: (A) -> Int = { it.foo() }
apply(x)
}
@@ -1,5 +1,5 @@
// WITH_RUNTIME
fun foo(c : Collection<String>){
val function: (String) -> Boolean = { it.length() > 1 }
c.filterTo(ArrayList<String>(), function)
val predicate: (String) -> Boolean = { it.length() > 1 }
c.filterTo(ArrayList<String>(), predicate)
}
@@ -2,7 +2,7 @@
fun foo(p: Int, list: List<Int>) {
if (p > 0) {
val function: (Int) -> Boolean = { it > 0 }
list.filter(function)
val predicate: (Int) -> Boolean = { it > 0 }
list.filter(predicate)
}
}
@@ -1,9 +1,9 @@
// WITH_RUNTIME
fun main(args: Array<String>) {
with(A()) {
val prop1 = prop
println(prop1)
println(prop1)
val message = prop
println(message)
println(message)
}
}
@@ -1,5 +1,5 @@
fun a(x: Int) {}
fun b() {
val i = 1
a(i)
val x = 1
a(x)
}