| // 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 f<g>() -> (g, g -> g) -> g { |
| d j d.i = { |
| } |
| { |
| g) { |
| h } |
| } |
| protocol f { |
| } |
| class d: f{ class func i {} |
| func a(b: Int = 0) { |
| } |
| let c = a |
| func some<S: Sequence, T where Optional<T> == S.Iterator.Element>(xs : S) -> T? { |
| for (mx : T?) in xs { |
| if let x = mx { |
| } |
| } |
| } |
| protocol a : a { |
| } |
| protocol a { |
| } |
| class b: a { |
| } |
| struct d<f : e, g: e where g.h == f.h> { |
| } |
| protocol e { |
| } |
| protocol A { |
| } |
| struct B<T : A> { |
| } |
| protocol C { |
| } |
| struct D : C { |
| func g<T where T.E == F>(f: B<T>) { |
| } |
| } |
| func ^(a: Boolean, Bool) -> Bool { |
| } |
| protocol A { |
| } |
| struct B : A { |
| } |
| struct C<D, E: A where D.C == E> { |
| } |
| func a(x: Any, y: Any) -> (((Any, Any) -> Any) -> Any) { |
| return { |
| } |
| class a { |
| } |
| class c { |
| func b((Any, c))(a: (Any, AnyObject)) { |
| } |
| } |
| func f() { |
| } |
| class A: A { |
| } |
| class B : C { |
| } |
| protocol A { |
| } |
| class C<D> { |
| init <A: A where A.B == D>(e: A.B) { |
| } |
| } |
| func i(c: () -> ()) { |
| } |
| class a { |
| var _ = i() { |
| } |
| } |
| protocol A { |
| } |
| class B { |
| func d() -> String { |
| } |
| } |
| class C: B, A { |
| override func d() -> String { |
| } |
| func c() -> String { |
| } |
| } |
| func e<T where T: A, T: B>(t: T) { |
| } |
| protocol A { |
| } |
| struct X<Y> : A { |
| func b(b: X.Type) { |
| } |
| } |
| var f1: Int -> Int = { |
| } |
| let succeeds: Int = { (x: Int, f: Int -> Int) -> Int in |
| }(x1, f1) |
| let crashes: Int = { x, f in |
| }(x1, f1) |
| func c<d { |
| enum c { |
| } |
| } |
| protocol b { |
| } |
| struct c { |
| func e() { |
| } |
| struct c<d : Sequence> { |
| } |
| func a<d>() -> [c<d>] { |
| } |
| func a(b: Int = 0) { |
| } |
| func c<d { |
| enum c { |
| } |
| } |
| func ^(a: Boolean, Bool) -> Bool { |
| } |
| protocol a { |
| for (mx : T?) in xs { |
| rth): \(g())" } |
| } |
| func a<T>() { |
| enum b { |
| } |
| } |
| } |
| } |
| struct e : d { |
| } |
| func i<j : b, k : d where k.f == j> (n: k) { |
| } |
| func i<l : d where l.f == c> (n: l) { |
| } |
| protocol b { |
| } |
| struct c { |
| func e() { |
| } |
| } |
| enum S<T> { |
| } |
| struct c<d : Sequence> { |
| } |
| func a<d>() -> [c<d>] { |