Why is this method duplicated?
Where exactly are you seeing this?
That method is declared on RangeReplaceableCollection
, and the standard library has two default implementations for it, one with and one without the additional constraint Self: MutableCollection
.
However only the former should be picked up by Array
.
RangeReplaceableCollection
offers two default implementations of removeAll(where:)
:
- A generic implementation requiring only
RangeReplaceableConformance
swift/stdlib/public/core/RangeReplaceableCollection.swift at 27702fa1155b9e23fde7234492e72305c4e3a34a · apple/swift · GitHub - A more efficient implementation when the type conforms to
MutableCollection
: swift/stdlib/public/core/RangeReplaceableCollection.swift at 27702fa1155b9e23fde7234492e72305c4e3a34a · apple/swift · GitHub
Array
conforms to MutableCollection
, so it gets the latter, but the generated interface still ends up showing both.
the generated documentation for Array
also contains the duplicated method, which is a strong indication that this bug also exists in lib/SymbolGraphGen.
I'm also seeing this recently. Thanks for opening the topic here and looks we already have an answer for it.
Besides fix it in the compiler side, I was wondering whether swift-docc will be effected by the bug?
i think it does, but they don’t appear adjacent to one another in generated DocC docs because DocC splits off protocol extension members into a separate section.