diff --git a/libraries/stdlib/src/generated/_Arrays.kt b/libraries/stdlib/src/generated/_Arrays.kt index 025bc7d3153..475e0d436be 100644 --- a/libraries/stdlib/src/generated/_Arrays.kt +++ b/libraries/stdlib/src/generated/_Arrays.kt @@ -436,26 +436,6 @@ public operator fun ShortArray.contains(element: Short): Boolean { return indexOf(element) >= 0 } -/** - * Returns `true` if [element] is found in the collection. - */ -@Deprecated("Array and element have incompatible types. Upcast element to Any? if you're sure.", ReplaceWith("contains(element as T)")) -@kotlin.jvm.JvmName("containsAny") -@kotlin.internal.LowPriorityInOverloadResolution -public operator fun Array.contains(element: T): Boolean { - return contains(element as T) -} - -/** - * Returns `true` if [element] is found in the array. - * Allows to overcome type-safety restriction of `contains` that requires to pass an element of type `T`. - */ -@Deprecated("Array and element have incompatible types. Upcast element to Any? if you're sure.", ReplaceWith("contains(element as Any?)")) -@Suppress("NOTHING_TO_INLINE") -public inline fun Array.containsRaw(element: Any?): Boolean { - return contains(element as Any?) -} - /** * Returns an element at the given [index] or throws an [IndexOutOfBoundsException] if the [index] is out of bounds of this array. */ @@ -1319,17 +1299,6 @@ public fun ShortArray.indexOf(element: Short): Int { return -1 } -/** - * Returns first index of [element], or -1 if the collection does not contain element. - */ -@Deprecated("Array and element have incompatible types. Upcast element to Any? if you're sure.", ReplaceWith("indexOf(element as T)")) -@kotlin.jvm.JvmName("indexOfAny") -@kotlin.internal.LowPriorityInOverloadResolution -@Suppress("NOTHING_TO_INLINE") -public fun Array.indexOf(element: T): Int { - return indexOf(element as T) -} - /** * Returns index of the first element matching the given [predicate], or -1 if the array does not contain such element. */ @@ -1546,16 +1515,6 @@ public inline fun ShortArray.indexOfLast(predicate: (Short) -> Boolean): Int { return -1 } -/** - * Returns first index of [element], or -1 if the array does not contain element. - * Allows to overcome type-safety restriction of `indexOf` that requires to pass an element of type `T`. - */ -@Deprecated("Array and element have incompatible types. Upcast element to Any? if you're sure.", ReplaceWith("indexOf(element as Any?)")) -@Suppress("NOTHING_TO_INLINE") -public inline fun Array.indexOfRaw(element: Any?): Int { - return indexOf(element as Any?) -} - /** * Returns the last element. * @throws [NoSuchElementException] if the array is empty. @@ -1870,27 +1829,6 @@ public fun ShortArray.lastIndexOf(element: Short): Int { return -1 } -/** - * Returns last index of [element], or -1 if the collection does not contain element. - */ -@Deprecated("Array and element have incompatible types. Upcast element to Any? if you're sure.", ReplaceWith("lastIndexOf(element as T)")) -@kotlin.jvm.JvmName("lastIndexOfAny") -@kotlin.internal.LowPriorityInOverloadResolution -@Suppress("NOTHING_TO_INLINE") -public fun Array.lastIndexOf(element: T): Int { - return lastIndexOf(element as T) -} - -/** - * Returns last index of [element], or -1 if the array does not contain element. - * Allows to overcome type-safety restriction of `lastIndexOf` that requires to pass an element of type `T`. - */ -@Deprecated("Array and element have incompatible types. Upcast element to Any? if you're sure.", ReplaceWith("lastIndexOf(element as Any?)")) -@Suppress("NOTHING_TO_INLINE") -public inline fun Array.lastIndexOfRaw(element: Any?): Int { - return lastIndexOf(element as Any?) -} - /** * Returns the last element, or `null` if the array is empty. */ diff --git a/libraries/stdlib/src/generated/_Collections.kt b/libraries/stdlib/src/generated/_Collections.kt index 352c867e91b..9b7c3ed7128 100644 --- a/libraries/stdlib/src/generated/_Collections.kt +++ b/libraries/stdlib/src/generated/_Collections.kt @@ -62,26 +62,6 @@ public operator fun <@kotlin.internal.OnlyInputTypes T> Iterable.contains(ele return indexOf(element) >= 0 } -/** - * Returns `true` if [element] is found in the collection. - */ -@Deprecated("Collection and element have incompatible types. Upcast element to Any? if you're sure.", ReplaceWith("contains(element as T)")) -@kotlin.jvm.JvmName("containsAny") -@kotlin.internal.LowPriorityInOverloadResolution -public operator fun Iterable.contains(element: T): Boolean { - return contains(element as T) -} - -/** - * Returns `true` if [element] is found in the collection. - * Allows to overcome type-safety restriction of `contains` that requires to pass an element of type `T`. - */ -@Deprecated("Collection and element have incompatible types. Upcast element to Any? if you're sure.", ReplaceWith("contains(element as Any?)")) -@Suppress("NOTHING_TO_INLINE") -public inline fun Iterable<*>.containsRaw(element: Any?): Boolean { - return contains(element as Any?) -} - /** * Returns an element at the given [index] or throws an [IndexOutOfBoundsException] if the [index] is out of bounds of this collection. */ @@ -279,28 +259,6 @@ public fun <@kotlin.internal.OnlyInputTypes T> List.indexOf(element: T): Int return indexOf(element) } -/** - * Returns first index of [element], or -1 if the collection does not contain element. - */ -@Deprecated("Collection and element have incompatible types. Upcast element to Any? if you're sure.", ReplaceWith("indexOf(element as T)")) -@kotlin.jvm.JvmName("indexOfAny") -@kotlin.internal.LowPriorityInOverloadResolution -@Suppress("NOTHING_TO_INLINE") -public fun Iterable.indexOf(element: T): Int { - return indexOf(element as T) -} - -/** - * Returns first index of [element], or -1 if the collection does not contain element. - */ -@Deprecated("List and element have incompatible types. Upcast element to Any? if you're sure.", ReplaceWith("indexOf(element as T)")) -@kotlin.jvm.JvmName("indexOfAny") -@kotlin.internal.LowPriorityInOverloadResolution -@Suppress("NOTHING_TO_INLINE") -public fun List.indexOf(element: T): Int { - return indexOf(element as T) -} - /** * Returns index of the first element matching the given [predicate], or -1 if the collection does not contain such element. */ @@ -352,26 +310,6 @@ public inline fun List.indexOfLast(predicate: (T) -> Boolean): Int { return -1 } -/** - * Returns first index of [element], or -1 if the collection does not contain element. - * Allows to overcome type-safety restriction of `indexOf` that requires to pass an element of type `T`. - */ -@Deprecated("Collection and element have incompatible types. Upcast element to Any? if you're sure.", ReplaceWith("indexOf(element as Any?)")) -@Suppress("NOTHING_TO_INLINE") -public inline fun Iterable<*>.indexOfRaw(element: Any?): Int { - return indexOf(element as Any?) -} - -/** - * Returns first index of [element], or -1 if the list does not contain element. - * Allows to overcome type-safety restriction of `indexOf` that requires to pass an element of type `T`. - */ -@Deprecated("List and element have incompatible types. Upcast element to Any? if you're sure.", ReplaceWith("indexOf(element as Any?)")) -@Suppress("NOTHING_TO_INLINE") -public inline fun List.indexOfRaw(element: Any?): Int { - return (this as List).indexOf(element) -} - /** * Returns the last element. * @throws [NoSuchElementException] if the collection is empty. @@ -459,48 +397,6 @@ public fun <@kotlin.internal.OnlyInputTypes T> List.lastIndexOf(element: T): return lastIndexOf(element) } -/** - * Returns last index of [element], or -1 if the collection does not contain element. - */ -@Deprecated("Collection and element have incompatible types. Upcast element to Any? if you're sure.", ReplaceWith("lastIndexOf(element as T)")) -@kotlin.jvm.JvmName("lastIndexOfAny") -@kotlin.internal.LowPriorityInOverloadResolution -@Suppress("NOTHING_TO_INLINE") -public fun Iterable.lastIndexOf(element: T): Int { - return lastIndexOf(element as T) -} - -/** - * Returns last index of [element], or -1 if the collection does not contain element. - */ -@Deprecated("List and element have incompatible types. Upcast element to Any? if you're sure.", ReplaceWith("lastIndexOf(element as T)")) -@kotlin.jvm.JvmName("lastIndexOfAny") -@kotlin.internal.LowPriorityInOverloadResolution -@Suppress("NOTHING_TO_INLINE") -public fun List.lastIndexOf(element: T): Int { - return lastIndexOf(element as T) -} - -/** - * Returns last index of [element], or -1 if the collection does not contain element. - * Allows to overcome type-safety restriction of `lastIndexOf` that requires to pass an element of type `T`. - */ -@Deprecated("Collection and element have incompatible types. Upcast element to Any? if you're sure.", ReplaceWith("lastIndexOf(element as Any?)")) -@Suppress("NOTHING_TO_INLINE") -public inline fun Iterable<*>.lastIndexOfRaw(element: Any?): Int { - return lastIndexOf(element as Any?) -} - -/** - * Returns last index of [element], or -1 if the list does not contain element. - * Allows to overcome type-safety restriction of `lastIndexOf` that requires to pass an element of type `T`. - */ -@Deprecated("List and element have incompatible types. Upcast element to Any? if you're sure.", ReplaceWith("lastIndexOf(element as Any?)")) -@Suppress("NOTHING_TO_INLINE") -public inline fun List.lastIndexOfRaw(element: Any?): Int { - return (this as List).lastIndexOf(element) -} - /** * Returns the last element, or `null` if the collection is empty. */ diff --git a/libraries/stdlib/src/generated/_Sequences.kt b/libraries/stdlib/src/generated/_Sequences.kt index 5c3b6ebc523..038c871c1c6 100644 --- a/libraries/stdlib/src/generated/_Sequences.kt +++ b/libraries/stdlib/src/generated/_Sequences.kt @@ -20,26 +20,6 @@ public operator fun <@kotlin.internal.OnlyInputTypes T> Sequence.contains(ele return indexOf(element) >= 0 } -/** - * Returns `true` if [element] is found in the collection. - */ -@Deprecated("Sequence and element have incompatible types. Upcast element to Any? if you're sure.", ReplaceWith("contains(element as T)")) -@kotlin.jvm.JvmName("containsAny") -@kotlin.internal.LowPriorityInOverloadResolution -public operator fun Sequence.contains(element: T): Boolean { - return contains(element as T) -} - -/** - * Returns `true` if [element] is found in the sequence. - * Allows to overcome type-safety restriction of `contains` that requires to pass an element of type `T`. - */ -@Deprecated("Sequence and element have incompatible types. Upcast element to Any? if you're sure.", ReplaceWith("contains(element as Any?)")) -@Suppress("NOTHING_TO_INLINE") -public inline fun Sequence<*>.containsRaw(element: Any?): Boolean { - return contains(element as Any?) -} - /** * Returns an element at the given [index] or throws an [IndexOutOfBoundsException] if the [index] is out of bounds of this sequence. */ @@ -144,17 +124,6 @@ public fun <@kotlin.internal.OnlyInputTypes T> Sequence.indexOf(element: T): return -1 } -/** - * Returns first index of [element], or -1 if the collection does not contain element. - */ -@Deprecated("Sequence and element have incompatible types. Upcast element to Any? if you're sure.", ReplaceWith("indexOf(element as T)")) -@kotlin.jvm.JvmName("indexOfAny") -@kotlin.internal.LowPriorityInOverloadResolution -@Suppress("NOTHING_TO_INLINE") -public fun Sequence.indexOf(element: T): Int { - return indexOf(element as T) -} - /** * Returns index of the first element matching the given [predicate], or -1 if the sequence does not contain such element. */ @@ -182,16 +151,6 @@ public inline fun Sequence.indexOfLast(predicate: (T) -> Boolean): Int { return lastIndex } -/** - * Returns first index of [element], or -1 if the sequence does not contain element. - * Allows to overcome type-safety restriction of `indexOf` that requires to pass an element of type `T`. - */ -@Deprecated("Sequence and element have incompatible types. Upcast element to Any? if you're sure.", ReplaceWith("indexOf(element as Any?)")) -@Suppress("NOTHING_TO_INLINE") -public inline fun Sequence<*>.indexOfRaw(element: Any?): Int { - return indexOf(element as Any?) -} - /** * Returns the last element. * @throws [NoSuchElementException] if the sequence is empty. @@ -237,27 +196,6 @@ public fun <@kotlin.internal.OnlyInputTypes T> Sequence.lastIndexOf(element: return lastIndex } -/** - * Returns last index of [element], or -1 if the collection does not contain element. - */ -@Deprecated("Sequence and element have incompatible types. Upcast element to Any? if you're sure.", ReplaceWith("lastIndexOf(element as T)")) -@kotlin.jvm.JvmName("lastIndexOfAny") -@kotlin.internal.LowPriorityInOverloadResolution -@Suppress("NOTHING_TO_INLINE") -public fun Sequence.lastIndexOf(element: T): Int { - return lastIndexOf(element as T) -} - -/** - * Returns last index of [element], or -1 if the sequence does not contain element. - * Allows to overcome type-safety restriction of `lastIndexOf` that requires to pass an element of type `T`. - */ -@Deprecated("Sequence and element have incompatible types. Upcast element to Any? if you're sure.", ReplaceWith("lastIndexOf(element as Any?)")) -@Suppress("NOTHING_TO_INLINE") -public inline fun Sequence<*>.lastIndexOfRaw(element: Any?): Int { - return lastIndexOf(element as Any?) -} - /** * Returns the last element, or `null` if the sequence is empty. */ diff --git a/libraries/stdlib/src/kotlin/collections/Maps.kt b/libraries/stdlib/src/kotlin/collections/Maps.kt index 1dbfc7eef8c..530c873489d 100644 --- a/libraries/stdlib/src/kotlin/collections/Maps.kt +++ b/libraries/stdlib/src/kotlin/collections/Maps.kt @@ -111,15 +111,6 @@ public operator fun <@kotlin.internal.OnlyInputTypes K, V> Map.contain */ public operator fun <@kotlin.internal.OnlyInputTypes K, V> Map.get(key: K): V? = (this as Map).get(key) -/** - * Returns the value corresponding to the given [key], or `null` if such a key is not present in the map. - * - * Allows to overcome type-safety restriction of `get` that requires to pass a key of type `K`. - */ -@Suppress("NOTHING_TO_INLINE") -@Deprecated("Map and key have incompatible types. Upcast key to Any? if you're sure.", ReplaceWith("get(key as Any?)")) -public inline fun Map.getRaw(key: Any?): V? = get(key) - /** * Returns `true` if the map contains the specified [key]. * @@ -127,10 +118,6 @@ public inline fun Map.getRaw(key: Any?): V? = get(key) */ public fun <@kotlin.internal.OnlyInputTypes K> Map.containsKey(key: K): Boolean = (this as Map).containsKey(key) -@Suppress("NOTHING_TO_INLINE") -@Deprecated("Map and key have incompatible types. Upcast key to Any? if you're sure.", ReplaceWith("containsKey(key as Any?)")) -public inline fun Map.containsKeyRaw(key: Any?): Boolean = containsKey(key) - /** * Returns `true` if the map maps one or more keys to the specified [value]. * @@ -138,10 +125,6 @@ public inline fun Map.containsKeyRaw(key: Any?): Boolean = containsKey */ public fun Map.containsValue(value: V): Boolean = this.containsValue(value) -@Suppress("NOTHING_TO_INLINE") -@Deprecated("Map and value have incompatible types. Upcast value to Any? if you're sure.", ReplaceWith("containsValue(value as Any?)")) -public inline fun Map.containsValueRaw(value: Any?): Boolean = containsValue(value) - /** * Removes the specified key and its corresponding value from this map. @@ -269,15 +252,6 @@ public inline fun > Map.mapKeysTo(destinatio return destination } -/** - * Puts all the given [pairs] into this [MutableMap] with the first component in the pair being the key and the second the value. - */ -@kotlin.jvm.JvmName("putAllVararg") -@Deprecated("Use an overload without vararg", ReplaceWith("putAll(pairs)")) -public fun MutableMap.putAll(vararg pairs: Pair): Unit { - putAll(pairs) -} - /** * Puts all the given [pairs] into this [MutableMap] with the first component in the pair being the key and the second the value. */ diff --git a/libraries/stdlib/src/kotlin/collections/MutableCollections.kt b/libraries/stdlib/src/kotlin/collections/MutableCollections.kt index 227f6d2cbeb..8817e80fc21 100644 --- a/libraries/stdlib/src/kotlin/collections/MutableCollections.kt +++ b/libraries/stdlib/src/kotlin/collections/MutableCollections.kt @@ -12,15 +12,6 @@ import java.util.* */ public fun <@kotlin.internal.OnlyInputTypes T> Collection.containsAll(elements: Collection): Boolean = this.containsAll(elements) -@Suppress("NOTHING_TO_INLINE") -@Deprecated("Collections have incompatible types. Upcast either to Collection if you're sure.", ReplaceWith("containsAll(elements)")) -public inline fun Collection<*>.containsAllRaw(elements: Collection): Boolean = containsAll(elements) - -@Deprecated("Collections have incompatible types. Upcast either to Collection if you're sure.", ReplaceWith("containsAll(elements)")) -@kotlin.jvm.JvmName("containsAllOfAny") -@kotlin.internal.LowPriorityInOverloadResolution -public fun Collection.containsAll(elements: Collection): Boolean = containsAll(elements) - /** * Removes a single instance of the specified element from this * collection, if it is present. @@ -31,15 +22,6 @@ public fun Collection.containsAll(elements: Collection): Boolean = */ public fun <@kotlin.internal.OnlyInputTypes T> MutableCollection.remove(element: T): Boolean = (this as MutableCollection).remove(element) -@Suppress("NOTHING_TO_INLINE") -@Deprecated("Collection and element have incompatible types. Upcast element to Any? if you're sure.", ReplaceWith("remove(element as Any?)")) -public inline fun MutableCollection.removeRaw(element: Any?): Boolean = remove(element) - -@Deprecated("Collection and element have incompatible types. Upcast element to Any? if you're sure.", ReplaceWith("remove(element as T)")) -@kotlin.jvm.JvmName("removeAny") -@kotlin.internal.LowPriorityInOverloadResolution -public fun MutableCollection.remove(element: T): Boolean = remove(element) - /** * Removes all of this collection's elements that are also contained in the specified collection. @@ -49,15 +31,6 @@ public fun MutableCollection.remove(element: T): Boolean = remove(ele */ public fun <@kotlin.internal.OnlyInputTypes T> MutableCollection.removeAll(elements: Collection): Boolean = (this as MutableCollection).removeAll(elements) -@Suppress("NOTHING_TO_INLINE") -@Deprecated("Collections have incompatible types. Upcast elements to Collection if you're sure.", ReplaceWith("removeAll(elements)")) -public inline fun MutableCollection.removeAllRaw(elements: Collection): Boolean = removeAll(elements) - -@Deprecated("Collections have incompatible types. Upcast elements to Collection if you're sure.", ReplaceWith("removeAll(elements)")) -@kotlin.jvm.JvmName("removeAllOfAny") -@kotlin.internal.LowPriorityInOverloadResolution -public fun MutableCollection.removeAll(elements: Collection): Boolean = removeAll(elements) - /** * Retains only the elements in this collection that are contained in the specified collection. * @@ -67,15 +40,6 @@ public fun MutableCollection.removeAll(elements: Collection): Boole */ public fun <@kotlin.internal.OnlyInputTypes T> MutableCollection.retainAll(elements: Collection): Boolean = (this as MutableCollection).retainAll(elements) -@Suppress("NOTHING_TO_INLINE") -@Deprecated("Collections have incompatible types. Upcast elements to Collection if you're sure.", ReplaceWith("retainAll(elements)")) -public inline fun MutableCollection.retainAllRaw(elements: Collection): Boolean = retainAll(elements) - -@Deprecated("Collections have incompatible types. Upcast elements to Collection if you're sure.", ReplaceWith("retainAll(elements)")) -@kotlin.jvm.JvmName("retainAllOfAny") -@kotlin.internal.LowPriorityInOverloadResolution -public fun MutableCollection.retainAll(elements: Collection): Boolean = retainAll(elements as Collection) - @Deprecated("Use operator 'get' instead", ReplaceWith("this[index]")) public fun CharSequence.charAt(index: Int): Char = this[index] @@ -102,18 +66,6 @@ public fun MutableList.remove(index: Int): E = removeAt(index) @Deprecated("Use property 'length' instead.", ReplaceWith("length")) public fun CharSequence.length(): Int = length -@Deprecated("Map and key have incompatible types. Upcast key to Any? if you're sure.", ReplaceWith("get(key as K)")) -@kotlin.internal.LowPriorityInOverloadResolution -public inline operator fun Map.get(key: K): V? = get(key) - -@Deprecated("Map and key have incompatible types. Upcast key to Any? if you're sure.", ReplaceWith("containsKey(key as K)")) -@kotlin.internal.LowPriorityInOverloadResolution -public inline fun Map.containsKey(key: K): Boolean = containsKey(key) - -@Deprecated("Map and value have incompatible types. Upcast value to Any? if you're sure.", ReplaceWith("containsValue(value as V)")) -@kotlin.internal.LowPriorityInOverloadResolution -public inline fun Map.containsValue(value: V): Boolean = containsValue(value as Any?) - @Deprecated("Use property 'keys' instead.", ReplaceWith("keys")) public inline fun Map.keySet(): Set = keys diff --git a/libraries/tools/kotlin-stdlib-gen/src/templates/Elements.kt b/libraries/tools/kotlin-stdlib-gen/src/templates/Elements.kt index 73504238c6e..6e467a16242 100644 --- a/libraries/tools/kotlin-stdlib-gen/src/templates/Elements.kt +++ b/libraries/tools/kotlin-stdlib-gen/src/templates/Elements.kt @@ -29,33 +29,6 @@ fun elements(): List { } - templates add f("contains(element: T)") { - operator(true) - only(Iterables, Sequences, ArraysOfObjects) - doc { "Returns `true` if [element] is found in the collection." } - returns("Boolean") - deprecate { f -> with(DocExtensions) { Deprecation("${f.collection.capitalize()} and element have incompatible types. Upcast element to Any? if you're sure.", "contains(element as T)") } } - annotations(""" - @kotlin.jvm.JvmName("containsAny") - @kotlin.internal.LowPriorityInOverloadResolution - """.trimIndent()) - } - - templates add f("containsRaw(element: Any?)") { - only(Iterables, Sequences, ArraysOfObjects) - doc { f -> - """ - Returns `true` if [element] is found in the ${f.collection}. - Allows to overcome type-safety restriction of `contains` that requires to pass an element of type `T`. - """ - } - receiverAsterisk(Iterables, Sequences) { true } - inline(true) - deprecate { f -> with(DocExtensions) { Deprecation("${f.collection.capitalize()} and element have incompatible types. Upcast element to Any? if you're sure.", "contains(element as Any?)") } } - annotations("""@Suppress("NOTHING_TO_INLINE")""") - returns("Boolean") - } - templates add f("indexOf(element: T)") { only(Iterables, Sequences, ArraysOfObjects, ArraysOfPrimitives, Lists) doc { f -> "Returns first index of [element], or -1 if the ${f.collection} does not contain element." } @@ -105,34 +78,6 @@ fun elements(): List { body(Lists) { "return indexOf(element)" } } - templates add f("indexOf(element: T)") { - only(Iterables, Sequences, ArraysOfObjects, Lists) - doc { "Returns first index of [element], or -1 if the collection does not contain element." } - returns("Int") - deprecate { f -> with(DocExtensions) { Deprecation("${f.collection.capitalize()} and element have incompatible types. Upcast element to Any? if you're sure.", "indexOf(element as T)") } } - annotations(""" - @kotlin.jvm.JvmName("indexOfAny") - @kotlin.internal.LowPriorityInOverloadResolution - @Suppress("NOTHING_TO_INLINE") - """.trimIndent()) - } - - templates add f("indexOfRaw(element: Any?)") { - only(Iterables, Sequences, ArraysOfObjects, Lists) - doc { f -> - """ - Returns first index of [element], or -1 if the ${f.collection} does not contain element. - Allows to overcome type-safety restriction of `indexOf` that requires to pass an element of type `T`. - """ - } - receiverAsterisk(Iterables, Sequences) { true } - inline(true) - deprecate { f -> with(DocExtensions) { Deprecation("${f.collection.capitalize()} and element have incompatible types. Upcast element to Any? if you're sure.", "indexOf(element as Any?)") } } - annotations("""@Suppress("NOTHING_TO_INLINE")""") - returns("Int") - body(Lists) { "return (this as List).indexOf(element)" } - } - templates add f("lastIndexOf(element: T)") { only(Iterables, Sequences, ArraysOfObjects, ArraysOfPrimitives, Lists) doc { f -> "Returns last index of [element], or -1 if the ${f.collection} does not contain element." } @@ -183,34 +128,6 @@ fun elements(): List { body(Lists) { "return lastIndexOf(element)" } } - templates add f("lastIndexOf(element: T)") { - only(Iterables, Sequences, ArraysOfObjects, Lists) - doc { "Returns last index of [element], or -1 if the collection does not contain element." } - returns("Int") - deprecate { f -> with(DocExtensions) { Deprecation("${f.collection.capitalize()} and element have incompatible types. Upcast element to Any? if you're sure.", "lastIndexOf(element as T)") } } - annotations(""" - @kotlin.jvm.JvmName("lastIndexOfAny") - @kotlin.internal.LowPriorityInOverloadResolution - @Suppress("NOTHING_TO_INLINE") - """.trimIndent()) - } - - templates add f("lastIndexOfRaw(element: Any?)") { - only(Iterables, Sequences, ArraysOfObjects, Lists) - doc { f -> - """ - Returns last index of [element], or -1 if the ${f.collection} does not contain element. - Allows to overcome type-safety restriction of `lastIndexOf` that requires to pass an element of type `T`. - """ - } - receiverAsterisk(Iterables, Sequences) { true } - inline(true) - deprecate { f -> with(DocExtensions) { Deprecation("${f.collection.capitalize()} and element have incompatible types. Upcast element to Any? if you're sure.", "lastIndexOf(element as Any?)") } } - annotations("""@Suppress("NOTHING_TO_INLINE")""") - returns("Int") - body(Lists) { "return (this as List).lastIndexOf(element)" } - } - templates add f("indexOfFirst(predicate: (T) -> Boolean)") { inline(true)