Protocols: override Keyword

In the Standard Library's implementation, I see usage of an override keyword sometimes preceding the declaration of a protocol requirement. For example, in the declaration of the requirements of RandomAccessCollection, there is frequent usage of this keyword, such as:

/// Returns the position immediately before the given index.
///
/// - Parameter i: A valid index of the collection. `i` must be greater than
///   `startIndex`.
/// - Returns: The index value immediately before `i`.
override func index(before i: Index) -> Index

What does this keyword do? Where is it documented?

As a related matter, what does the @_nonoverride keyword do? (I ask not because I plan to use it, but to better understand what I'm reading in the Standard Library implementation.)

2 Likes

This is an internal, undocumented feature for an ABI-related reason:

5 Likes

Thanks, Xiaodi.