Why 'there cannot be more than one conformance, even with different conditional bounds'?
As was described earlier you cannot just do this kind of extension. However, you can use hack like this:
protocol SomeExtension {
func doSomething()
}
extension SomeExtension {
func doSomething() {
print("Do nothing or error")
}
}
extension SomeExtension where Self == [String] {
func doSomething() {
print("String")
}
}
extension SomeExtension where Self == [Int] {
func doSomething() {
print("Int")
}
}
extension Array: SomeExtension { }
let stringsArr = ["a", "b", "d"]
let numbersArr = [1, 2, 3]
stringsArr.doSomething()
numbersArr.doSomething()
In console you can see
String
Int
Is it impossible? Yes and no. It's not currently possible in Swift, as it has been implemented. It is in principle possible to be implemented.
The name for this is "overlapping conformances", and it was explicitly and purposely rejected. You can find the rationale in the "Alternatives considered" section of SE-0143 Conditional conformances. The TL;DR is: because it's really complicated.
Without knowing more about what exactly you were trying to use this for, there's not much direction we can provide.