// 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
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 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) {
    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  for (mx : e?) in c {
    }
}
struct A<T> {
    let a: [(T, () -> ())] = []
}
)
func o<t>() -> (t, t -> t) -> t {
   j j j.o = {
}
 {
   t) {
        h  }
}
protocol o {
   class func o()
}
class j: o{  class func o {}
e o<j : u> {
    k []
}
n=p r n=p
func n<q>() {
    b b {
        o o
    }
}
func n(j: Any, t: Any) -> (((Any, Any) -> Any) -> Any) {
    k {
        (s: (Any, Any) -> Any) -> Any l
        k s(j, t)
    }
}
 
func b(s: (((Any, Any) -> Any) -> Any)
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  : A {
    func b(b: X.Type) {
    }
}
f> {
 c(d ())
}
func b(e)-> <d>(() -> d)
func m(c: b) -> <h>(() -> h) -> b {
  f) -> j) -> > j {
    l i !(k)
}
d
l)
func d<m>-> (m, m -
func b<e>(e : e) -> c {  e
func m<u>() -> (u, u - 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> {
class A: A {
}
class B : C {
}
typealias C = B
func i(c: () -> ()) {
}
class a {
    var _ = i() {
    }
}
 d)
func e(h: b) -> <f>(() -> f) -> b {
  return { c):h())" }
}
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 {
protocol a {
    class func c()
}
class b: a {
    class func c() { }
}
(b() as a).dynamicType.c()
func b((Any, e))(e: (Any) -> <d>(()-> d) -> f
func c<e>() -> (e -> e) -> e {
 e, e -> e) ->)func d(f: b) -> <e>(() -> e) -> == q.n> {
}
o l {
    u n
}
y q) -> ())
}
o n  ())
}
