// RUN: %target-parse-verify-swift protocol SomeProtocol { associatedtype T } extension SomeProtocol where T == Optional { } // expected-error{{same-type constraint 'Self.T' == 'Optional' is recursive}} // rdar://problem/19840527 // FIXME: Crappy diagnostic class X where T == X { // expected-error{{non-class type '<>' cannot conform to class protocol 'AnyObject'}} // expected-error@-1{{same-type requirement makes generic parameter 'T' non-generic}} var type: T { return type(of: self) } // expected-error{{use of undeclared type 'T'}} } protocol Y { associatedtype Z = Z // expected-error{{type alias 'Z' circularly references itself}} } // rdar://problem/20000145 public protocol P { associatedtype T } public struct S where A.T == S {} // expected-error{{type may not reference itself as a requirement}} protocol I { init() // expected-note 2{{protocol requires initializer 'init()' with type '()'}} } protocol PI { associatedtype T : I } struct SI : I where A : I, A.T == SI { // expected-error{{type may not reference itself as a requirement}} } // Used to hit infinite recursion struct S4 : I where A : I { } struct S5 : I where A : I, A.T == S4 { } // Used to hit ArchetypeBuilder assertions struct SU where A.T == SU { } struct SIU : I where A : I, A.T == SIU { }