JS: Remove declarations of unsupported SortedSet and TreeSet, make toSortedSet() jvm-only.

Fix completion test.

Relates to #KT-7480
This commit is contained in:
Ilya Gorbunov
2016-02-27 00:24:26 +03:00
parent eb7cf92fbd
commit e5dbb65ff7
7 changed files with 13 additions and 10 deletions
@@ -6,6 +6,5 @@ fun hello() {
val a = So<caret>
}
// EXIST: SortedSet
// EXIST_JAVA_ONLY: SortedMap
// EXIST_JS_ONLY: JSON
-9
View File
@@ -91,15 +91,6 @@ public open class HashSet<E>(
override val size: Int get() = noImpl
}
@library
public interface SortedSet<E> : Set<E> {
}
@library
public open class TreeSet<E>() : AbstractCollection<E>(), MutableSet<E>, SortedSet<E> {
override val size: Int get() = noImpl
}
@library
public open class LinkedHashSet<E>(
initialCapacity: Int = DEFAULT_INITIAL_CAPACITY, loadFactor: Float = DEFAULT_LOAD_FACTOR
@@ -6512,6 +6512,7 @@ public fun CharArray.toSet(): Set<Char> {
/**
* Returns a [SortedSet] of all elements.
*/
@kotlin.jvm.JvmVersion
public fun <T: Comparable<T>> Array<out T>.toSortedSet(): SortedSet<T> {
return toCollection(TreeSet<T>())
}
@@ -6519,6 +6520,7 @@ public fun <T: Comparable<T>> Array<out T>.toSortedSet(): SortedSet<T> {
/**
* Returns a [SortedSet] of all elements.
*/
@kotlin.jvm.JvmVersion
public fun ByteArray.toSortedSet(): SortedSet<Byte> {
return toCollection(TreeSet<Byte>())
}
@@ -6526,6 +6528,7 @@ public fun ByteArray.toSortedSet(): SortedSet<Byte> {
/**
* Returns a [SortedSet] of all elements.
*/
@kotlin.jvm.JvmVersion
public fun ShortArray.toSortedSet(): SortedSet<Short> {
return toCollection(TreeSet<Short>())
}
@@ -6533,6 +6536,7 @@ public fun ShortArray.toSortedSet(): SortedSet<Short> {
/**
* Returns a [SortedSet] of all elements.
*/
@kotlin.jvm.JvmVersion
public fun IntArray.toSortedSet(): SortedSet<Int> {
return toCollection(TreeSet<Int>())
}
@@ -6540,6 +6544,7 @@ public fun IntArray.toSortedSet(): SortedSet<Int> {
/**
* Returns a [SortedSet] of all elements.
*/
@kotlin.jvm.JvmVersion
public fun LongArray.toSortedSet(): SortedSet<Long> {
return toCollection(TreeSet<Long>())
}
@@ -6547,6 +6552,7 @@ public fun LongArray.toSortedSet(): SortedSet<Long> {
/**
* Returns a [SortedSet] of all elements.
*/
@kotlin.jvm.JvmVersion
public fun FloatArray.toSortedSet(): SortedSet<Float> {
return toCollection(TreeSet<Float>())
}
@@ -6554,6 +6560,7 @@ public fun FloatArray.toSortedSet(): SortedSet<Float> {
/**
* Returns a [SortedSet] of all elements.
*/
@kotlin.jvm.JvmVersion
public fun DoubleArray.toSortedSet(): SortedSet<Double> {
return toCollection(TreeSet<Double>())
}
@@ -6561,6 +6568,7 @@ public fun DoubleArray.toSortedSet(): SortedSet<Double> {
/**
* Returns a [SortedSet] of all elements.
*/
@kotlin.jvm.JvmVersion
public fun BooleanArray.toSortedSet(): SortedSet<Boolean> {
return toCollection(TreeSet<Boolean>())
}
@@ -6568,6 +6576,7 @@ public fun BooleanArray.toSortedSet(): SortedSet<Boolean> {
/**
* Returns a [SortedSet] of all elements.
*/
@kotlin.jvm.JvmVersion
public fun CharArray.toSortedSet(): SortedSet<Char> {
return toCollection(TreeSet<Char>())
}
@@ -1032,6 +1032,7 @@ public fun <T> Iterable<T>.toSet(): Set<T> {
/**
* Returns a [SortedSet] of all elements.
*/
@kotlin.jvm.JvmVersion
public fun <T: Comparable<T>> Iterable<T>.toSortedSet(): SortedSet<T> {
return toCollection(TreeSet<T>())
}
@@ -542,6 +542,7 @@ public fun <T> Sequence<T>.toSet(): Set<T> {
/**
* Returns a [SortedSet] of all elements.
*/
@kotlin.jvm.JvmVersion
public fun <T: Comparable<T>> Sequence<T>.toSortedSet(): SortedSet<T> {
return toCollection(TreeSet<T>())
}
@@ -610,6 +610,7 @@ public fun CharSequence.toSet(): Set<Char> {
/**
* Returns a [SortedSet] of all characters.
*/
@kotlin.jvm.JvmVersion
public fun CharSequence.toSortedSet(): SortedSet<Char> {
return toCollection(TreeSet<Char>())
}
@@ -40,6 +40,7 @@ fun snapshots(): List<GenericFunction> {
templates add f("toSortedSet()") {
include(CharSequences)
jvmOnly(true)
typeParam("T: Comparable<T>")
doc { f -> "Returns a [SortedSet] of all ${f.element.pluralize()}." }
returns("SortedSet<T>")