Skip to content

Instantly share code, notes, and snippets.

@DougGregor
Created January 20, 2017 18:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DougGregor/58d7d84e1e90b50b732fc1812ccb7309 to your computer and use it in GitHub Desktop.
Save DougGregor/58d7d84e1e90b50b732fc1812ccb7309 to your computer and use it in GitHub Desktop.
SubstitutionMap conformance search
protocol P { }
protocol Q {
associatedtype Assoc
func assoc() -> Assoc
}
protocol R : Q {
associatedtype Assoc: P
}
func f<A: P>(_: A) { }
func g<T: R>(_ t: T) {
f(t.assoc())
}
struct X : R {
struct Assoc: P { }
func assoc() -> Assoc { return Assoc() }
}
g(X())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment