diff --git a/js/js.libraries/src/core/core.kt b/js/js.libraries/src/core/core.kt index c4ab30bda4d..8592866f4c8 100644 --- a/js/js.libraries/src/core/core.kt +++ b/js/js.libraries/src/core/core.kt @@ -8,8 +8,9 @@ import java.lang.*; native public val noImpl : Nothing = throw Exception() +// Drop this after KT-2093 will be fixed and restore MutableMap.set in Maps.kt from MapsJVM.kt /** Provides [] access to maps */ -native public fun MutableMap.set(key: K, value: V): Unit = noImpl +native public fun MutableMap.set(key: K, value: V): V? = noImpl library("println") public fun println() {} @@ -22,4 +23,4 @@ native public fun parseInt(s: String, radix: Int = 10): Int = js.noImpl library public fun safeParseInt(s : String) : Int? = js.noImpl library -public fun safeParseDouble(s : String) : Double? = js.noImpl \ No newline at end of file +public fun safeParseDouble(s : String) : Double? = js.noImpl diff --git a/libraries/stdlib/src/kotlin/collections/Maps.kt b/libraries/stdlib/src/kotlin/collections/Maps.kt index 20494f02727..48540340d2c 100644 --- a/libraries/stdlib/src/kotlin/collections/Maps.kt +++ b/libraries/stdlib/src/kotlin/collections/Maps.kt @@ -12,9 +12,6 @@ public val Map<*, *>.size: Int public val Map<*, *>.empty: Boolean get() = isEmpty() -/** Provides [] access to maps */ -public fun MutableMap.set(key: K, value: V): V? = this.put(key, value) - /** Returns the [[Map]] if its not null otherwise it returns the empty [[Map]] */ public fun Map?.orEmpty() : Map = if (this != null) this else stdlib_emptyMap() diff --git a/libraries/stdlib/src/kotlin/collections/MapsJVM.kt b/libraries/stdlib/src/kotlin/collections/MapsJVM.kt index 1fa2f781125..f4ae05cd51f 100644 --- a/libraries/stdlib/src/kotlin/collections/MapsJVM.kt +++ b/libraries/stdlib/src/kotlin/collections/MapsJVM.kt @@ -8,6 +8,10 @@ import java.util.Properties // Map APIs +// Move back to Maps.kt after KT-2093 will be fixed +/** Provides [] access to maps */ +public fun MutableMap.set(key: K, value: V): V? = this.put(key, value) + /** * Converts this [[Map]] to a [[LinkedHashMap]] so future insertion orders are maintained */