Protocol extension with generic superclass constraint

I'm trying to get default implementation of protocol using extension but have a problem with using superclass constraint which is generic class.

protocol B { }
class C<A: B> { }

enum E: B { }
class S: C<E> { }

protocol P { }
extension P where Self: C<B> { }

Of course it will result in error that B cannot conform to B. So is there any way to constrain this extension to use any class that subclasses C without concrete type?

@mcichecki I had the same question and asked it on SO.
Follow SO Post for answer

1 Like