Files
kotlin-fork/compiler/testData/diagnostics/tests/AutoCreatedIt.fir.kt
T
Jinseong Jeon 27c942a0ff FIR: enforce the return type of function literals without body
Its return type should be Unit, so do not use the expected type from,
e.g., parameter type.
2021-02-19 10:17:16 +03:00

34 lines
725 B
Kotlin
Vendored

// !WITH_NEW_INFERENCE
fun text() {
"direct:a" to "mock:a"
"direct:a" on {it.body == "<hello/>"} to "mock:a"
"direct:a" on {it -> it.body == "<hello/>"} to "mock:a"
bar {1}
bar {<!UNRESOLVED_REFERENCE!>it<!> + 1}
bar {it, it1 -> it}
bar1 {1}
bar1 {it + 1}
<!INAPPLICABLE_CANDIDATE!>bar2<!> {}
bar2 {1}
bar2 {<!UNRESOLVED_REFERENCE!>it<!>}
<!INAPPLICABLE_CANDIDATE!>bar2<!> {it -> it}
}
fun bar(f : (Int, Int) -> Int) {}
fun bar1(f : (Int) -> Int) {}
fun bar2(f : () -> Int) {}
infix fun String.to(dest : String) {
}
infix fun String.on(predicate : (s : URI) -> Boolean) : URI {
return URI(this)
}
class URI(val body : Any) {
infix fun to(dest : String) {}
}