Files
kotlin-fork/compiler/testData/diagnostics/tests/inference/kt3184.fir.kt
T
Mikhail Glukhikh de50f8aef3 FIR resolve: add partial support of extension lambda calls
Here we introduce ONLY_IMPLICIT_RECEIVER tower level
to support extension lambda calls on local variables,
and soften extension receiver checks to make such extensions visible & applicable.
Also here we try to map arguments twice for functional types
2019-12-27 09:57:36 +03:00

26 lines
780 B
Kotlin
Vendored

//KT-3184 Type inference seems partially broken
package a
import java.util.HashMap
private fun <T> test(value: T, extf: String.(value: T)->Unit) {
"".extf(value)
}
fun main() {
test(1, {value -> println(value)})
}
fun tests() {
val dict = HashMap<String, (String) -> Unit>()
<!INAPPLICABLE_CANDIDATE!>dict["0"] = { str -> println(str) }<!>
<!INAPPLICABLE_CANDIDATE!>dict["1"] = { println(<!UNRESOLVED_REFERENCE!>it<!>) }<!>
dict.<!INAPPLICABLE_CANDIDATE!>set<!>("1", { println(<!UNRESOLVED_REFERENCE!>it<!>) })
<!INAPPLICABLE_CANDIDATE!>dict["1"] = { r -> println(r) }<!>
}
// from standard library
operator fun <K, V> MutableMap<K, V>.set(key : K, value : V) : V? = this.put(key, value)
fun println(message : Any?) = System.out.println(message)