forked from swiftlang/swift
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbasicParseErrors.swift
63 lines (48 loc) · 1.27 KB
/
basicParseErrors.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
// RUN: %target-parse-verify-swift -D FOO -D BAZ
#if FOO == BAZ // expected-error{{expected '&&' or '||' expression}}
var x = 0
#endif
#if ^FOO // expected-error {{expected unary '!' expression}}
var y = 0
#endif
#if swift(FOO) // expected-error {{unexpected target configuration expression (expected 'os' or 'arch')}}
var z = 0
#endif
#if FOO || !FOO
func f() {}
#endif ; f() // expected-error {{extra tokens at the end of the build configuration directive}}
#if FOO || !FOO
func g() {}
#else g() // expected-error {{extra tokens at the end of the build configuration directive}}
#endif
#if FOO || !FOO
func h() {}
#else /* aaa */
#endif /* bbb */
#if foo.bar()
.baz() // expected-error {{unexpected target configuration expression (expected 'os' or 'arch')}}
#endif
struct S {
#if FOO
#else
#else // expected-error {{further conditions after #else are unreachable}}
#endif
#if FOO
#elseif BAR
#elseif BAZ
#else
#endif
}
#if FOO
#else
#else // expected-error {{further conditions after #else are unreachable}}
#endif
#if FOO
#elseif BAR
#elseif BAZ
#else
#endif
#if os(youOS) // expected-warning {{unknown operating system for build configuration 'os'}}
#endif
#if arch(leg) // expected-warning {{unknown architecture for build configuration 'arch'}}
#endif