Hi swift users! I have some code that is generic over StringProtocol
, but only when removeFirst(_ k: Int)
is available, so constraint is T.SubSequence == T
:
struct Foo<T> {}
func foo<T: StringProtocol>(_ s: String) -> Foo<T> where T.SubSequence == T {...}
Now it is so happens that it would be very useful to conform ExpressibleByStringLiteral
in that situation, but, unfortunately, compiler is not happy with that:
error: 'Subsequence' is not a member type of 'T'
extension Foo: ExpressibleByStringLiteral where T: StringProtocol, T.Subsequence == T {}
~ ^
Is there any workarounds for this?