I was looking at the kotlin standard library, and ...
# announcements
r
I was looking at the kotlin standard library, and I came across this comment on the function
List<T>.lastIndexOf(element: T)
:
Copy code
@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:
Copy code
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!
👀 1