Files
kotlin-fork/compiler/testData/diagnostics/tests/inference/kt3184.kt
T
Svetlana Isakova 22d3adc89f KT-3184 Type inference seems partially broken
#KT-3184 fixed
2012-12-27 18:45:24 +04:00

26 lines
659 B
Kotlin

//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(args: Array<String>) {
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
fun <K, V> MutableMap<K, V>.set(key : K, value : V) : V<!BASE_WITH_NULLABLE_UPPER_BOUND!>?<!> = this.put(key, value)
fun println(message : Any?) = System.out.println(message)