blob: 65587c5d79ea7ec091ba7ee62669a613e227ec17 [file] [log] [blame]
// RUN: %target-parse-verify-swift
class C {
func f() {}
}
class D : C {
}
class E { }
protocol P { // expected-note{{requirement specified as 'Self.Assoc' : 'C' [with Self = X2]}}
associatedtype Assoc : C
func getAssoc() -> Assoc
}
struct X1 : P {
func getAssoc() -> D { return D() }
}
struct X2 : P { // expected-error{{'P' requires that 'E' inherit from 'C'}}
func getAssoc() -> E { return E() }
}
func testP<T:P>(_ t: T) {
_ = t.getAssoc() as C
t.getAssoc().f()
}
func callTestP(_ x1: X1) {
testP(x1)
}