Quick-fix "use spread operator": make working with mapOf #KT-14556 Fixed

This commit is contained in:
Toshiaki Kameyama
2018-04-10 07:53:24 +03:00
committed by Mikhail Glukhikh
parent a7110a1517
commit 5204c73bec
5 changed files with 30 additions and 22 deletions
@@ -1,11 +0,0 @@
// "Change 'pairs' to '*pairs'" "false"
// WITH_RUNTIME
// ACTION: Create function 'mapOf'
// ERROR: Type inference failed: fun <K, V> mapOf(pair: Pair<K, V>): Map<K, V><br>cannot be applied to<br>(Array<out Pair<String, String>>)<br>
// ERROR: Type mismatch: inferred type is Array<out Pair<String, String>> but Pair<???, ???> was expected
fun myMapOf(vararg pairs: Pair<String,String>) {
// Does not work due to KT-15593
val myMap = mapOf(<caret>pairs)
}
@@ -0,0 +1,6 @@
// "Change 'pairs' to '*pairs'" "true"
// WITH_RUNTIME
fun myMapOf(vararg pairs: Pair<String,String>) {
val myMap = mapOf(<caret>pairs)
}
@@ -0,0 +1,6 @@
// "Change 'pairs' to '*pairs'" "true"
// WITH_RUNTIME
fun myMapOf(vararg pairs: Pair<String,String>) {
val myMap = mapOf(*pairs)
}