// RUN: %swift -parse %s -verify protocol P1 { func p1() } struct X1 { func getT() -> T { } } class X2 { func getT() -> T { } } class X3 { } struct X4 { func getT() -> T { } } // Infer protocol requirements from the parameter type of a generic function. func inferFromParameterType(x : X1) { x.getT().p1() } // Infer protocol requirements from the return type of a generic function. func inferFromReturnType(x : T) -> X1 { x.p1() } // Infer protocol requirements from the superclass of a generic parameter. func inferFromSuperclass>(t : T, u : U) -> T { t.p1() } // Infer protocol requirements from the parameter type of a constructor. struct InferFromConstructor { constructor (x : X1) { x.getT().p1() } } // FIXME: Infer superclass requirements. // FIXME: Infer same-type requirements, which requires us to process // the where clause in its entirety.