// RUN: %target-parse-verify-swift infix operator • { } protocol Runcible { func runce() } protocol Fungible { func funge() } protocol Ansible { func anse() } protocol NeedsGenericMethods { func oneArgNoConstraints(x x : T) // expected-note {{protocol requires function 'oneArgNoConstraints(x:)' with type ' (x: T) -> ()'}} func oneArgWithConstraint(x x: T) // expected-note {{protocol requires function 'oneArgWithConstraint(x:)' with type ' (x: T) -> ()'}} func oneArgWithConstraints>(x x: T) // expected-note {{protocol requires function 'oneArgWithConstraints(x:)' with type ' (x: T) -> ()'}} func twoArgsOneVar(x x: T, y: T) // expected-note {{protocol requires function 'twoArgsOneVar(x:y:)' with type ' (x: T, y: T) -> ()'}} func twoArgsTwoVars(x x: T, y: U) // expected-note {{protocol requires function 'twoArgsTwoVars(x:y:)' with type ' (x: T, y: U) -> ()'}} func •(x: Self, y: T) // expected-note {{protocol requires function '•' with type ' (TooTightConstraints, T) -> ()'}} } class EqualConstraints : NeedsGenericMethods { func oneArgNoConstraints(x x: U) {} func oneArgWithConstraint(x x: U) {} func oneArgWithConstraints>(x x: U) {} func twoArgsOneVar(x x: U, y: U) {} func twoArgsTwoVars(x x: U, y: V) {} } func •(x: EqualConstraints, y: T) {} // expected-note {{candidate has non-matching type ' (EqualConstraints, T) -> ()'}} class LooseConstraints : NeedsGenericMethods { func oneArgNoConstraints(x x: U) {} func oneArgWithConstraint(x x: U) {} func oneArgWithConstraints(x x: U) {} func twoArgsOneVar(x x: U, y: V) {} func twoArgsTwoVars(x x: U, y: V) {} } func •(x: LooseConstraints, y: T) {} // expected-note {{candidate has non-matching type ' (LooseConstraints, T) -> ()'}} class TooTightConstraints : NeedsGenericMethods { // expected-error{{type 'TooTightConstraints' does not conform to protocol 'NeedsGenericMethods'}} func oneArgNoConstraints(x x: U) {} // expected-note{{candidate has non-matching type ' (x: U) -> ()'}} func oneArgWithConstraint(x x: U) {} // expected-note{{candidate has non-matching type ' (x: U) -> ()'}} func oneArgWithConstraints>(x x: U) {} // expected-note{{candidate has non-matching type ' (x: U) -> ()'}} func twoArgsOneVar(x x: U) {} // expected-note{{candidate has non-matching type ' (x: U) -> ()'}} func twoArgsTwoVars(x x: U, y: U) {} // expected-note{{candidate has non-matching type ' (x: U, y: U) -> ()'}} } func •(x: TooTightConstraints, y: Int) {} // expected-note {{candidate has non-matching type '(TooTightConstraints, Int) -> ()'}} // Regression test for a crash when resolving a reference to a generic method // in a protocol. protocol NeedsAGenericMethod { func method(x: T) } func usesAGenericMethod(x: U) { x.method(5) } struct L: SequenceType {} // expected-error {{type 'L' does not conform to protocol '_Sequence_Type'}} expected-error {{type 'L' does not conform to protocol 'SequenceType'}} expected-error {{type 'L' does not conform to protocol '_SequenceDefaultsType'}} func z(x: L) { for xx in x {} // expected-error{{'L' does not have a member named 'Generator'}} }