Files
kotlin-fork/compiler/testData/diagnostics/tests/functionLiterals/kt2906.kt
T
Stanislav Erokhin 298a075381 Minor. removed functions which declared in Standard.kt from diagnostic testdata.
Removed declaration for functions: TODO, run, with, apply, let.
2016-01-25 19:13:31 +03:00

23 lines
553 B
Kotlin
Vendored

//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 println(s: String) = s