Skip to content

Commit 01e3bd0

Browse files
committed
[AST] Disconnect @execution(...) attribute from the feature flag
The attribute has to be available without feature flag on so that it could be adopted preemptively, before the behavior change.
1 parent d620886 commit 01e3bd0

File tree

4 files changed

+5
-37
lines changed

4 files changed

+5
-37
lines changed

include/swift/AST/DeclAttr.def

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,6 @@ DECL_ATTR_FEATURE_REQUIREMENT(ABI, ABIAttribute)
545545
DECL_ATTR(execution, Execution,
546546
OnFunc | ABIBreakingToAdd | ABIBreakingToRemove | APIBreakingToAdd | APIBreakingToRemove,
547547
166)
548-
DECL_ATTR_FEATURE_REQUIREMENT(Execution, NonIsolatedAsyncInheritsIsolationFromContext)
549548

550549
LAST_DECL_ATTR(Execution)
551550

test/IDE/complete_decl_attribute.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,7 @@ struct _S {
251251
// ON_METHOD-DAG: Keyword/None: preconcurrency[#Func Attribute#]; name=preconcurrency
252252
// ON_METHOD-DAG: Keyword/None: backDeployed[#Func Attribute#]; name=backDeployed
253253
// ON_METHOD-DAG: Keyword/None: lifetime[#Func Attribute#]; name=lifetime
254+
// ON_METHOD-DAG: Keyword/None: execution[#Func Attribute#]; name=execution
254255
// ON_METHOD-NOT: Keyword
255256
// ON_METHOD-DAG: Decl[Struct]/CurrModule: MyStruct[#MyStruct#]; name=MyStruct
256257
// ON_METHOD-DAG: Decl[Struct]/CurrModule: MyPropertyWrapper[#Property Wrapper#]; name=MyPropertyWrapper
@@ -325,6 +326,7 @@ struct _S {
325326
// ON_MEMBER_LAST-DAG: Keyword/None: freestanding[#Declaration Attribute#]; name=freestanding
326327
// ON_MEMBER_LAST-DAG: Keyword/None: storageRestrictions[#Declaration Attribute#]; name=storageRestrictions
327328
// ON_MEMBER_LAST-DAG: Keyword/None: lifetime[#Declaration Attribute#]; name=lifetime
329+
// ON_MEMBER_LAST-DAG: Keyword/None: execution[#Declaration Attribute#]; name=execution
328330
// ON_MEMBER_LAST-NOT: Keyword
329331
// ON_MEMBER_LAST-DAG: Decl[Struct]/CurrModule: MyStruct[#MyStruct#]; name=MyStruct
330332
// ON_MEMBER_LAST-DAG: Decl[Struct]/CurrModule/TypeRelation[Convertible]: MyPropertyWrapper[#Property Wrapper#]; name=MyPropertyWrapper
@@ -397,6 +399,7 @@ func dummy2() {}
397399
// KEYWORD_LAST-DAG: Keyword/None: attached[#Declaration Attribute#]; name=attached
398400
// KEYWORD_LAST-DAG: Keyword/None: storageRestrictions[#Declaration Attribute#]; name=storageRestrictions
399401
// KEYWORD_LAST-DAG: Keyword/None: lifetime[#Declaration Attribute#]; name=lifetime
402+
// KEYWORD_LAST-DAG: Keyword/None: execution[#Declaration Attribute#]; name=execution
400403
// KEYWORD_LAST-NOT: Keyword
401404
// KEYWORD_LAST-DAG: Decl[Struct]/CurrModule: MyStruct[#MyStruct#]; name=MyStruct
402405
// KEYWORD_LAST-DAG: Decl[Struct]/CurrModule/TypeRelation[Convertible]: MyGenericPropertyWrapper[#Property Wrapper#]; name=MyGenericPropertyWrapper

test/IDE/complete_decl_attribute_feature_requirement.swift

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77

88
// RUN: %batch-code-completion -filecheck-additional-suffix _DISABLED
99
// RUN: %batch-code-completion -filecheck-additional-suffix _ENABLED \
10-
// RUN: -enable-experimental-feature ABIAttribute \
11-
// RUN: -enable-experimental-feature NonIsolatedAsyncInheritsIsolationFromContext
10+
// RUN: -enable-experimental-feature ABIAttribute
1211

1312
// NOTE: Please do not include the ", N items" after "Begin completions". The
1413
// item count creates needless merge conflicts given that an "End completions"
@@ -18,18 +17,14 @@
1817

1918
// KEYWORD2: Begin completions
2019
// KEYWORD2_ENABLED-DAG: Keyword/None: abi[#Func Attribute#]; name=abi
21-
// KEYWORD2_ENABLED-DAG: Keyword/None: execution[#Func Attribute#]; name=execution
2220
// KEYWORD2_DISABLED-NOT: Keyword/None: abi[#{{.*}} Attribute#]; name=abi
23-
// KEYWORD2_DISABLED-NOT: Keyword/None: execution[#{{.*}} Attribute#]; name=execution
2421
// KEYWORD2: End completions
2522

2623
@#^KEYWORD3^# class C {}
2724

2825
// KEYWORD3: Begin completions
2926
// KEYWORD3_ENABLED-NOT: Keyword/None: abi[#{{.*}} Attribute#]; name=abi
30-
// KEYWORD3_ENABLED-NOT: Keyword/None: execution[#{{.*}} Attribute#]; name=execution
3127
// KEYWORD3_DISABLED-NOT: Keyword/None: abi[#{{.*}} Attribute#]; name=abi
32-
// KEYWORD3_DISABLED-NOT: Keyword/None: execution[#{{.*}} Attribute#]; name=execution
3328
// KEYWORD3: End completions
3429

3530
@#^KEYWORD3_2?check=KEYWORD3^#IB class C2 {}
@@ -38,60 +33,46 @@
3833
@#^KEYWORD4^# enum E {}
3934
// KEYWORD4: Begin completions
4035
// KEYWORD4_ENABLED-NOT: Keyword/None: abi[#{{.*}} Attribute#]; name=abi
41-
// KEYWORD4_ENABLED-NOT: Keyword/None: execution[#{{.*}} Attribute#]; name=execution
4236
// KEYWORD4_DISABLED-NOT: Keyword/None: abi[#{{.*}} Attribute#]; name=abi
43-
// KEYWORD4_DISABLED-NOT: Keyword/None: execution[#{{.*}} Attribute#]; name=execution
4437
// KEYWORD4: End completions
4538

4639
@#^KEYWORD5^# struct S{}
4740
// KEYWORD5: Begin completions
4841
// KEYWORD5_ENABLED-NOT: Keyword/None: abi[#{{.*}} Attribute#]; name=abi
49-
// KEYWORD5_ENABLED-NOT: Keyword/None: execution[#{{.*}} Attribute#]; name=execution
5042
// KEYWORD5_DISABLED-NOT: Keyword/None: abi[#{{.*}} Attribute#]; name=abi
51-
// KEYWORD5_DISABLED-NOT: Keyword/None: execution[#{{.*}} Attribute#]; name=execution
5243
// KEYWORD5: End completions
5344

5445
@#^ON_GLOBALVAR^# var globalVar
5546
// ON_GLOBALVAR: Begin completions
5647
// ON_GLOBALVAR_ENABLED-DAG: Keyword/None: abi[#Var Attribute#]; name=abi
57-
// ON_GLOBALVAR_ENABLED-NOT: Keyword/None: execution[#{{.*}} Attribute#]; name=execution
5848
// ON_GLOBALVAR_DISABLED-NOT: Keyword/None: abi[#{{.*}} Attribute#]; name=abi
59-
// ON_GLOBALVAR_DISABLED-NOT: Keyword/None: execution[#{{.*}} Attribute#]; name=execution
6049
// ON_GLOBALVAR: End completions
6150

6251
struct _S {
6352
@#^ON_INIT^# init()
6453
// ON_INIT: Begin completions
6554
// ON_INIT_ENABLED-DAG: Keyword/None: abi[#Constructor Attribute#]; name=abi
66-
// ON_INIT_ENABLED-NOT: Keyword/None: execution[#{{.*}} Attribute#]; name=execution
6755
// ON_INIT_DISABLED-NOT: Keyword/None: abi[#{{.*}} Attribute#]; name=abi
68-
// ON_INIT_DISABLED-NOT: Keyword/None: execution[#{{.*}} Attribute#]; name=execution
6956
// ON_INIT: End completions
7057

7158
@#^ON_PROPERTY^# var foo
7259
// ON_PROPERTY: Begin completions
7360
// ON_PROPERTY_ENABLED-DAG: Keyword/None: abi[#Var Attribute#]; name=abi
74-
// ON_PROPERTY_ENABLED-NOT: Keyword/None: execution[#{{.*}} Attribute#]; name=execution
7561
// ON_PROPERTY_DISABLED-NOT: Keyword/None: abi[#{{.*}} Attribute#]; name=abi
76-
// ON_PROPERTY_DISABLED-NOT: Keyword/None: execution[#{{.*}} Attribute#]; name=execution
7762
// ON_PROPERTY: End completions
7863

7964
@#^ON_METHOD^# private
8065
func foo()
8166
// ON_METHOD: Begin completions
8267
// ON_METHOD_ENABLED-DAG: Keyword/None: abi[#Func Attribute#]; name=abi
83-
// ON_METHOD_ENABLED-DAG: Keyword/None: execution[#Func Attribute#]; name=execution
8468
// ON_METHOD_DISABLED-NOT: Keyword/None: abi[#{{.*}} Attribute#]; name=abi
85-
// ON_METHOD_DISABLED-NOT: Keyword/None: execution[#{{.*}} Attribute#]; name=execution
8669
// ON_METHOD: End completions
8770

8871

8972
func bar(@#^ON_PARAM_1?check=ON_PARAM^#)
9073
// ON_PARAM: Begin completions
9174
// ON_PARAM_ENABLED-NOT: Keyword/None: abi[#{{.*}} Attribute#]; name=abi
92-
// ON_PARAM_ENABLED-NOT: Keyword/None: execution[#{{.*}} Attribute#]; name=execution
9375
// ON_PARAM_DISABLED-NOT: Keyword/None: abi[#{{.*}} Attribute#]; name=abi
94-
// ON_PARAM_DISABLED-NOT: Keyword/None: execution[#{{.*}} Attribute#]; name=execution
9576
// ON_PARAM: End completions
9677

9778
func bar(
@@ -114,9 +95,7 @@ struct _S {
11495
@#^ON_MEMBER_LAST^#
11596
// ON_MEMBER_LAST: Begin completions
11697
// ON_MEMBER_LAST_ENABLED-DAG: Keyword/None: abi[#Declaration Attribute#]; name=abi
117-
// ON_MEMBER_LAST_ENABLED-DAG: Keyword/None: execution[#Declaration Attribute#]; name=execution
11898
// ON_MEMBER_LAST_DISABLED-NOT: Keyword/None: abi[#{{.*}} Attribute#]; name=abi
119-
// ON_MEMBER_LAST_DISABLED-NOT: Keyword/None: execution[#{{.*}} Attribute#]; name=execution
12099
// ON_MEMBER_LAST: End completions
121100
}
122101

@@ -128,9 +107,7 @@ func takeClosure(_: () -> Void) {
128107
// IN_CLOSURE: Begin completions
129108
// FIXME: Not valid in this position (but CompletionLookup can't tell that)
130109
// IN_CLOSURE_ENABLED-DAG: Keyword/None: abi[#Declaration Attribute#]; name=abi
131-
// IN_CLOSURE_ENABLED-DAG: Keyword/None: execution[#Declaration Attribute#]; name=execution
132110
// IN_CLOSURE_DISABLED-NOT: Keyword/None: abi[#{{.*}} Attribute#]; name=abi
133-
// IN_CLOSURE_DISABLED-NOT: Keyword/None: execution[#{{.*}} Attribute#]; name=execution
134111
// IN_CLOSURE: End completions
135112

136113
@#^KEYWORD_INDEPENDENT_1?check=KEYWORD_LAST^#
@@ -146,7 +123,5 @@ func dummy2() {}
146123

147124
// KEYWORD_LAST: Begin completions
148125
// KEYWORD_LAST_ENABLED-DAG: Keyword/None: abi[#Declaration Attribute#]; name=abi
149-
// KEYWORD_LAST_ENABLED-DAG: Keyword/None: execution[#Declaration Attribute#]; name=execution
150126
// KEYWORD_LAST_DISABLED-NOT: Keyword/None: abi[#Declaration Attribute#]; name=abi
151-
// KEYWORD_LAST_DISABLED-NOT: Keyword/None: execution[#Declaration Attribute#]; name=execution
152127
// KEYWORD_LAST: End completions

test/attr/feature_requirement.swift

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// RUN: %target-typecheck-verify-swift -parse-as-library -disable-experimental-parser-round-trip -verify-additional-prefix disabled-
2-
// RUN: %target-typecheck-verify-swift -parse-as-library -verify-additional-prefix enabled- -enable-experimental-feature ABIAttribute -enable-experimental-feature NonIsolatedAsyncInheritsIsolationFromContext
2+
// RUN: %target-typecheck-verify-swift -parse-as-library -verify-additional-prefix enabled- -enable-experimental-feature ABIAttribute
33

44
// REQUIRES: asserts
55

@@ -14,12 +14,3 @@ func fn() {} // expected-disabled-error@-1 {{'abi' attribute is only valid when
1414
#else
1515
#error("doesn't have @abi") // expected-disabled-error {{doesn't have @abi}}
1616
#endif
17-
18-
@execution(concurrent) func testExecutionAttr() async {}
19-
// expected-disabled-error@-1 {{'execution(concurrent)' attribute is only valid when experimental feature NonIsolatedAsyncInheritsIsolationFromContext is enabled}}
20-
21-
#if hasAttribute(execution)
22-
#error("does have @execution") // expected-enabled-error {{does have @execution}}
23-
#else
24-
#error("doesn't have @execution") // expected-disabled-error {{doesn't have @execution}}
25-
#endif

0 commit comments

Comments
 (0)