Create Local Variable From Usage: Support lambdas

This commit is contained in:
Alexey Sedunov
2014-10-01 18:38:13 +04:00
parent 6ad2157806
commit 8386bcd4e0
10 changed files with 121 additions and 3 deletions
@@ -0,0 +1,11 @@
// "Create local variable 'foo'" "true"
// ACTION: Create parameter 'foo'
// ERROR: Variable 'foo' must be initialized
fun test(n: Int) {
val f: () -> Int = {
val foo: Int
foo
}
}
@@ -0,0 +1,11 @@
// "Create local variable 'foo'" "true"
// ACTION: Create parameter 'foo'
// ERROR: Variable 'foo' must be initialized
fun test(n: Int) {
val f: (Int, Int) -> Int = { (a, b) ->
val foo: Int
foo
}
}
@@ -0,0 +1,11 @@
// "Create local variable 'foo'" "true"
// ACTION: Create parameter 'foo'
// ERROR: Variable 'foo' must be initialized
fun test(n: Int) {
val f: () -> Int = {
val foo: Int
foo
}
}
@@ -0,0 +1,11 @@
// "Create local variable 'foo'" "true"
// ACTION: Create parameter 'foo'
// ERROR: Variable 'foo' must be initialized
fun test(n: Int) {
val f: (Int, Int) -> Int = { (a, b) ->
val foo: Int
foo
}
}
@@ -0,0 +1,7 @@
// "Create local variable 'foo'" "true"
// ACTION: Create parameter 'foo'
// ERROR: Variable 'foo' must be initialized
fun test(n: Int) {
val f: () -> Int = { <caret>foo }
}
@@ -0,0 +1,7 @@
// "Create local variable 'foo'" "true"
// ACTION: Create parameter 'foo'
// ERROR: Variable 'foo' must be initialized
fun test(n: Int) {
val f: (Int, Int) -> Int = { (a, b) -> <caret>foo }
}
@@ -0,0 +1,9 @@
// "Create local variable 'foo'" "true"
// ACTION: Create parameter 'foo'
// ERROR: Variable 'foo' must be initialized
fun test(n: Int) {
val f: () -> Int = {
<caret>foo
}
}
@@ -0,0 +1,9 @@
// "Create local variable 'foo'" "true"
// ACTION: Create parameter 'foo'
// ERROR: Variable 'foo' must be initialized
fun test(n: Int) {
val f: (Int, Int) -> Int = { (a, b) ->
<caret>foo
}
}