Intentions: Implement "Add names to call arguments" intention

#KT-14729 Fixed
This commit is contained in:
Alexey Sedunov
2016-11-28 15:17:43 +03:00
parent 890578a6a0
commit c773afdbfa
25 changed files with 262 additions and 1 deletions
@@ -0,0 +1 @@
org.jetbrains.kotlin.idea.intentions.AddNamesToCallArgumentsIntention
@@ -0,0 +1,6 @@
// IS_APPLICABLE: false
fun foo(s: String, b: Boolean){}
fun bar() {
<caret>foo(s = "", b = true)
}
@@ -0,0 +1,8 @@
// IS_APPLICABLE: false
// ERROR: None of the following functions can be called with the arguments supplied: <br>public fun foo(s: String, b: Boolean, c: Char): Unit defined in root package<br>public fun foo(s: String, b: Boolean, p: Int): Unit defined in root package
fun foo(s: String, b: Boolean, p: Int){}
fun foo(s: String, b: Boolean, c: Char){}
fun bar() {
<caret>foo("", true)
}
@@ -0,0 +1,7 @@
// ERROR: No value passed for parameter p
fun foo(s: String, b: Boolean, p: Int){}
fun bar() {
<caret>foo("", true)
}
@@ -0,0 +1,7 @@
// ERROR: No value passed for parameter p
fun foo(s: String, b: Boolean, p: Int){}
fun bar() {
<caret>foo(s = "", b = true)
}
@@ -0,0 +1,6 @@
// IS_APPLICABLE: false
// WITH_RUNTIME
fun f() {
java.io.File(<caret>"file")
}
@@ -0,0 +1,6 @@
// IS_APPLICABLE: false
fun foo(s: String){}
fun bar() {
foo(<caret>"")
}
@@ -0,0 +1,5 @@
// IS_APPLICABLE: false
// ERROR: Unresolved reference: foo
fun bar() {
<caret>foo("", true)
}
@@ -0,0 +1,5 @@
fun foo(s: String, b: Boolean){}
fun bar() {
<caret>foo("", true)
}
@@ -0,0 +1,5 @@
fun foo(s: String, b: Boolean){}
fun bar() {
<caret>foo(s = "", b = true)
}
@@ -0,0 +1,3 @@
open class C(p1: Int, p2: Int)
class D : <caret>C(1, 2)
@@ -0,0 +1,3 @@
open class C(p1: Int, p2: Int)
class D : <caret>C(p1 = 1, p2 = 2)
@@ -0,0 +1,6 @@
// IS_APPLICABLE: false
fun foo(n: Int, vararg s: String){}
fun bar() {
<caret>foo(1, "2", "3")
}
@@ -0,0 +1,5 @@
fun foo(n: Int, vararg s: String){}
fun bar() {
<caret>foo(1, "")
}
@@ -0,0 +1,5 @@
fun foo(n: Int, vararg s: String){}
fun bar() {
<caret>foo(n = 1, s = "")
}
@@ -0,0 +1,5 @@
fun foo(n: Int, vararg s: String){}
fun bar(array: Array<String>) {
<caret>foo(1, *array)
}
@@ -0,0 +1,5 @@
fun foo(n: Int, vararg s: String){}
fun bar(array: Array<String>) {
<caret>foo(n = 1, s = *array)
}