Skip to content

Commit

Permalink
Merge pull request #5485 from airspeedswift/expectEnd-labels-fixme
Browse files Browse the repository at this point in the history
[stdlib] Add arg labels to _expectEnd (ABI FIXME #15)
  • Loading branch information
airspeedswift authored Oct 27, 2016
2 parents 874eb16 + 8147338 commit 3f534c2
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 7 deletions.
4 changes: 2 additions & 2 deletions stdlib/public/core/ArrayBufferProtocol.swift
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ extension _ArrayBufferProtocol where Index == Int {
(elements + j).initialize(to: newValues[i])
newValues.formIndex(after: &i)
}
_expectEnd(i, newValues)
_expectEnd(of: newValues, is: i)
}
else { // We're not growing the buffer
// Assign all the new elements into the start of the subRange
Expand All @@ -178,7 +178,7 @@ extension _ArrayBufferProtocol where Index == Int {
formIndex(after: &i)
newValues.formIndex(after: &j)
}
_expectEnd(j, newValues)
_expectEnd(of: newValues, is: j)

// If the size didn't change, we're done.
if growth == 0 {
Expand Down
5 changes: 2 additions & 3 deletions stdlib/public/core/Arrays.swift.gyb
Original file line number Diff line number Diff line change
Expand Up @@ -1656,7 +1656,7 @@ internal struct _InitializeMemoryFromCollection<
newValues.formIndex(after: &q)
p += 1
}
_expectEnd(q, newValues)
_expectEnd(of: newValues, is: q)
}

init(_ newValues: C) {
Expand Down Expand Up @@ -1694,8 +1694,7 @@ internal func _arrayOutOfPlaceReplace<B, C>(
/// A _debugPrecondition check that `i` has exactly reached the end of
/// `s`. This test is never used to ensure memory safety; that is
/// always guaranteed by measuring `s` once and re-using that value.
// FIXME(ABI)#15 : add argument labels.
internal func _expectEnd<C : Collection>(_ i: C.Index, _ s: C) {
internal func _expectEnd<C : Collection>(of s: C, is i: C.Index) {
_debugPrecondition(
i == s.endIndex,
"invalid Collection: count differed in successive traversals")
Expand Down
2 changes: 1 addition & 1 deletion stdlib/public/core/Collection.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1281,7 +1281,7 @@ extension Collection {
formIndex(after: &i)
}

_expectEnd(i, self)
_expectEnd(of: self, is: i)
return Array(result)
}

Expand Down
2 changes: 1 addition & 1 deletion stdlib/public/core/ContiguousArrayBuffer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,7 @@ internal func _copyCollectionToContiguousArray<
source.formIndex(after: &i)
p += 1
}
_expectEnd(i, source)
_expectEnd(of: source, is: i)
return ContiguousArray(_buffer: result)
}

Expand Down

0 comments on commit 3f534c2

Please sign in to comment.