Skip to content

Commit c04384a

Browse files
authored
Fix typos: missing subscript parameters (apple#81)
* Fix typos: missing subscript parameters * Fix typos: more missing subscript parameters * Improve symbol documentation
1 parent cd33954 commit c04384a

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

Sources/OrderedCollections/OrderedDictionary/OrderedDictionary+Elements+SubSequence.swift

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,19 +53,20 @@ extension OrderedDictionary.Elements.SubSequence {
5353
extension OrderedDictionary.Elements.SubSequence {
5454
/// Returns the index for the given key.
5555
///
56-
/// If the given key is found in the dictionary, this method returns an index
57-
/// into the dictionary that corresponds with the key-value pair.
56+
/// If the given key is found in the dictionary slice, this method returns an
57+
/// index into the dictionary that corresponds with the key-value pair.
5858
///
5959
/// let countryCodes: OrderedDictionary = ["BR": "Brazil", "GH": "Ghana", "JP": "Japan"]
60-
/// let index = countryCodes.index(forKey: "JP")
60+
/// let slice = countryCodes.elements[1...]
61+
/// let index = slice.index(forKey: "JP")
6162
///
62-
/// print("Country code for \(countryCodes[index!].value): '\(countryCodes[index!].key)'.")
63+
/// print("Country code for \(countryCodes[offset: index!].value): '\(countryCodes[offset: index!].key)'.")
6364
/// // Prints "Country code for Japan: 'JP'."
6465
///
65-
/// - Parameter key: The key to find in the dictionary.
66+
/// - Parameter key: The key to find in the dictionary slice.
6667
///
6768
/// - Returns: The index for `key` and its associated value if `key` is in
68-
/// the dictionary; otherwise, `nil`.
69+
/// the dictionary slice; otherwise, `nil`.
6970
///
7071
/// - Complexity: Expected to be O(1) on average, if `Key` implements
7172
/// high-quality hashing.

Sources/OrderedCollections/OrderedDictionary/OrderedDictionary+Elements.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,9 @@ extension OrderedDictionary.Elements {
7979
/// into the dictionary that corresponds with the key-value pair.
8080
///
8181
/// let countryCodes: OrderedDictionary = ["BR": "Brazil", "GH": "Ghana", "JP": "Japan"]
82-
/// let index = countryCodes.index(forKey: "JP")
82+
/// let index = countryCodes.elements.index(forKey: "JP")
8383
///
84-
/// print("Country code for \(countryCodes[index!].value): '\(countryCodes[index!].key)'.")
84+
/// print("Country code for \(countryCodes[offset: index!].value): '\(countryCodes[offset: index!].key)'.")
8585
/// // Prints "Country code for Japan: 'JP'."
8686
///
8787
/// - Parameter key: The key to find in the dictionary.

Sources/OrderedCollections/OrderedDictionary/OrderedDictionary.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ extension OrderedDictionary {
272272
/// let countryCodes: OrderedDictionary = ["BR": "Brazil", "GH": "Ghana", "JP": "Japan"]
273273
/// let index = countryCodes.index(forKey: "JP")
274274
///
275-
/// print("Country code for \(countryCodes[index!].value): '\(countryCodes[index!].key)'.")
275+
/// print("Country code for \(countryCodes[offset: index!].value): '\(countryCodes[offset: index!].key)'.")
276276
/// // Prints "Country code for Japan: 'JP'."
277277
///
278278
/// - Parameter key: The key to find in the dictionary.

0 commit comments

Comments
 (0)