|
| 1 | +// This contains code completion test cases for features covered by experimental |
| 2 | +// feature flags, and tests both the case when the feature is disabled and when |
| 3 | +// it's enabled. When a feature becomes non-experimental, move its test cases |
| 4 | +// into the normal complete_decl_attribute.swift test file. |
| 5 | + |
| 6 | +// REQUIRES: asserts |
| 7 | + |
| 8 | +// RUN: %batch-code-completion -filecheck-additional-suffix _DISABLED |
| 9 | +// RUN: %batch-code-completion -filecheck-additional-suffix _ENABLED -enable-experimental-feature ABIAttribute |
| 10 | + |
| 11 | +// NOTE: Please do not include the ", N items" after "Begin completions". The |
| 12 | +// item count creates needless merge conflicts given that an "End completions" |
| 13 | +// line exists for each test. |
| 14 | + |
| 15 | +@#^KEYWORD2^# func method(){} |
| 16 | + |
| 17 | +// KEYWORD2: Begin completions |
| 18 | +// KEYWORD2_ENABLED-DAG: Keyword/None: abi[#Func Attribute#]; name=abi |
| 19 | +// KEYWORD2_DISABLED-NOT: Keyword/None: abi[#{{.*}} Attribute#]; name=abi |
| 20 | +// KEYWORD2: End completions |
| 21 | + |
| 22 | +@#^KEYWORD3^# class C {} |
| 23 | + |
| 24 | +// KEYWORD3: Begin completions |
| 25 | +// KEYWORD3_ENABLED-NOT: Keyword/None: abi[#{{.*}} Attribute#]; name=abi |
| 26 | +// KEYWORD3_DISABLED-NOT: Keyword/None: abi[#{{.*}} Attribute#]; name=abi |
| 27 | +// KEYWORD3: End completions |
| 28 | + |
| 29 | +@#^KEYWORD3_2?check=KEYWORD3^#IB class C2 {} |
| 30 | +// Same as KEYWORD3. |
| 31 | + |
| 32 | +@#^KEYWORD4^# enum E {} |
| 33 | +// KEYWORD4: Begin completions |
| 34 | +// KEYWORD4_ENABLED-NOT: Keyword/None: abi[#{{.*}} Attribute#]; name=abi |
| 35 | +// KEYWORD4_DISABLED-NOT: Keyword/None: abi[#{{.*}} Attribute#]; name=abi |
| 36 | +// KEYWORD4: End completions |
| 37 | + |
| 38 | +@#^KEYWORD5^# struct S{} |
| 39 | +// KEYWORD5: Begin completions |
| 40 | +// KEYWORD5_ENABLED-NOT: Keyword/None: abi[#{{.*}} Attribute#]; name=abi |
| 41 | +// KEYWORD5_DISABLED-NOT: Keyword/None: abi[#{{.*}} Attribute#]; name=abi |
| 42 | +// KEYWORD5: End completions |
| 43 | + |
| 44 | +@#^ON_GLOBALVAR^# var globalVar |
| 45 | +// ON_GLOBALVAR: Begin completions |
| 46 | +// ON_GLOBALVAR_ENABLED-DAG: Keyword/None: abi[#Var Attribute#]; name=abi |
| 47 | +// ON_GLOBALVAR_DISABLED-NOT: Keyword/None: abi[#{{.*}} Attribute#]; name=abi |
| 48 | +// ON_GLOBALVAR: End completions |
| 49 | + |
| 50 | +struct _S { |
| 51 | + @#^ON_INIT^# init() |
| 52 | +// ON_INIT: Begin completions |
| 53 | +// ON_INIT_ENABLED-DAG: Keyword/None: abi[#Constructor Attribute#]; name=abi |
| 54 | +// ON_INIT_DISABLED-NOT: Keyword/None: abi[#{{.*}} Attribute#]; name=abi |
| 55 | +// ON_INIT: End completions |
| 56 | + |
| 57 | + @#^ON_PROPERTY^# var foo |
| 58 | +// ON_PROPERTY: Begin completions |
| 59 | +// ON_PROPERTY_ENABLED-DAG: Keyword/None: abi[#Var Attribute#]; name=abi |
| 60 | +// ON_PROPERTY_DISABLED-NOT: Keyword/None: abi[#{{.*}} Attribute#]; name=abi |
| 61 | +// ON_PROPERTY: End completions |
| 62 | + |
| 63 | + @#^ON_METHOD^# private |
| 64 | + func foo() |
| 65 | +// ON_METHOD: Begin completions |
| 66 | +// ON_METHOD_ENABLED-DAG: Keyword/None: abi[#Func Attribute#]; name=abi |
| 67 | +// ON_METHOD_DISABLED-NOT: Keyword/None: abi[#{{.*}} Attribute#]; name=abi |
| 68 | +// ON_METHOD: End completions |
| 69 | + |
| 70 | + |
| 71 | + func bar(@#^ON_PARAM_1?check=ON_PARAM^#) |
| 72 | +// ON_PARAM: Begin completions |
| 73 | +// ON_PARAM_ENABLED-NOT: Keyword/None: abi[#{{.*}} Attribute#]; name=abi |
| 74 | +// ON_PARAM_DISABLED-NOT: Keyword/None: abi[#{{.*}} Attribute#]; name=abi |
| 75 | +// ON_PARAM: End completions |
| 76 | + |
| 77 | + func bar( |
| 78 | + @#^ON_PARAM_2?check=ON_PARAM^# |
| 79 | + |
| 80 | + arg: Int |
| 81 | + ) |
| 82 | +// Same as ON_PARAM. |
| 83 | + |
| 84 | + @#^ON_MEMBER_INDEPENDENT_1?check=ON_MEMBER_LAST^# |
| 85 | + |
| 86 | + func dummy1() {} |
| 87 | +// Same as ON_MEMBER_LAST. |
| 88 | + |
| 89 | + @#^ON_MEMBER_INDEPENDENT_2?check=ON_MEMBER_LAST^# |
| 90 | + func dummy2() {} |
| 91 | +// Same as ON_MEMBER_LAST. |
| 92 | + |
| 93 | + |
| 94 | + @#^ON_MEMBER_LAST^# |
| 95 | +// ON_MEMBER_LAST: Begin completions |
| 96 | +// ON_MEMBER_LAST_ENABLED-DAG: Keyword/None: abi[#Declaration Attribute#]; name=abi |
| 97 | +// ON_MEMBER_LAST_DISABLED-NOT: Keyword/None: abi[#{{.*}} Attribute#]; name=abi |
| 98 | +// ON_MEMBER_LAST: End completions |
| 99 | +} |
| 100 | + |
| 101 | +func takeClosure(_: () -> Void) { |
| 102 | + takeClosure { @#^IN_CLOSURE^# in |
| 103 | + print("x") |
| 104 | + } |
| 105 | +} |
| 106 | +// IN_CLOSURE: Begin completions |
| 107 | +// FIXME: Not valid in this position (but CompletionLookup can't tell that) |
| 108 | +// IN_CLOSURE_ENABLED-DAG: Keyword/None: abi[#Declaration Attribute#]; name=abi |
| 109 | +// IN_CLOSURE_DISABLED-NOT: Keyword/None: abi[#{{.*}} Attribute#]; name=abi |
| 110 | +// IN_CLOSURE: End completions |
| 111 | + |
| 112 | +@#^KEYWORD_INDEPENDENT_1?check=KEYWORD_LAST^# |
| 113 | + |
| 114 | +func dummy1() {} |
| 115 | +// Same as KEYWORD_LAST. |
| 116 | + |
| 117 | +@#^KEYWORD_INDEPENDENT_2?check=KEYWORD_LAST^# |
| 118 | +func dummy2() {} |
| 119 | +// Same as KEYWORD_LAST. |
| 120 | + |
| 121 | +@#^KEYWORD_LAST^# |
| 122 | + |
| 123 | +// KEYWORD_LAST: Begin completions |
| 124 | +// KEYWORD_LAST_ENABLED-DAG: Keyword/None: abi[#Declaration Attribute#]; name=abi |
| 125 | +// KEYWORD_LAST_DISABLED-NOT: Keyword/None: abi[#Declaration Attribute#]; name=abi |
| 126 | +// KEYWORD_LAST: End completions |
0 commit comments