forked from swiftlang/swift
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathverify-parse.swift
49 lines (37 loc) · 866 Bytes
/
verify-parse.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
// RUN: %target-run-simple-swift(-enable-experimental-feature SwiftParser -enable-experimental-feature ParserASTGen)
// RUN: %target-run-simple-swift(-enable-experimental-feature ASTGenTypes)
// REQUIRES: executable_test
// -enable-experimental-feature requires an asserts build
// REQUIRES: asserts
func test1(x: Int, fn: (Int) -> Int) -> Int {
let xx = fn(42)
return fn(x)
}
func test2(b: Bool) {
if b {
print("TRUE")
} else {
print("FALSE")
}
let x = true
}
func test3(y: Int) -> Int {
let x = y
return x
}
func test4(_ b: [Bool]) -> Int {
if b.isEmpty { 0 } else { 1 }
}
func test5(_ b: Swift.Bool) -> Int {
return if b { 0 } else { 1 }
}
func test6(_ b: Bool) -> Int {
let x = if b { 0 } else { 1 }
return x
}
func test7(_ b: inout Bool) {
// b = true
}
func test8(_ i: _const Int) {
}
func test9(_ value: Any) { }