Files
kotlin-fork/compiler/testData/diagnostics/tests/inference/kt3184.kt
T
Dmitriy Novozhilov 1c0fd7342f [FIR] Support completion of lambdas with type variable as expected type
#KT-37310 Fixed
#KT-37304 Fixed
2020-03-06 18:10:52 +03:00

27 lines
627 B
Kotlin
Vendored

// FIR_IDENTICAL
//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>()
dict["0"] = { str -> println(str) }
dict["1"] = { println(it) }
dict.set("1", { println(it) })
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)