Replacement upcasts parameter to the most specific supertype in case of contains, indexOf, lastIndexOf, remove, get, containsKey, containsValue.
This commit is contained in:
@@ -438,11 +438,11 @@ public operator fun ShortArray.contains(element: Short): Boolean {
|
||||
/**
|
||||
* 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 Any?)"))
|
||||
@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 <T> Array<out T>.contains(element: T): Boolean {
|
||||
return contains(element as Any?)
|
||||
return contains(element as T)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1321,12 +1321,12 @@ public fun ShortArray.indexOf(element: Short): Int {
|
||||
/**
|
||||
* 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 Any?)"))
|
||||
@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 <T> Array<out T>.indexOf(element: T): Int {
|
||||
return indexOf(element as Any?)
|
||||
return indexOf(element as T)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1872,12 +1872,12 @@ public fun ShortArray.lastIndexOf(element: Short): Int {
|
||||
/**
|
||||
* 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 Any?)"))
|
||||
@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 <T> Array<out T>.lastIndexOf(element: T): Int {
|
||||
return lastIndexOf(element as Any?)
|
||||
return lastIndexOf(element as T)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -64,11 +64,11 @@ public operator fun <@kotlin.internal.OnlyInputTypes T> Iterable<T>.contains(ele
|
||||
/**
|
||||
* 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 Any?)"))
|
||||
@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 <T> Iterable<T>.contains(element: T): Boolean {
|
||||
return contains(element as Any?)
|
||||
return contains(element as T)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -281,23 +281,23 @@ public fun <@kotlin.internal.OnlyInputTypes T> List<T>.indexOf(element: T): Int
|
||||
/**
|
||||
* 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 Any?)"))
|
||||
@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 <T> Iterable<T>.indexOf(element: T): Int {
|
||||
return indexOf(element as Any?)
|
||||
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 Any?)"))
|
||||
@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 <T> List<T>.indexOf(element: T): Int {
|
||||
return indexOf(element as Any?)
|
||||
return indexOf(element as T)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -461,23 +461,23 @@ public fun <@kotlin.internal.OnlyInputTypes T> List<T>.lastIndexOf(element: T):
|
||||
/**
|
||||
* 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 Any?)"))
|
||||
@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 <T> Iterable<T>.lastIndexOf(element: T): Int {
|
||||
return lastIndexOf(element as Any?)
|
||||
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 Any?)"))
|
||||
@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 <T> List<T>.lastIndexOf(element: T): Int {
|
||||
return lastIndexOf(element as Any?)
|
||||
return lastIndexOf(element as T)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -22,11 +22,11 @@ public operator fun <@kotlin.internal.OnlyInputTypes T> Sequence<T>.contains(ele
|
||||
/**
|
||||
* 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 Any?)"))
|
||||
@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 <T> Sequence<T>.contains(element: T): Boolean {
|
||||
return contains(element as Any?)
|
||||
return contains(element as T)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -146,12 +146,12 @@ public fun <@kotlin.internal.OnlyInputTypes T> Sequence<T>.indexOf(element: T):
|
||||
/**
|
||||
* 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 Any?)"))
|
||||
@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 <T> Sequence<T>.indexOf(element: T): Int {
|
||||
return indexOf(element as Any?)
|
||||
return indexOf(element as T)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -239,12 +239,12 @@ public fun <@kotlin.internal.OnlyInputTypes T> Sequence<T>.lastIndexOf(element:
|
||||
/**
|
||||
* 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 Any?)"))
|
||||
@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 <T> Sequence<T>.lastIndexOf(element: T): Int {
|
||||
return lastIndexOf(element as Any?)
|
||||
return lastIndexOf(element as T)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -35,10 +35,10 @@ public fun <@kotlin.internal.OnlyInputTypes T> MutableCollection<out T>.remove(e
|
||||
@Deprecated("Collection and element have incompatible types. Upcast element to Any? if you're sure.", ReplaceWith("remove(element as Any?)"))
|
||||
public inline fun <E> MutableCollection<E>.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 Any?)"))
|
||||
@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 <E> MutableCollection<E>.remove(element: Any?): Boolean = remove(element)
|
||||
public fun <T> MutableCollection<out T>.remove(element: T): Boolean = remove(element)
|
||||
|
||||
/**
|
||||
* Removes all of this collection's elements that are also contained in the specified collection.
|
||||
@@ -102,17 +102,17 @@ public fun <E> MutableList<E>.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 Any?)"))
|
||||
@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 <K, V> Map<K, V>.get(key: Any?): V? = get(key)
|
||||
public inline operator fun <K, V> Map<out K, V>.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 Any?)"))
|
||||
@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 <K, V> Map<K, V>.containsKey(key: Any?): Boolean = containsKey(key)
|
||||
public inline fun <K, V> Map<out K, V>.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 Any?)"))
|
||||
@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 <K, V> Map<K, V>.containsValue(value: Any?): Boolean = containsValue(value as Any?)
|
||||
public inline fun <K, V> Map<K, V>.containsValue(value: V): Boolean = containsValue(value as Any?)
|
||||
|
||||
@Deprecated("Use property 'keys' instead.", ReplaceWith("keys"))
|
||||
public inline fun <K, V> Map<K, V>.keySet(): Set<K> = keys
|
||||
|
||||
@@ -34,7 +34,7 @@ fun elements(): List<GenericFunction> {
|
||||
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 Any?)") } }
|
||||
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
|
||||
@@ -109,7 +109,7 @@ fun elements(): List<GenericFunction> {
|
||||
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 Any?)") } }
|
||||
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
|
||||
@@ -187,7 +187,7 @@ fun elements(): List<GenericFunction> {
|
||||
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 Any?)") } }
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user