Rohen Giralt
08/01/2020, 2:36 AMList<T>.lastIndexOf(element: T)
:
@Suppress("EXTENSION_SHADOWED_BY_MEMBER") // false warning, extension takes precedence in some cases
public fun <@kotlin.internal.OnlyInputTypes T> List<T>.lastIndexOf(element: T): Int {
return lastIndexOf(element)
}
"false warning, extension takes precedence in some cases"
In kotlin.collections, list is defined with this method:
public interface List<out E> : Collection<E> {
/*Other things*/
public fun lastIndexOf(element: @UnsafeVariance E): Int
/*Other things*/
}
Why is this a false warning? When does the extension ever take precedence?
Thanks in advance!