Files
kotlin-fork/compiler/testData/resolvedCalls/enhancedSignatures/map/mapComputeIfAbsent.txt
T
Mikhail Zarechenskiy c2fc633ad6 [NI-MIGRATE] Update test about signature enhancements
It's required as now there are no synthetic candidates
2020-02-13 11:15:59 +03:00

35 lines
1.8 KiB
Plaintext
Vendored

fun valuesNotNull(map: MutableMap<Int, String>) {
map.computeIfAbsent(1) { k -> "new value" }
// SUCCESS
// ORIGINAL: fun computeIfAbsent(K, Function<in K, out V>): V defined in kotlin.collections.MutableMap
// SUBSTITUTED: fun computeIfAbsent(Int, Function<in Int, out String>): String defined in kotlin.collections.MutableMap
}
fun valuesNullable(map: MutableMap<Int, String?>) {
map.computeIfAbsent(1) { k -> null }
// SUCCESS
// ORIGINAL: fun computeIfAbsent(K, Function<in K, out V>): V defined in kotlin.collections.MutableMap
// SUBSTITUTED: fun computeIfAbsent(Int, Function<in Int, out String?>): String? defined in kotlin.collections.MutableMap
}
fun <T> valuesT(map: MutableMap<Int, T>, newValue: T) {
map.computeIfAbsent(1) { k -> newValue }
// SUCCESS
// ORIGINAL: fun computeIfAbsent(K, Function<in K, out V>): V defined in kotlin.collections.MutableMap
// SUBSTITUTED: fun computeIfAbsent(Int, Function<in Int, out T>): T defined in kotlin.collections.MutableMap
}
fun <T : Any> valuesTNotNull(map: MutableMap<Int, T>, newValue: T) {
map.computeIfAbsent(1) { k -> newValue }
// SUCCESS
// ORIGINAL: fun computeIfAbsent(K, Function<in K, out V>): V defined in kotlin.collections.MutableMap
// SUBSTITUTED: fun computeIfAbsent(Int, Function<in Int, out T>): T defined in kotlin.collections.MutableMap
}
fun <T : Any> valuesTNullable(map: MutableMap<Int, T?>, newValue: T?) {
map.computeIfAbsent(1) { k -> newValue }
// SUCCESS
// ORIGINAL: fun computeIfAbsent(K, Function<in K, out V>): V defined in kotlin.collections.MutableMap
// SUBSTITUTED: fun computeIfAbsent(Int, Function<in Int, out T?>): T? defined in kotlin.collections.MutableMap
}