Skip to content

Instantly share code, notes, and snippets.

@niwatako
Created May 14, 2016 05:36
Show Gist options
  • Save niwatako/a6fff3cc2a83a97a0df43e713202fb1f to your computer and use it in GitHub Desktop.
Save niwatako/a6fff3cc2a83a97a0df43e713202fb1f to your computer and use it in GitHub Desktop.
A<B>を継承したABをExtensionしてプロトコルに準拠させることは出来たっぽい #CodePiece
protocol ProtocolA {}
class A<T> {}
class B {}
class C {}
class AB: A<B>{}
extension AB: ProtocolA{}
assert(AB() is ProtocolA)
assert(!(A<C>() is ProtocolA))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment