You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The MutableCollection methods sort() and sort(by:) are constrained to require RandomAccessCollection conformance. However, the documentation for them makes no mention of RandomAccessCollection. That documentation should be improved to include the constraints on their availability.
The text was updated successfully, but these errors were encountered:
The text of Apple’s documentation appears to be taken verbatim from the doc-comments on the sort() methods, as found in stdlib/public/core/CollectionAlgorithms.swift
Here is the Comparable version, and here is the version that takes a closure.
Note in particular that the doc-comment for the Comparable version of sort() states near the top, “You can sort any mutable collection of elements that conform to the `Comparable` protocol by calling this method.”
That is clearly incorrect, because the method is inside an extension constrained to RandomAccessCollection. I am reopening this because it is a standard-library documentation issue.
I can go ahead an submit a PR to fix the documentation, unless someone else is in charge of that.
Ah, sure, changing the doc text is covered by this, and a PR is definitely welcome. It's still worth filing a Radar, though, so that the Apple docs page can include the constraints on the method and not just its enclosing protocol.