AddFunctionParametersFix: use argument name as parameter name if argument is referenced variable

#KT-14021 Fixed
This commit is contained in:
Toshiaki Kameyama
2020-02-25 13:08:15 +09:00
committed by Yan Zhulanow
parent 8b8059acdd
commit 19d1532dc7
12 changed files with 120 additions and 7 deletions
@@ -0,0 +1,7 @@
// "Add parameter to function 'foo'" "true"
// DISABLE-ERRORS
fun foo() {}
fun test(isObject: Boolean) {
foo(isObject<caret>)
}
@@ -0,0 +1,7 @@
// "Add parameter to function 'foo'" "true"
// DISABLE-ERRORS
fun foo(isObject: Boolean) {}
fun test(isObject: Boolean) {
foo(isObject)
}
@@ -0,0 +1,7 @@
// "Add parameter to function 'bar'" "true"
// DISABLE-ERRORS
fun bar(isObject: Boolean) {}
fun test(isObject: Boolean) {
bar(true, isObject<caret>)
}
@@ -0,0 +1,7 @@
// "Add parameter to function 'bar'" "true"
// DISABLE-ERRORS
fun bar(isObject: Boolean, isObject1: Boolean) {}
fun test(isObject: Boolean) {
bar(true, isObject)
}
@@ -0,0 +1,7 @@
// "Add parameter to function 'foo'" "true"
// DISABLE-ERRORS
fun foo() {}
fun test(isObject: Boolean) {
foo((isObject)<caret>)
}
@@ -0,0 +1,7 @@
// "Add parameter to function 'foo'" "true"
// DISABLE-ERRORS
fun foo(isObject: Boolean) {}
fun test(isObject: Boolean) {
foo((isObject))
}
@@ -0,0 +1,12 @@
// "Add parameter to function 'foo'" "true"
// DISABLE-ERRORS
fun foo() {}
fun bar(f: (String) -> Unit) {}
fun test() {
bar {
foo(it<caret>)
}
}
@@ -0,0 +1,12 @@
// "Add parameter to function 'foo'" "true"
// DISABLE-ERRORS
fun foo(s: String) {}
fun bar(f: (String) -> Unit) {}
fun test() {
bar {
foo(it)
}
}
@@ -0,0 +1,11 @@
// "Add parameter to function 'foo'" "true"
// DISABLE-ERRORS
fun foo() {}
class Test {
val x: String = ""
get() {
foo(field<caret>)
return field
}
}
@@ -0,0 +1,11 @@
// "Add parameter to function 'foo'" "true"
// DISABLE-ERRORS
fun foo(s: String) {}
class Test {
val x: String = ""
get() {
foo(field)
return field
}
}