// 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 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 ^(a: Boolean, Bool) -> Bool {
    return !(a)
}
func i(f: g) -> <j>(() -> j) -> g { func g
k, l {
    typealias l = m<k<m>, f>
}
protocol a : a {
}
func f<m>() -> (m, m -> m) -> m {
   e c e.i = { j func l()q c() -> 
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 d<c>: NSObject {
    var b: c
    init(b: c) {
       {
   class func i()
}
class d: f{  class func i {}
functh): \(g())" }
}
protocol a : a {
}
func j(d: h) -> <k>(() -> k) -> h {
  return { n n "\(}
c i<k : i> {
}
c i: i {
}
c e : l {
}
f = e
protocol m : o h = h
}
import Foundation
class m<j>k i<g : g, e : f k(f: l) {
}
i(())
class h {
    typealias g k{  class func q {}
func r<e: t, s where j<s> == e.m { func g
k q<n : t> {
    q g: n
}
func p<n>() -> [q<n>] {
    o : g.l) {
    }
}
class p {
    typealias g = g
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 {
}
strass l: j{  k() -> ())
}
({})
func j<o  E == F>(f: B<T>)
}
struct  }
}
