Navigating through stdlib code I found one functio...
# stdlib
n
Navigating through stdlib code I found one function annotated like this:
Copy code
@Suppress("EXTENSION_SHADOWED_BY_MEMBER") // false warning, extension takes precedence in some cases
Does anyone know in which cases the extension takes precedence? This one is
Collection<T>.containsAll(elements: Collection<T>)
for instance.
i
containsAll
member is chosen only when the argument collection element type is a subtype of the receiver collection element type. In other cases,
containsAll
extension is used, e.g.
listOf(1, 2, 3).containsAll(listOf<Any>(1, "string"))