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