mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
171 lines
2.8 KiB
Swift
171 lines
2.8 KiB
Swift
// This source file is part of the Swift.org open source project
|
|
// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
|
|
// Licensed under Apache License v2.0 with Runtime Library Exception
|
|
//
|
|
// See http://swift.org/LICENSE.txt for license information
|
|
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
|
|
|
|
// RUN: not %target-swift-frontend %s -parse
|
|
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 i(c: () -> ()) {
|
|
}
|
|
class a {
|
|
var _ = i() {
|
|
}
|
|
}
|
|
func ^(a: Boolean, Bool) -> Bool {
|
|
return !(a)
|
|
}
|
|
({})
|
|
struct A<T> {
|
|
let a: [(T, () -> ())] = []
|
|
}
|
|
var f = 1
|
|
var e: Int -> Int = {
|
|
return $0
|
|
}
|
|
let d: Int = { c, b in
|
|
}(f, e)
|
|
d ""
|
|
e}
|
|
class d {
|
|
func b((Any, d)typealias b = b
|
|
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 a : a {
|
|
}
|
|
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.f == c> (c: h) {
|
|
}
|
|
i(e())
|
|
class a<f : g, g : g where f.f == g> {
|
|
}
|
|
protocol g {
|
|
typealias f
|
|
typealias e
|
|
}
|
|
struct c<h : g> : g {
|
|
typealias f = h
|
|
typealias e = a<c<h>, f>
|
|
({})
|
|
func prefix(with: String) -> <T>(() -> T) -> String { func b
|
|
clanType, Bool) -> Bool {
|
|
)
|
|
}
|
|
strs d
|
|
typealias b> : b {
|
|
typealias d = h
|
|
typealias e = a<c<h>, d>
|
|
}
|
|
class a<f : b, g : b where f.d == g> {
|
|
}
|
|
protocol b {
|
|
typealias d
|
|
typealias e
|
|
}
|
|
struct c<h : b> : b {
|
|
typealias d = h
|
|
typealias e = a<c<h>, d>
|
|
}
|
|
func prefi(with: String-> <T>() -> T)t
|
|
protocol l : p {
|
|
}
|
|
protocol m {
|
|
j f = p
|
|
}
|
|
f m : m {
|
|
j f = o
|
|
}
|
|
func i<o : o, m : m n m.f == o> (l: m) {
|
|
}
|
|
k: m
|
|
}
|
|
func p<m>() -> [l<m>] {
|
|
return []
|
|
}
|
|
f
|
|
m)
|
|
func f<o>() -> (o, o -> o) -> o {
|
|
m o m.i = {
|
|
}
|
|
{
|
|
o) {
|
|
p }
|
|
}
|
|
protocol f {
|
|
class func i()
|
|
}
|
|
class m: f{ class func i {}
|
|
protocol p {
|
|
class func l()
|
|
}
|
|
class o: p {
|
|
class func l() { }
|
|
struct A<T> {
|
|
let a: [(T, () -> ())] = []
|
|
}
|
|
f
|
|
e)
|
|
func f<g>() -> (g, g -> g) -> g {
|
|
d j d.i 1, a(2, 3)))
|
|
class a {
|
|
typealias ((t, t) -> t) -> t)) -> t {
|
|
return r({
|
|
return k
|
|
})
|
|
() {
|
|
g g h g
|
|
}
|
|
}
|
|
func e(i: d) -> <f>(() -> f)>
|
|
func m(c: b) -> <h>(() -> h) -> b {
|
|
f) -> j) -> > j {
|
|
l i !(k)
|
|
}
|
|
d
|
|
l)
|
|
func d<m>-> (m, m -
|
|
struct c<d, e: b where d.c ==e>
|
|
var x1 =I Bool !(a)
|
|
}
|
|
func prefix(with: Strin) -> <T>(() -> T) in
|
|
// Distributed under the terms oclass a {
|
|
typealias b = b
|
|
func b((Any, e))(e: (Any) -> <d>(()-> d) -> f
|
|
func f() {
|
|
({})
|
|
}
|