KT-2906 If function parameter/variable is invoked in closure using parenthesis syntax, in IDEA it is not highlighted as captured in closure

#KT-2906 fixed
This commit is contained in:
Svetlana Isakova
2012-10-15 15:02:08 +04:00
parent 3920dea889
commit 7d768847a0
5 changed files with 46 additions and 6 deletions
@@ -0,0 +1,23 @@
//KT-2906 If function parameter/variable is invoked in closure using parenthesis syntax, in IDEA it is not highlighted as captured in closure
package bug
public fun foo1(bar: () -> Unit) {
run {
bar() // ERROR: not highlighted as "captured in closure"
}
}
public fun foo2(bar: () -> Unit) {
run {
bar.invoke() // CORRECT: highlighted as "captured in closure"
}
}
fun main(args: Array<String>) {
foo1 { println ("foo1")} // prints "foo1"
foo2 { println ("foo2")} // prints "foo2"
}
fun <T> run(f: () -> T) : T = f()
fun println(s: String) = s