// 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 func c() -> (g, g -> g) -> g { d b d.f = { } { g) { i } } i c { class func f() } class d: c{ class func f {} struct d protocol p { class func g() } class h: p { class func g() { } } (h() as p).dynamicType.g() protocol p { } protocol h : p { } protocol g : p { } protocol n { o t = p } struct h : n { t : n q m.t == m> (h: m) { } func q (h: t) { } q(h()) func r(g: m) -> (() -> s) -> n class A { } func c i: g{ func c {} e g { : g { h func i() -> } } class i { func d((h: (Any, AnyObject)) { d(h) } } d h) func d() -> (i, i -> i) -> i { i j i.f = { } protocol d { class func f() } class i: d{ class func f {} func b d { class d:b class b n) func f() -> (o, o -> o) -> o { o m o.j = { } { o) { r } } p q) { } o m = j m() class m { func r((Any, m))(j: (Any, AnyObject)) { r(j) } } func m { init (e: A.B) { } } 1, g(f, j))) m k { class h k() } struct i { i d: k.l h k() { n k } class g { typealias k = k } func i(f: g) -> (() -> j) -> g { func g k, l { typealias l = m, f> } ) func o() -> (t, t -> t) -> t { j j j.o = { } { t) { h } } protocol o { class func o() } class j: o{ class func o {} e o { k [] } n=p r n=p func n() { b b { o o } } func n(j: Any, t: Any) -> (((Any, Any) -> Any) -> Any) { k { (s: (Any, Any) -> Any) -> Any l k s(j, t) } } func b(s: (((Any, Any) -> Any) -> Any) func o() as o).m.k() func p(k: b) -> (() -> i) -> b { n { o f "\(k): \(o())" } } struct d (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 m: f{ class func i {} protocol p { class func l() } class o: p { class func l() { } } class p { u _ = q() { } } u l = r u s: k -> k = { n $h: m.j) { } } o l() { ({}) } struct m { ls l { func f((k, l() -> f } class d } class i: d, g { l func d() -> f { m "" } } } func m() -> (r, r -> r) -> r { f r f.j = { } { r) { s } } protocol f { class func j() } class f: f{ class func j {} protocol j { class func m() } class r: j { class func m() { } } (r() n j).p.m() j=k n j=k protocol r { class func q() } s m { m f: r.q func q() { f.q() } (l, () -> ()) } func f(r: l) func a() -> [c{ enum b { case c 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 { 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 == b.Iterator.Element>(c : b) -> e? { for (mx : e?) in c { } } func f() -> (m, m -> m) -> m { e c e.i = { } { m) { n } } protocol f { class func i() } class e: f{ class func i {} func n() -> (j, j -> j) -> j { var m: ((j> j)! f m } protocol k { typealias m } struct e {n: j let i: j.m } l f> { c(d ()) } func b(e)-> (() -> d) ) func n() -> (w, w -> w) -> w { o m o.q = { } { w) { k } } protocol n { class func q() } class o: n{ class func q {} func p(e: Int = x) { } let c = p c() func r ==(r(t)) protocol p : p { } protocol p { class func c() } class e: p { class func c() { } } (e() u p).v.c() k e.w == l> { } func p(c: Any, m: Any) -> (((Any, Any) -> Any) -> Any) { >) } 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 }) protocol a : a { } import Foundation class m: NSObject { var h: j g -> k = l $n } b f: _ = j() { } } func k() -> [n] { r [] } func k(l: Int = 0) { } n n = k n() func n q { r !(k) } protocol k { j q j o = q j f = q } class l : k { } class l { } protocol n { j q } protocol k : k { } class k { } protocol l { j q j o } struct n import Foundation class Foo: NSObject { var foo: T init(foo: T) { B>(t: T) { t.c() } x x) { } class a { var _ = i() { } } a=1 as a=1 func c (n: k) { } func i (n: l) { } i(e()) class f { } protocol d { i l i i } struct l : d { i j i() { l.i() } } protocol f { } protocol d : f { struct c { var b: dlass func s {} s p { func m() -> String } class n { func p() -> String { q "" } } class e: n, p { v func> String { q "" } { r m = m } func s (m: o) { } func s (u: String) -> (() -> t) - c j) func c() -> (k, > k) -> k { d h d.f 1, k(j, i))) class k { typealias h = h protocol f : f { } func h() -> (g, g -> g) -> g 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) { } } func n

() -> (p, p -> p) -> p { b, l] g(o(q)) h e { j class func r() } class k: h{ class func r {} var k = 1 var s: r -> r t -> r) -> r m u h>] { u [] } func r(e: () -> ()) { } class n { var _ = r() func b((Any, e))(e: (Any) -> (()-> d) -> f protocol A { func c()l k { func l() -> g { m "" } } class C: k, A { j func l()q c() -> g { m "" } } func e(n: r) { n.c() } protocol A { typealias h } c k { p f: r p p: r.h } protocol C l.e() } } class o { typealias l = l func a() { enum b { case c } } 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 { d "" e} class d { func b((Any, d)typealias b = b protocol A { typealias B func b(B) } struct X : A { d { func d 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 ^(d: e, Bool) -> Bool {g !(d) } protocol d { f func g() f e: d { f func g() { } } (e() h d).i() e protocol g : e { func e ({}) struct c { let d: i h } func f(h: b) -> (()-> e ) func t() -> (v, v -> v) -> v { var d: ((v, v -> v) -> v)! q d } protocol t { } protocol d : t { } protocol g : t { } s q l }) } d(t(u, t(w, y))) protocol e { r j } struct m { k x: v k x: v.j } protocol n { g == o>(n: m) { } } struct e { k t: [(v, () -> ())] = [](m) } struct d : e { func d(d: d.p) { } } class e { } func h() -> (j, j -> j) -> j { var f: ({ (c: e, f: e -> e) -> return f(c) }(k, i) let o: e = { c, g return f(c) }(l) -> m) -> p>, e> } class n func j(d: h) -> (() -> k) -> h { return { n n "\(} c i { } c i: i { } c e : l { } f = e protocol m : o h = h } h } func e ()) } ({}) func j(l: o) { } j(j q Boolean) func p(l: Any, g: Any) -> (((Any, Any) -> Any) -> Any) { return { (p: (Any, Any) -> Any) -> Any in func n