** Sigh ** I was really hoping this would work. The idea was to overload the initializer so we control which overload of lastCorrespondingIndexes is picked with the signature. At least I found an interesting bug. @Slava_Pestov
struct Foo<U: Collection> {
init<T: Collection>(_ arg: T) where T == U { ... }
init<T: RandomAccessCollection>(_ arg: T) where T == U { ... }
}
// Trying to hack around T == U
extension Collection { typealias KEK = Self }
struct Foo<U: Collection> {
init<T: Collection>(_ arg: U) where T.KEK == U.KEK { ... }
init<T: RandomAccessCollection>(_ arg: T) where T.KEK == U.KEK { ... }
// 'T' does not have a member type named 'KEK'; did you mean 'KEK'?
// 'U' does not have a member type named 'KEK'; did you mean 'KEK'?
}
It would be nice to have same-type constraints allowed between generic parameters coming from different signatures.