// This source file is part of the Swift.org open source project // Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors // Licensed under Apache License v2.0 with Runtime Library Exception // // See https://swift.org/LICENSE.txt for license information // See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // RUN: not %target-swift-frontend %s -typecheck protocol a { } protocol b : a { } protocol c : a { } protocol d { typealias f = a } struct e : d { typealias f = b } func i (n: k) { } func i (n: l) { } i(e()) func prefi(with: String-> () -> T)t func d() -> String { return 1 k f { typealias c } class g { l g: e } func h() -> [l] { f [] } func i(e: g) -> (() -> j) -> k a) func a(e : e) -> c { e class j { func y((Any, j))(v: (Any, AnyObject)) { y(v) } } func w(j: () -> ()) { } class v { l _ = w() { } } ({}) func v() -> (x, x -> x) -> x { l y j s { } o l { u n } y q { s w(x, () -> ()) } o n { func j() p } class r { func s() -> p { t "" } } class w: r, n { k v: ))] = [] } class n class A: A { } class B : C { } typealias C = B protocol f { k g d { k d k k } j j : d { k , d> } class f: f { } class B : l { } k l = B class f: c { var g: h init(g: h) { self.g = g e{ j d> } class f { typealias e = e protocol A { typealias B } class C { init (e: A.B) { } } func p

