mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
121 lines
1.9 KiB
Swift
121 lines
1.9 KiB
Swift
// 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
|
|
import Foundation
|
|
class m<j>: NSObject {
|
|
var h: j
|
|
g -> k = l $n
|
|
}
|
|
b f: _ = j() {
|
|
}
|
|
}
|
|
func k<g {
|
|
enum k {
|
|
func l
|
|
var _ = l
|
|
func d(b: String-> <c>() -> 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 b<d {
|
|
enum b {
|
|
func c
|
|
var _ = c
|
|
}
|
|
}
|
|
func k<q {
|
|
enum k {
|
|
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>
|
|
}
|
|
class f class func i {}
|
|
func n<j>() -> (j, j -> j) -> j {
|
|
var m: ((j> j)!
|
|
f m
|
|
}
|
|
protocol k {
|
|
typealias m
|
|
}
|
|
struct e<j : k> {n: j
|
|
let i: j.m
|
|
}
|
|
l
|
|
protocol 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) {
|
|
t.c()
|
|
}
|
|
func a<T>() {
|
|
enum b {
|
|
case c
|
|
}
|
|
}
|
|
>)
|
|
}
|
|
struct n : C {
|
|
class p {
|
|
typealias n = ss l: j{ k() -> ())
|
|
}
|
|
({})
|
|
func j<o : Boolean>(l: o) {
|
|
}
|
|
j(j q Boolean)
|
|
h }
|
|
}
|
|
protoco c() -> i) -> b {
|
|
n { o f "\(k): \(o())" }
|
|
}
|
|
struct d<d : n, o:j n {
|
|
l p
|
|
}
|
|
protocol o -> 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)))
|