fun valuesNotNull(map: MutableMap) { map.merge(1, "x") { old, new -> old + new } // SUCCESS // ORIGINAL: fun merge(K, V & Any, BiFunction): V? defined in kotlin.collections.MutableMap // SUBSTITUTED: fun merge(Int, String, BiFunction): String? defined in kotlin.collections.MutableMap } fun valuesNullable(map: MutableMap) { map.merge(1, "x") { old, new -> old + new } // SUCCESS // ORIGINAL: fun merge(K, V & Any, BiFunction): V? defined in kotlin.collections.MutableMap // SUBSTITUTED: fun merge(Int, String, BiFunction): String? defined in kotlin.collections.MutableMap map.merge(1, null) { old, new -> old + new } // UNSAFE_CALL_ERROR // ORIGINAL: fun merge(K, V & Any, BiFunction): V? defined in kotlin.collections.MutableMap // SUBSTITUTED: fun merge(Int, String, BiFunction): String? defined in kotlin.collections.MutableMap } fun valuesT(map: MutableMap, newValue: T) { map.merge(1, newValue) { old, new -> null } // OTHER_ERROR // ORIGINAL: fun merge(K, V & Any, BiFunction): V? defined in kotlin.collections.MutableMap // SUBSTITUTED: fun merge(Int, T & Any, BiFunction): T? defined in kotlin.collections.MutableMap } fun valuesTNotNull(map: MutableMap, newValue: T) { map.merge(1, newValue) { old, new -> null } // SUCCESS // ORIGINAL: fun merge(K, V & Any, BiFunction): V? defined in kotlin.collections.MutableMap // SUBSTITUTED: fun merge(Int, T, BiFunction): T? defined in kotlin.collections.MutableMap } fun valuesTNullable(map: MutableMap, newValue: T?) { map.merge(1, newValue) { old, new -> new } // UNSAFE_CALL_ERROR // ORIGINAL: fun merge(K, V & Any, BiFunction): V? defined in kotlin.collections.MutableMap // SUBSTITUTED: fun merge(Int, T & Any, BiFunction): T? defined in kotlin.collections.MutableMap map.merge(1, newValue!!) { old, new -> new } // SUCCESS // ORIGINAL: fun merge(K, V & Any, BiFunction): V? defined in kotlin.collections.MutableMap // SUBSTITUTED: fun merge(Int, T & Any, BiFunction): T? defined in kotlin.collections.MutableMap }