Additional item inserting lambda provided by completion when all parameters before the last are optional

This commit is contained in:
Valentin Kipyatkov
2015-08-27 22:38:03 +03:00
parent dfe4f8e34f
commit 2de5229098
15 changed files with 169 additions and 64 deletions
@@ -0,0 +1,25 @@
fun xfoo1(option1: String = "", option2: Int = 1, p: () -> Unit){}
fun xfoo2(option1: String = "", option2: Int = 1, p: (Int) -> Boolean){}
fun xfoo3(option1: String = "", option2: Int = 1, p: (String, Char) -> Unit){}
fun xfooBad1(option: String = "", notOption: Int, p: (String, Char) -> Unit){}
fun xfooBad2(option1: String = "", option2: Int = 1, p: (String, Char) -> Unit, option3: Int = 0){}
fun test(param: () -> Unit) {
xfoo<caret>
}
// EXIST: { itemText: "xfoo1", tailText: "(option1: String = ..., option2: Int = ..., p: () -> Unit) (<root>)", typeText:"Unit" }
// EXIST: { itemText: "xfoo1", tailText: " {...} (p: () -> Unit) (<root>)", typeText:"Unit" }
// EXIST: { itemText: "xfoo2", tailText: "(option1: String = ..., option2: Int = ..., p: (Int) -> Boolean) (<root>)", typeText:"Unit" }
// EXIST: { itemText: "xfoo2", tailText: " {...} (p: (Int) -> Boolean) (<root>)", typeText:"Unit" }
// EXIST: { itemText: "xfoo3", tailText: "(option1: String = ..., option2: Int = ..., p: (String, Char) -> Unit) (<root>)", typeText:"Unit" }
// EXIST: { itemText: "xfoo3", tailText: " { String, Char -> ... } (p: (String, Char) -> Unit) (<root>)", typeText:"Unit" }
// EXIST: { itemText: "xfooBad1", tailText: "(option: String = ..., notOption: Int, p: (String, Char) -> Unit) (<root>)", typeText:"Unit" }
// EXIST: { itemText: "xfooBad2", tailText: "(option1: String = ..., option2: Int = ..., p: (String, Char) -> Unit, option3: Int = ...) (<root>)", typeText:"Unit" }
// NOTHING_ELSE