"Move lambda outside parenthesis" should not be available when not valid

This commit is contained in:
Valentin Kipyatkov
2015-05-22 12:47:18 +03:00
parent 25e323e960
commit 3bca1d1f83
7 changed files with 74 additions and 0 deletions
@@ -0,0 +1,11 @@
// IS_AVAILABLE: true
// ERROR: <html>None of the following functions can be called with the arguments supplied. <ul><li>bar(<font color=red><b>Int = ...</b></font>, <font color=red><b>(Int) &rarr; Int</b></font>) <i>defined in</i> root package</li><li>bar(<font color=red><b>Int</b></font>, <font color=red><b>Int</b></font>, <font color=red><b>(Int) &rarr; Int</b></font>) <i>defined in</i> root package</li></ul></html>
// ERROR: Unresolved reference: it
fun foo() {
bar(<caret>{ it })
}
fun bar(a: Int = 0, f: (Int) -> Int) { }
fun bar(a: Int, b: Int, f: (Int) -> Int) { }
@@ -0,0 +1,11 @@
// IS_AVAILABLE: true
// ERROR: <html>None of the following functions can be called with the arguments supplied. <ul><li>bar(<font color=red><b>Int = ...</b></font>, <font color=red><b>(Int) &rarr; Int</b></font>) <i>defined in</i> root package</li><li>bar(<font color=red><b>Int</b></font>, <font color=red><b>Int</b></font>, <font color=red><b>(Int) &rarr; Int</b></font>) <i>defined in</i> root package</li></ul></html>
// ERROR: Unresolved reference: it
fun foo() {
bar <caret>{ it }
}
fun bar(a: Int = 0, f: (Int) -> Int) { }
fun bar(a: Int, b: Int, f: (Int) -> Int) { }
@@ -0,0 +1,3 @@
fun foo(p: (Int, () -> Int) -> Unit) {
p(1, <caret>{ 2 })
}
@@ -0,0 +1,3 @@
fun foo(p: (Int, () -> Int) -> Unit) {
p(1) <caret>{ 2 }
}
@@ -0,0 +1,6 @@
// IS_APPLICABLE: false
fun foo() {
bar(<caret>{ it })
}
fun bar(b: (Int) -> Int, option: Int = 0) { }