Skip to content

Commit 91adec9

Browse files
committed
[AST] Demote @noescape and @async to SIL attributes
These aren't currently claimed by anything other than SILFunctions, and as such are invalid in regular Swift code. Treat them as SIL type attributes. Also while here, fix the SIL reference attributes to be SIL attributes.
1 parent b68ecdc commit 91adec9

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

include/swift/AST/TypeAttr.def

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,9 @@
5353
// Type attributes
5454
SIMPLE_TYPE_ATTR(autoclosure, Autoclosure)
5555
TYPE_ATTR(convention, Convention)
56-
SIMPLE_TYPE_ATTR(noescape, NoEscape)
5756
SIMPLE_TYPE_ATTR(escaping, Escaping)
5857
TYPE_ATTR(differentiable, Differentiable)
5958
SIMPLE_TYPE_ATTR(noDerivative, NoDerivative)
60-
SIMPLE_TYPE_ATTR(async, Async)
6159
SIMPLE_TYPE_ATTR(Sendable, Sendable)
6260
SIMPLE_TYPE_ATTR(retroactive, Retroactive)
6361
SIMPLE_TYPE_ATTR(unchecked, Unchecked)
@@ -68,10 +66,11 @@ TYPE_ATTR(_opaqueReturnTypeOf, OpaqueReturnTypeOf)
6866
TYPE_ATTR(isolated, Isolated)
6967

7068
// SIL-specific attributes
69+
SIMPLE_SIL_TYPE_ATTR(async, Async)
7170
SIMPLE_SIL_TYPE_ATTR(block_storage, BlockStorage)
7271
SIMPLE_SIL_TYPE_ATTR(box, Box)
7372
SIMPLE_SIL_TYPE_ATTR(dynamic_self, DynamicSelf)
74-
#define REF_STORAGE(Name, name, ...) SIMPLE_TYPE_ATTR(sil_##name, SIL##Name)
73+
#define REF_STORAGE(Name, name, ...) SIMPLE_SIL_TYPE_ATTR(sil_##name, SIL##Name)
7574
#include "swift/AST/ReferenceStorage.def"
7675
SIMPLE_SIL_TYPE_ATTR(error, Error)
7776
SIMPLE_SIL_TYPE_ATTR(error_indirect, ErrorIndirect)
@@ -83,6 +82,7 @@ SIMPLE_SIL_TYPE_ATTR(inout, Inout)
8382
SIMPLE_SIL_TYPE_ATTR(inout_aliasable, InoutAliasable)
8483
SIMPLE_SIL_TYPE_ATTR(in_guaranteed, InGuaranteed)
8584
SIMPLE_SIL_TYPE_ATTR(in_constant, InConstant)
85+
SIMPLE_SIL_TYPE_ATTR(noescape, NoEscape)
8686
SIMPLE_SIL_TYPE_ATTR(pack_owned, PackOwned)
8787
SIMPLE_SIL_TYPE_ATTR(pack_guaranteed, PackGuaranteed)
8888
SIMPLE_SIL_TYPE_ATTR(pack_inout, PackInout)

lib/Sema/TypeCheckType.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3116,7 +3116,6 @@ static bool isSILAttribute(TypeAttrKind attrKind) {
31163116
switch (attrKind) {
31173117
#define SIL_TYPE_ATTR(SPELLING, CLASS) case TypeAttrKind::CLASS:
31183118
#include "swift/AST/TypeAttr.def"
3119-
case TypeAttrKind::NoEscape: // noescape is only used in SIL now
31203119
return true;
31213120

31223121
default:

0 commit comments

Comments
 (0)