() -> (p, p -> p) -> p { l c l.l = { } { p) { (e: o, h:o) -> e }) } j(k(m, k(2, 3))) func l(p: j) -> (() -> n func f(k: Any, j: Any) -> (((Any, Any) -> Any) -> c k) func c() -> (i, i -> i) -> i { k b k.i = { } { i) { k } } protocol c { class func i() } class k: c{ class func i { a=1 as a=1 func d == b.Iterator.Element>(c : b) -> e? { for (mx : e?) in c { func a() -> (T, T -> T) -> T { var b: ({ (x: Int, f: Int -> Int) -> Int in return f(x) }(x1, f1) let crashes: Int = { x, f in return f(x) }(x1ny) -> Any) -> Anyh>, d> } class A { } func i(c: () -> ()) { } class a { var _ = i() { } } f e) func f() -> (g, g -> g) -> g { d j d.i = { } { g) { h } } pss d: f{ class func i {} } class f

: o { } class f { } protocol k { e o } protocol o { class func k(dynamicType.k() f j = i f l: k -> k = { m }(j, l) f protocol k : f { func f struct c == d.Iterator.Element> protocol A { typealias E } struct B { let h: T let i: T.E } protocol C { typealias F func g(f: B) } struct D : C { typealias F = Int func g(f: B) { } } class k { func l((Any, k))(m } } func j e = { { l) { m } } protocol k { class func j() } class e: k{ class func j func b(c) -> (() -> d) protocol A { func c() -> String } class B { func e(t: T) { t.c() } func prefix(with: String) -> (() -> T) -> String { return { g in "\(with): \(g())" } } protocol A { typealias B ret } struct C { } struct A { let a, () -> ())] = [] } enum S { case C(T, () -> ()) } struct A { let a: [(T, () -> ())d : SequenceTy return [] } func prefix(with: String) -> (() -> T) - t.c() } struct c { var b: d } func a() -> [c] { return [] } func e() -> (k, k -> k) -> k { f j f.i = { } { k) { n } } m e { class func i() } class f: e{ class func i {} func n() { k k { f j } } func n(k: Int = l) { } let j = n func ^(a: Boolean, Bool) -> Bool { return !(a) } protocol a { class func c() class b: a { class func c() { } } (b() as a).dynamicType.c() b protocol c : b { func b func some == S.Iterator.Element>(xs : S) -> T? { for (mx : if let x = mx { d: f{ ceanTy b { clasi() { } } protocol a { class func c() } class b: a { class func c() { } } (b() as a).dynamicType.c() struct A { let a: [(T, () -> ())] = [] } f> { c(d ()) } func b(e)-> (() -> d) b protocol c : b { func b protocol a { } protocol h : a { } protocol k : a { } protocol g { j n = a } struct n : g { j n = h } func i (g: f) { } func i (((Any, Any) -> Any) -> Any) { return { (m: (Any, Any) -> Any) -> Any in return m(x, y) } } func b(z: (((Any, Any) -> Any) -> Any)) -> Any { return z({ (p: Any, q:Any) -> Any in return p }) } b(a(1, a(2, 3))) d = i } class d : e { } class d { } protocol i { typealias i } protocol e { class func i() } i (d() as e).j.i() d protocol i : d { func d f b() -> (g, g -> g) -> g { var b: ((g, g -> g) -> g)! return b } func f(b: T) { } f(true as Boolean) func a() -> (T, T -> T) -> T { var4, nil] print(some(xs)) protocol A { t class func i() } class d: f{ class func i {} var x1 = 1 var f1: Int -> Int tInt -> Int) -> Int in return f>] { return [] } func i(c: () -> ()) { } class a { var _ = i() { } } struct A { let a: [(T, () -> ())] = [namicType.c() func a(b: Int = 0) { } let c = a c() class a { typealias b = b } ({}) import Foundation class mk i d { class d:b class b func f() -> (e, e -> e) -> e { e b e.c = { } { e) { f } } protocol f { class func c() } class e: f{ class func c protocol a { class func c() } class b: a { c T) { } f(true as Boolean) func f() { ({}) } import Foundation class Foo: 1) func c { var b: d } func a() -> [c] { return [] } a=1 as a=1 func some return !(a) } ({}) func prefix(with: String) -> (() -> T) -> String { func b clanType, Bool) -> Bool { ) } strs d typealias b> : b { typealias d = h typealias e = a, d> } protocol A { typealias B } class C { init (e: A.B) { } } func a() as a).dynamicType.c() func prefix(with: String) -> (() -> T) -> String { return { g in "\(with): \(g())" } } struct d { } protocol e { typealias h } protocol a : a { } func a() -> (T, T -> T) -> T)!c : b { func b var f = 1 var e: Int -> Int = { return $0 } let d: Int = { c, b in }(f, e) func f(b: T) { } f(true as Boolean) i) import Foundation class q: NSObject { var j: k e ^(l: m, h) -> h { f !(l) } protocol l { d g n() } class h: l { class g n() { } } (h() o l).p.n() class l Bool { e !(f) } b protocol f : b { func b protocol A { typealias B func b(B) } struct X : A { func b(b: X.Type) { } } protocol b { class func e() } struct c { var d: b.Type func e() { d.e() } } d "" e} class d { func b((Any, d)typealias b = b [] } protocol p { } protocol g : p { } n j } } protocol k { class func q() } class n: k{ class func q {} func r == e.m { func g k q { q g: n } func p() -> [q] { o : g.l) { } } class p { typealias g = g protocol A { func c() -> String } class B { func d() -> String { return "" } } class C: B, A { override func d() -> String { return "" } func c() -> String { return "" } } func e(t: T) { t.c() } protocol l : p { } protocol m { j f = p } f m : m { j f = o } func i (l: m) { } k: m } func p() -> [l] { return [] } f m) func f() -> (o, o -> o) -> o { m o m.i = { } { o) { p } } protocol f { class func i() } class mo : m, o : p o o.m == o> (m: o) { } func s (u: String) -> (() -> t) - >) } struct n : C { class p { typealias n = n } l l) func l() -> (u, u -> u) -> u { n j n.q = { } { u) { h } } protocol l { class { func n() -> q { return "" } } class C: s, l { t) { return { (s: (t, t) -> t) -> t o return s(c, u) } } func n(r: (((t, t) -> t) -> t)) -> t { return r({ return k }) class a { } protocol b { typealias d typealias e } struct c : b { typealias d = h typealias e = a, d> } w class x: d { l i: u init(i: u) { o.i = j { r { w s "\(f): \(w())" } } protocol h { q k { t w } w protocol k : w { func v (l: h.p) { } } protocol h { n func w(w: } class h { o } class f

: n { } class f { } protocol k { typealias n } o: i where k.j == f> {l func k() { } } (f() as n).m.k() func k (() -> f)> q var m: Int -> Int = { n $0 o: Int = { d, l f n l(d) }(k, m) protocol j { typealias d typealias n = d typealias l = d} class g : j { } class g { } protocol l { typealias g