- Notifications
You must be signed in to change notification settings - Fork 10.5k
/
Copy pathfunction_skipping_source_location.swift
53 lines (45 loc) · 1.17 KB
/
function_skipping_source_location.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
// Note we use '--implicit-check-not' to ensure we exhaustively match errors.
// RUN: not %target-swift-frontend -parse -experimental-skip-all-function-bodies -diagnostic-style=llvm %s 2>&1 | %FileCheck --implicit-check-not='error:' %s
// We cannot skip function bodies with #sourceLocation.
func foo(){
// CHECK: [[@LINE+1]]:4: error: expected expression
[;
#sourceLocation(file: "A", line: 1)
[;
// CHECK: A:1:4: error: expected expression
}
func bar(){
// CHECK: A:7:4: error: expected expression
[;
#sourceLocation()
[;
// CHECK: [[@LINE-1]]:4: error: expected expression
}
// This function body is skipped.
func baz(){
[;
}
// This member list and function are not skipped.
structS{
func qux(){
// CHECK: [[@LINE+1]]:6: error: expected expression
[;
#sourceLocation(file: "B", line: 1)
[;
// CHECK: B:1:6: error: expected expression
}
func ;
// CHECK: B:4:8: error: expected identifier
}
// This member list is also not skipped.
structR{
// CHECK: B:11:8: error: expected identifier
func ;
#sourceLocation()
func ;
// CHECK: [[@LINE-1]]:8: error: expected identifier
}
// This member list is skipped.
structQ{
[;
}