Add ir interpreter tests
This commit is contained in:
committed by
TeamCityServer
parent
cc2d7340dc
commit
e28ab45c51
@@ -0,0 +1,41 @@
|
||||
@file:kotlin.jvm.JvmMultifileClass
|
||||
@file:kotlin.jvm.JvmName("SetsKt")
|
||||
|
||||
package kotlin.collections
|
||||
|
||||
internal object EmptySet : Set<Nothing>, Serializable {
|
||||
private const val serialVersionUID: Long = 3406603774387020532
|
||||
|
||||
override fun equals(other: Any?): Boolean = other is Set<*> && other.isEmpty()
|
||||
override fun hashCode(): Int = 0
|
||||
override fun toString(): String = "[]"
|
||||
|
||||
override val size: Int get() = 0
|
||||
override fun isEmpty(): Boolean = true
|
||||
override fun contains(element: Nothing): Boolean = false
|
||||
override fun containsAll(elements: Collection<Nothing>): Boolean = elements.isEmpty()
|
||||
|
||||
override fun iterator(): Iterator<Nothing> = EmptyIterator
|
||||
|
||||
private fun readResolve(): Any = EmptySet
|
||||
}
|
||||
|
||||
public fun <T> emptySet(): Set<T> = EmptySet
|
||||
|
||||
public fun <T> setOf(vararg elements: T): Set<T> = if (elements.size > 0) elements.toSet() else emptySet()
|
||||
|
||||
public inline fun <T> setOf(): Set<T> = emptySet()
|
||||
|
||||
public inline fun <T> mutableSetOf(): MutableSet<T> = LinkedHashSet()
|
||||
|
||||
public fun <T> mutableSetOf(vararg elements: T): MutableSet<T> = elements.toCollection(LinkedHashSet(mapCapacity(elements.size)))
|
||||
|
||||
public inline fun <T> hashSetOf(): HashSet<T> = kotlin.UnsupportedOperationException("This is intrinsic")
|
||||
|
||||
public fun <T> hashSetOf(vararg elements: T): HashSet<T> = kotlin.UnsupportedOperationException("This is intrinsic")
|
||||
|
||||
internal fun <T> Set<T>.optimizeReadOnlySet() = when (size) {
|
||||
0 -> emptySet()
|
||||
1 -> setOf(iterator().next())
|
||||
else -> this
|
||||
}
|
||||
Reference in New Issue
Block a user