Skip to content

Modernize some test code #5470

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 26, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 15 additions & 13 deletions test/Prototypes/Algorithms.swift.gyb
Original file line number Diff line number Diff line change
Expand Up @@ -374,8 +374,8 @@ public func == <C1: Collection, C2: Collection>(
% Self = "Concatenated" + Collection

/// A concatenation of two collections with the same element type.
public struct ${Self}<C1 : ${Collection}, C2: ${Collection}
where C1.Iterator.Element == C2.Iterator.Element>: ${Collection} {
public struct ${Self}<C1 : ${Collection}, C2: ${Collection}>: ${Collection}
where C1.Iterator.Element == C2.Iterator.Element {

init(_base1: C1, base2: C2) {
self._base1 = _base1
Expand Down Expand Up @@ -488,8 +488,8 @@ public struct ${Self}<C1 : ${Collection}, C2: ${Collection}
/// first collection and then the elements of the second collection.
func concatenate<
C1 : ${Collection}, C2 : ${Collection}
where C1.Iterator.Element == C2.Iterator.Element
>(_ first: C1, _ second: C2) -> ${Self}<C1, C2> {
>(_ first: C1, _ second: C2) -> ${Self}<C1, C2>
where C1.Iterator.Element == C2.Iterator.Element {
return ${Self}(_base1: first, base2: second)
}

Expand All @@ -499,22 +499,23 @@ func concatenate<
//===----------------------------------------------------------------------===//

/// A position in a rotated collection.
public struct RotatedCollectionIndex<
Base : Collection where Base.SubSequence: Collection
> : Comparable {
public struct RotatedCollectionIndex<Base : Collection> : Comparable
where Base.SubSequence: Collection {
internal let _index:
ConcatenatedCollectionIndex<Base.SubSequence, Base.SubSequence>
}

public func < <Base: Collection where Base.SubSequence: Collection>(
public func < <Base: Collection>(
lhs: RotatedCollectionIndex<Base>, rhs: RotatedCollectionIndex<Base>
) -> Bool {
) -> Bool
where Base.SubSequence: Collection {
return lhs._index < rhs._index
}

public func == <Base: Collection where Base.SubSequence: Collection>(
public func == <Base: Collection>(
lhs: RotatedCollectionIndex<Base>, rhs: RotatedCollectionIndex<Base>
) -> Bool {
) -> Bool
where Base.SubSequence: Collection {
return lhs._index == rhs._index
}

Expand All @@ -524,8 +525,9 @@ public func == <Base: Collection where Base.SubSequence: Collection>(

/// A rotated view onto a `${Collection}`.
public struct ${Self}<
Base : ${Collection} where Base.SubSequence: ${Collection}
> : ${Collection} {
Base : ${Collection}
> : ${Collection}
where Base.SubSequence: ${Collection} {
let _concatenation: Concatenated${Collection}<
Base.SubSequence, Base.SubSequence>

Expand Down