Files
swift-mirror/test/Serialization/Inputs/inherited-conformance-base.swift
Jordan Rose 65bd8536bc [serialization] Look for underlying conformances in refined protocol adopters.
That is, if we need a type MyIndex<T> to be a valid ForwardIndex, we should
be able to find it in the conformance for BidirectionalIndex, which inherits
from ForwardIndex.

<rdar://problem/15484898>

Swift SVN r11270
2013-12-13 21:42:51 +00:00

17 lines
363 B
Swift

// Adopt ForwardIndex via BidirectionalIndex.
struct Counter<T: protocol<RandomAccessIndex, IntegerLiteralConvertible>> : BidirectionalIndex {
var value = 0
func __equal__(rhs: Counter) -> Bool {
return value == rhs.value
}
func pred() -> Counter {
return Counter(value - 1)
}
func succ() -> Counter {
return Counter(value + 1)
}
}