// RUN: %target-swift-frontend -emit-silgen -parse-stdlib %s protocol P { associatedtype Assoc } protocol Q { associatedtype Assoc1 associatedtype Assoc2 } struct G {} class C {} func a(x: T) {} func b(x: G, y: T.Assoc) {} func c(x: T, y: T.Assoc) {} func d(x: T, y: U) {} func e(x: T, y: U) {} // FIXME: Same-type constraints expose a typechecker bug. // func f(x: T) {} func g(x: T) {} func h(x: T) {} func i(x: T) {} func j(_: T) {} func k(_: T) {} func l(_: T) {} func m(_: T) {} struct Foo { func z() {} func a(x: T) {} func b(x: G, y: T.Assoc) {} func c(x: T, y: T.Assoc) {} func d(x: T, y: U) {} func e(x: T, y: U) {} func f(x: T) {} func g(x: T) {} func h(x: T) {} func i(x: T) {} func j(_: T) {} func k(_: T) {} func l(_: T) {} func m(_: T) {} } // Test that we handle interface type lowering when accessing a dependent // member of a dependent member that substitutes to a type parameter. // protocol Fooable { associatedtype Foo } protocol Barrable { associatedtype Bar: Fooable func bar(_: Bar) -> Bar.Foo } struct FooBar: Barrable { typealias Bar = T func bar(_ x: T) -> T.Foo { } } // Test that associated types can be constrained to concrete types func concreteJungle(_: T) -> T.Foo { return C() } func concreteJungle(_: T, t: T.Foo) -> C { let c: C = t return c } func concreteJungle(_: T, f: @escaping (T.Foo) -> C) -> T.Foo { let ff: (C) -> T.Foo = f return ff(C()) }