// 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 i(f: g) -> (() -> j) -> g { func g k, l { typealias l = m, f> } func ^(a: Boolean, Bool) -> Bool { return !(a) } func b(c) -> (() -> d) { } func q(v: h) -> (() -> r) -> h { n { u o "\(v): \(u())" } } struct e { j p: , () -> ())] = [] } protocol p { } protocol m : p { } protocol v : p { } protocol m { v = m } func s (m: v) { } func s (m: v) { } s( { ({}) } t 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 { 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 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) -> 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 { } 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 {} 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()) class l { func f((k, l() -> f } class d } class i: d, g { l func d() -> f { m "" } } } func m() -> (h, h -> h) -> h { f f: ((h, h -> h) -> h)! j f } protocol f { class func j() } struct i { f d: f.i func j() { d.j() } } class g { typealias f = f } func g(f: Int = k) { } let i = g class k { func l((Any, k))(m } } func j e = { { l) { m } } protocol k { class func j() } class e: k{ class func j struct c { var b: [c] { return [] } protocol a { class func c() } class b: a { class func c() { } } (b() as a).dynamicType.c() func f(b: T) { } f(true as Boolean) func a(x: Any, y: Any) -> (((Any, Any) -> Any) -> A var d: b.Type func e() { d.e() } } b protocol c : b { func b otocol A { E == F>(f: B) } struct } } struct c { var b: d } func a() -> [c] { return [] } 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 func a(b: Int = 0) { } let c = a c() var f = 1 var e: Int -> Int = { return $0 } let d: Int = { c, b in }(f, e) func m() -> (u, u -> u) -> u { p o p.s = { } { u) { o } } s m { class func s() } class p: m{ class 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) - 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 struct c == d.Iterator.Element> 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 class k: d { var f: g init(f: g) { self.f = f l. d { typealias i = l typealias j = j, i> } class j { typealias d = d struct A { let a: [(T, () -> ())] = [] } func b d { class d:b class b class A { } func c() -> (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 func m(c: b) -> (() -> h) -> b { f) -> j) -> > j { l i !(k) } d l) func d-> (m, m - 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 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 func k : r { func j(j: j.n) { } } enum q { let k: v let u: v.l } protocol y { o= p>(r: m) } struct D : y { s p = Int func y { w (()-> d) -> f func a(x: Any, y: Any) -> (((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))) protocol f : f { } func h() -> (g, g -> g) -> g class A n = { return $u } l o: n = { (d: n, o: n -> n) -> n q return o(d) } import Foundation class m: NSObject { var h: j g -> k = l $n } b f: _ = j() { } } func k (() -> i) -> b { n { o f "\(k): \(o())" } } struct d { } protocol b { typealias d typealias e } struct c : b { typealias d = h typealias e = a, d> } 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 struct l { l g: e } func h() -> [l] { f [] } func i(e: g) -> (() -> j) -> k struct c { let d: [( h } func b(g: f) -> (()-> e) -> i 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() { enum b { case c } } o class w: c { init(g: r) { n.g = g s.init() (t: o struct t : o { p v = t } q t { c(d ()) } func b(e)-> (() -> d) func f(b: T) { } f(true as Boolean) class A: A { } class B : C { } typealias C = B protocol A { typealias E } struct B() {f { class func i() } class d: f{ class func i {} func f() { ({}) } func prefix(with: String) -> (() -> T) -> String { return { g in "\(with): \(g())" } } protocol a : a { } 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 w class x: d { l i: u init(i: u) { o.i = j { r { w s "\(f): \(w())" } } protoc protocol f : b { func b () { g g h g } } func e(i: d) -> (() -> f)> import Foundation class k: NSObject { d e: f g(e: f) { j h.g() } } d protocol i : d { func d i b protocol d : b { func b func d(e: = { (g: h, f: h -> h) -> h in return f(g) } } } class b i: g{ func c {} e g { : g { h func i() -> } struct j { k b: l } func a() -> [j] { return [] } f k) func f() -> (l, l -> l) -> l { l j l.n = { } { l) { n } } protocol f { class func n() } class l: f{ class func n {} func a() { b b { l j } } class a { } protocol b { typealias l typealias k } struct j : b { typealias l = n typealias k = a, l> } protocol a { typealias d typealias e = d typealias f = d } class b : a { } class b { } protocol c { typealias g } a=1 as a=1 enum S { case C(T, () -> ()) } 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() -> (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()