forked from swiftlang/swift
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathidentifierName.swift
88 lines (77 loc) · 2.2 KB
/
identifierName.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
// RUN: %target-typecheck-verify-swift
// Ensure that the identifiers in compilation conditions don't reference
// any decls in the scope.
func f2(
FOO: Int,
swift: Int, _compiler_version: Int,
os: Int, arch: Int, _endian: Int, _runtime: Int,
targetEnvironment: Int,
arm: Int, i386: Int, macOS: Int, OSX: Int, Linux: Int,
big: Int, little: Int,
_ObjC: Int, _Native: Int,
simulator: Int
) {
#if FOO
_ = FOO
#elseif os(macOS) && os(OSX) && os(Linux)
_ = os + macOS + OSX + Linux
#elseif arch(i386) && arch(arm)
_ = arch + i386 + arm
#elseif _endian(big) && _endian(little)
_ = _endian + big + little
#elseif _runtime(_ObjC) && _runtime(_Native)
_ = _runtime + _ObjC + _Native
#elseif targetEnvironment(simulator)
_ = targetEnvironment + simulator
#elseif swift(>=1.0) && _compiler_version("4.*.0")
_ = swift + _compiler_version
#endif
}
func f2() {
let
FOO = 1, swift = 1, _compiler_version = 1,
os = 1, arch = 1, _endian = 1, _runtime = 1,
targetEnvironment = 1,
arm = 1, i386 = 1, macOS = 1, OSX = 1, Linux = 1,
big = 1, little = 1,
_ObjC = 1, _Native = 1,
simulator = 1
#if FOO
_ = FOO
#elseif os(macOS) && os(OSX) && os(Linux)
_ = os + macOS + OSX + Linux
#elseif arch(i386) && arch(arm)
_ = arch + i386 + arm
#elseif _endian(big) && _endian(little)
_ = _endian + big + little
#elseif _runtime(_ObjC) && _runtime(_Native)
_ = _runtime + _ObjC + _Native
#elseif targetEnvironment(simulator)
_ = targetEnvironment + simulator
#elseif swift(>=1.0) && _compiler_version("4.*.0")
_ = swift + _compiler_version
#endif
}
struct S {
let
FOO = 1, swift = 1, _compiler_version = 1,
os = 1, arch = 1, _endian = 1, _runtime = 1,
targetEnvironment = 1,
arm = 1, i386 = 1, macOS = 1, OSX = 1, Linux = 1,
big = 1, little = 1,
_ObjC = 1, _Native = 1,
simulator = 1
#if FOO
#elseif os(macOS) && os(OSX) && os(Linux)
#elseif arch(i386) && arch(arm)
#elseif _endian(big) && _endian(little)
#elseif _runtime(_ObjC) && _runtime(_Native)
#elseif targetEnvironment(simulator)
#elseif swift(>=1.0) && _compiler_version("4.*.0")
#endif
}
/// Ensure 'variable used within its own initial value' not to be emitted.
let BAR = { () -> Void in
#if BAR
#endif
}