| // 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 b { |
| class func e() |
| } |
| struct c { |
| var d: b.Type |
| func e() { |
| d.e() |
| } |
| } |
| import Foun { |
| 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 |
| 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> |
| } |
| } |
| class b<i : b> i: g{ func c {} |
| e g { |
| : g { |
| h func i() -> } |
| func b<e>(e : e) -> c { e |
| struct j<l : o> { |
| k b: l |
| } |
| func a<l>() -> [j<l>] { |
| return [] |
| } |
| f |
| k) |
| func f<l>() -> (l, l -> l) -> l { |
| l j l.n = { |
| } |
| { |
| l) { |
| n } |
| } |
| protocol f { |
| class func n() |
| } |
| class l: f{ class func n {} |
| func a<i>() { |
| b b { |
| l j |
| } |
| } |
| class a<f : b, l : b m f.l == l> { |
| } |
| protocol b { |
| typealias l |
| typealias k |
| } |
| struct j<n : b> : b { |
| typealias l = n |
| typealias k = a<j<n>, l> |
| } |
| protocol a { |
| class func c() |
| } |
| class b: a { |
| class func c() { } |
| } |
| (b() as a).dynamicType.c() |
| 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 f<m>() -> (m, m -> m) -> m { |
| e c e.i = { |
| }} |
| 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 |
| func a<T>() { |
| enum b { |
| case c |
| } |
| } |
| ) |
| 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) { |
| 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< |
| 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 m(c: b) -> <h>(() -> h) -> b { |
| f) -> j) -> > j { |
| l i !(k) |
| } |
| d |
| l) |
| func d<m>-> (m, m - |
| 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 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))) |
| func n<p>() -> (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() |