KT-15363 Fix failing test: missing capacity parameter check in JS

Partially restore JVM map capacity implementation
This commit is contained in:
Ilya Gorbunov
2020-01-21 04:57:02 +03:00
parent 4aa7d45a5a
commit 14351446d7
6 changed files with 44 additions and 12 deletions
+12 -2
View File
@@ -187,5 +187,15 @@ internal actual fun checkCountOverflow(count: Int): Int {
* JS map and set implementations do not make use of capacities or load factors.
*/
@PublishedApi
@kotlin.internal.InlineOnly
internal actual inline fun mapCapacity(expectedSize: Int) = expectedSize
internal actual fun mapCapacity(expectedSize: Int) = expectedSize
/**
* Checks a collection builder function capacity argument.
* In JS no validation is made in Map/Set constructor yet.
*/
@SinceKotlin("1.3")
@ExperimentalStdlibApi
@PublishedApi
internal actual fun checkBuilderCapacity(capacity: Int) {
require(capacity >= 0) { "capacity must be non-negative." }
}