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