// RUN: %target-parse-verify-swift infix operator +++ {} protocol ConcatToAnything { func +++ (lhs: Self, other: T) } func min(x: T, y: T) -> T { if y < x { return y } return x } func weirdConcat(t: T, u: U) { t +++ u t +++ 1 u +++ t // expected-error{{cannot pass 'let' value 'u' to mutating binary operator '+++'}} } // Make sure that the protocol operators don't get in the way. var b1, b2 : Bool b1 != b2 extension UnicodeScalar { func isAlpha2() -> Bool { return (self >= "A" && self <= "Z") || (self >= "a" && self <= "z") } } protocol P { static func foo(arg: Self) -> Self } struct S : P { static func foo(arg: S) -> S { return arg } } func foo(arg: T) -> T { return T.foo(arg) } // Associated types and metatypes protocol SomeProtocol { typealias SomeAssociated } func generic_metatypes(x: T) -> (T.Type, T.SomeAssociated.Type) { return (x.dynamicType, x.dynamicType.SomeAssociated.self) } // Inferring a variable's type from a call to a generic. struct Pair { } func pair(x: T, _ y: U) -> Pair { } var i : Int, f : Float var p = pair(i, f) // Conformance constraints on static variables. func f1(s1: S1) {} var x : Array = [1] f1(x) // Inheritance involving generics and non-generics. class X { func f() {} } class Foo : X { func g() { } } class Y : Foo { } func genericAndNongenericBases(x: Foo, y: Y<()>) { x.f() y.f() y.g() } func genericAndNongenericBasesTypeParameter>(t: T) { t.f() t.g() } protocol P1 {} protocol P2 {} func foo(t: T) -> P2 { return t // expected-error{{type 'T' does not conform to protocol 'P2'}} } func foo2(p1: P1) -> P2 { return p1 // expected-error{{type 'P1' does not conform to protocol 'P2'}} } // protocol BinaryMethodWorkaround { typealias MySelf } protocol Squigglable : BinaryMethodWorkaround { } infix operator ~~~ { } func ~~~ (lhs: T, rhs: T) -> Bool { return true } extension UInt8 : Squigglable { typealias MySelf = UInt8 } var rdar14005696 : UInt8 rdar14005696 ~~~ 5 // func f1< S: CollectionType where S.Index: BidirectionalIndexType >(seq: S) { let x = lazy(seq.indices).reverse() PermutationGenerator(elements: seq, indices: x) PermutationGenerator(elements: seq, indices: lazy(seq.indices).reverse()) } // func count16078944(x: C) -> Int { return 0 } func test16078944 (lhs: T, args: T) -> Int { return count16078944(lhs..