- Notifications
You must be signed in to change notification settings - Fork 10.5k
/
Copy pathcomplete_decl_attribute_feature_requirement.swift
136 lines (106 loc) · 5.39 KB
/
complete_decl_attribute_feature_requirement.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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
// This contains code completion test cases for features covered by experimental
// feature flags, and tests both the case when the feature is disabled and when
// it's enabled. When a feature becomes non-experimental, move its test cases
// into the normal complete_decl_attribute.swift test file.
// REQUIRES: asserts
// RUN: %batch-code-completion -filecheck-additional-suffix _DISABLED
// RUN: %batch-code-completion -filecheck-additional-suffix _ENABLED \
// RUN: -enable-experimental-feature ABIAttribute \
// RUN: -enable-experimental-feature ExtensibleAttribute
// NOTE: Please do not include the ", N items" after "Begin completions". The
// item count creates needless merge conflicts given that an "End completions"
// line exists for each test.
@#^KEYWORD2^# func method(){}
// KEYWORD2: Begin completions
// KEYWORD2_ENABLED-DAG: Keyword/None: abi[#Func Attribute#]; name=abi
// KEYWORD2_DISABLED-NOT: Keyword/None: abi[#{{.*}} Attribute#]; name=abi
// KEYWORD2: End completions
@#^KEYWORD3^# classC{}
// KEYWORD3: Begin completions
// KEYWORD3_ENABLED-NOT: Keyword/None: abi[#{{.*}} Attribute#]; name=abi
// KEYWORD3_DISABLED-NOT: Keyword/None: abi[#{{.*}} Attribute#]; name=abi
// KEYWORD3: End completions
@#^KEYWORD3_2?check=KEYWORD3^#IB classC2{}
// Same as KEYWORD3.
@#^KEYWORD4^# enumE{}
// KEYWORD4: Begin completions
// KEYWORD4_ENABLED-NOT: Keyword/None: abi[#{{.*}} Attribute#]; name=abi
// KEYWORD4_DISABLED-NOT: Keyword/None: abi[#{{.*}} Attribute#]; name=abi
// KEYWORD4_ENABLED-DAG: Keyword/None: extensible[#{{.*}} Attribute#]; name=extensible
// KEYWORD4_DISABLED-NOT: Keyword/None: extensible[#{{.*}} Attribute#]; name=extensible
// KEYWORD4: End completions
@#^KEYWORD5^# structS{}
// KEYWORD5: Begin completions
// KEYWORD5_ENABLED-NOT: Keyword/None: abi[#{{.*}} Attribute#]; name=abi
// KEYWORD5_DISABLED-NOT: Keyword/None: abi[#{{.*}} Attribute#]; name=abi
// KEYWORD5: End completions
@#^ON_GLOBALVAR^# varglobalVar
// ON_GLOBALVAR: Begin completions
// ON_GLOBALVAR_ENABLED-DAG: Keyword/None: abi[#Var Attribute#]; name=abi
// ON_GLOBALVAR_DISABLED-NOT: Keyword/None: abi[#{{.*}} Attribute#]; name=abi
// ON_GLOBALVAR: End completions
struct _S {
@#^ON_INIT^# init()
// ON_INIT: Begin completions
// ON_INIT_ENABLED-DAG: Keyword/None: abi[#Constructor Attribute#]; name=abi
// ON_INIT_DISABLED-NOT: Keyword/None: abi[#{{.*}} Attribute#]; name=abi
// ON_INIT: End completions
@#^ON_PROPERTY^# varfoo
// ON_PROPERTY: Begin completions
// ON_PROPERTY_ENABLED-DAG: Keyword/None: abi[#Var Attribute#]; name=abi
// ON_PROPERTY_DISABLED-NOT: Keyword/None: abi[#{{.*}} Attribute#]; name=abi
// ON_PROPERTY: End completions
@#^ON_SUBSCR^# subscript
// ON_SUBSCR: Begin completions
// ON_SUBSCR_ENABLED-DAG: Keyword/None: abi[#Declaration Attribute#]; name=abi
// ON_SUBSCR_DISABLED-NOT: Keyword/None: abi[#{{.*}} Attribute#]; name=abi
// ON_SUBSCR: End completions
@#^ON_METHOD^# private
func foo()
// ON_METHOD: Begin completions
// ON_METHOD_ENABLED-DAG: Keyword/None: abi[#Func Attribute#]; name=abi
// ON_METHOD_DISABLED-NOT: Keyword/None: abi[#{{.*}} Attribute#]; name=abi
// ON_METHOD: End completions
func bar(@#^ON_PARAM_1?check=ON_PARAM^#)
// ON_PARAM: Begin completions
// ON_PARAM_ENABLED-NOT: Keyword/None: abi[#{{.*}} Attribute#]; name=abi
// ON_PARAM_DISABLED-NOT: Keyword/None: abi[#{{.*}} Attribute#]; name=abi
// ON_PARAM: End completions
func bar(
@#^ON_PARAM_2?check=ON_PARAM^#
arg: Int
)
// Same as ON_PARAM.
@#^ON_MEMBER_INDEPENDENT_1?check=ON_MEMBER_LAST^#
func dummy1(){}
// Same as ON_MEMBER_LAST.
@#^ON_MEMBER_INDEPENDENT_2?check=ON_MEMBER_LAST^#
func dummy2(){}
// Same as ON_MEMBER_LAST.
@#^ON_MEMBER_LAST^#
// ON_MEMBER_LAST: Begin completions
// ON_MEMBER_LAST_ENABLED-DAG: Keyword/None: abi[#Declaration Attribute#]; name=abi
// ON_MEMBER_LAST_DISABLED-NOT: Keyword/None: abi[#{{.*}} Attribute#]; name=abi
// ON_MEMBER_LAST: End completions
}
func takeClosure(_:()->Void){
takeClosure{ @#^IN_CLOSURE^# in
print("x")
}
}
// IN_CLOSURE: Begin completions
// FIXME: Not valid in this position (but CompletionLookup can't tell that)
// IN_CLOSURE_ENABLED-DAG: Keyword/None: abi[#Declaration Attribute#]; name=abi
// IN_CLOSURE_DISABLED-NOT: Keyword/None: abi[#{{.*}} Attribute#]; name=abi
// IN_CLOSURE: End completions
@#^KEYWORD_INDEPENDENT_1?check=KEYWORD_LAST^#
func dummy1(){}
// Same as KEYWORD_LAST.
@#^KEYWORD_INDEPENDENT_2?check=KEYWORD_LAST^#
func dummy2(){}
// Same as KEYWORD_LAST.
@#^KEYWORD_LAST^#
// KEYWORD_LAST: Begin completions
// KEYWORD_LAST_ENABLED-DAG: Keyword/None: abi[#Declaration Attribute#]; name=abi
// KEYWORD_LAST_DISABLED-NOT: Keyword/None: abi[#Declaration Attribute#]; name=abi
// KEYWORD_LAST: End completions