-
Notifications
You must be signed in to change notification settings - Fork 10.4k
/
Copy pathtypes.swift
93 lines (72 loc) · 2.34 KB
/
types.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
// RUN: %empty-directory(%t)
// RUN: %target-swift-frontend-dump-parse -enable-experimental-feature ParserASTGen \
// RUN: -enable-experimental-feature NamedOpaqueTypes \
// RUN: -enable-experimental-feature InlineArrayTypeSugar \
// RUN: | %sanitize-address > %t/astgen.ast
// RUN: %target-swift-frontend-dump-parse \
// RUN: -enable-experimental-feature NamedOpaqueTypes \
// RUN: -enable-experimental-feature InlineArrayTypeSugar \
// RUN: | %sanitize-address > %t/cpp-parser.ast
// RUN: %diff -u %t/astgen.ast %t/cpp-parser.ast
// RUN: %target-typecheck-verify-swift -enable-experimental-feature ParserASTGen \
// RUN: -enable-experimental-feature NamedOpaqueTypes \
// RUN: -enable-experimental-feature InlineArrayTypeSugar
// REQUIRES: swift_feature_ParserASTGen
// REQUIRES: swift_feature_NamedOpaqueTypes
// REQUIRES: swift_feature_InlineArrayTypeSugar
// rdar://116686158
// UNSUPPORTED: asan
protocol P { }
protocol Q { }
typealias PQ = P & Q
func test7(_ b: inout Bool) {
b = true
}
struct X { struct `Protocol` { } }
func test10(_: X.`Protocol`) { }
func test11(_: Int...) { }
func test11a() {
test11(1, 2, 3, 4, 5)
}
typealias VAFunc = (Int, Int...) -> Int
func testVAFunc(a: Int, f: VAFunc) {
_ = f(a, a, a, a, a)
}
func test12(_ producer: @escaping @autoclosure () -> Int) {
_ = producer()
}
func test12a(i: Int) {
test12(i)
}
func test13(body: (_ value: Int) -> Void, i: Int) {
body(i)
}
func test14() {
_ = Array<Array<Array<Int>>>().count
}
func testRepeatEach<each T>(_ t: repeat each T) -> (repeat each T) {
fatalError()
}
struct FileDescriptor: ~Copyable {
var fd = 1
}
// FIXME: warning for 'class'
protocol ClassOnly: class {}
actor SomeActor { }
@globalActor
struct SomeGlobalActor {
static let shared = SomeActor()
}
typealias SomeGlobalActorIsolated = @SomeGlobalActor () -> Void
typealias TestSpecifiers<Value, Result, E> = (inout sending Value) throws(E) -> sending Result where Value: ~Copyable, Result: ~Copyable, E: Error
typealias TestSpecifierAndAttr<T> = (__owned @Sendable @escaping () async -> T) -> T
let globalOptionalInt: _? = 42
let optionalIntArray: Array<_> = [42]
@available(SwiftStdlib 9999, *)
func testInlineArray() {
let _: [3 x Int] = [1, 2, 3]
let _: [_ x _] = [1, 2]
let _ = [3 x Int](repeating: 0)
let _ = [3 x _](repeating: 0)
}
func testNamedOpaqueReturnTy() -> <T> T { return () }