Skip to content

Commit 430a0d8

Browse files
committed
[AST] Remove @escaping from decl attributes.
@escaping is not really a decl attribute, ever since it was introduced.
1 parent 21513b8 commit 430a0d8

File tree

5 files changed

+4
-18
lines changed

5 files changed

+4
-18
lines changed

include/swift/AST/Attr.def

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,8 +262,6 @@ SIMPLE_DECL_ATTR(discardableResult, DiscardableResult,
262262

263263
SIMPLE_DECL_ATTR(GKInspectable, GKInspectable, OnVar, 66)
264264

265-
SIMPLE_DECL_ATTR(escaping, Escaping, OnParam, 67)
266-
267265
#undef TYPE_ATTR
268266
#undef DECL_ATTR_ALIAS
269267
#undef SIMPLE_DECL_ATTR

lib/Sema/TypeCheckAttr.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -155,15 +155,6 @@ class AttributeEarlyChecker : public AttributeVisitor<AttributeEarlyChecker> {
155155
TC.checkNoEscapeAttr(cast<ParamDecl>(D), attr);
156156
}
157157

158-
void visitEscapingAttr(EscapingAttr *attr) {
159-
auto *PD = cast<ParamDecl>(D);
160-
auto *FTy = PD->getType()->getAs<FunctionType>();
161-
if (FTy == 0) {
162-
TC.diagnose(attr->getLocation(), diag::escaping_function_type);
163-
attr->setInvalid();
164-
}
165-
}
166-
167158
void visitTransparentAttr(TransparentAttr *attr);
168159
void visitMutationAttr(DeclAttribute *attr);
169160
void visitMutatingAttr(MutatingAttr *attr) { visitMutationAttr(attr); }
@@ -742,7 +733,6 @@ class AttributeChecker : public AttributeVisitor<AttributeChecker> {
742733
IGNORED_ATTR(WarnUnqualifiedAccess)
743734
IGNORED_ATTR(ShowInInterface)
744735
IGNORED_ATTR(DiscardableResult)
745-
IGNORED_ATTR(Escaping)
746736

747737
// FIXME: We actually do have things to enforce for versioned API.
748738
IGNORED_ATTR(Versioned)

lib/Sema/TypeCheckDecl.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5920,7 +5920,6 @@ class DeclChecker : public DeclVisitor<DeclChecker> {
59205920
// These can't appear on overridable declarations.
59215921
UNINTERESTING_ATTR(AutoClosure)
59225922
UNINTERESTING_ATTR(NoEscape)
5923-
UNINTERESTING_ATTR(Escaping)
59245923

59255924
UNINTERESTING_ATTR(Prefix)
59265925
UNINTERESTING_ATTR(Postfix)

test/IDE/complete_decl_attribute.swift

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,9 @@
3535

3636
func method(@#^KEYWORD1^#) {}
3737

38-
// KEYWORD1: Begin completions, 3 items
38+
// KEYWORD1: Begin completions, 2 items
3939
// KEYWORD1-NEXT: Keyword/None: autoclosure[#Param Attribute#]; name=autoclosure{{$}}
4040
// KEYWORD1-NEXT: Keyword/None: noescape[#Param Attribute#]; name=noescape{{$}}
41-
// KEYWORD1-NEXT: Keyword/None: escaping[#Param Attribute#]; name=escaping{{$}}
4241
// KEYWORD1-NEXT: End completions
4342

4443
@#^KEYWORD2^#
@@ -86,7 +85,7 @@ struct S{}
8685

8786
@#^KEYWORD_LAST^#
8887

89-
// KEYWORD_LAST: Begin completions, 21 items
88+
// KEYWORD_LAST: Begin completions, 20 items
9089
// KEYWORD_LAST-NEXT: Keyword/None: available[#Declaration Attribute#]; name=available{{$}}
9190
// KEYWORD_LAST-NEXT: Keyword/None: objc[#Declaration Attribute#]; name=objc{{$}}
9291
// KEYWORD_LAST-NEXT: Keyword/None: noreturn[#Declaration Attribute#]; name=noreturn{{$}}
@@ -107,5 +106,4 @@ struct S{}
107106
// KEYWORD_LAST-NEXT: Keyword/None: warn_unqualified_access[#Declaration Attribute#]; name=warn_unqualified_access
108107
// KEYWORD_LAST-NEXT: Keyword/None: discardableResult[#Declaration Attribute#]; name=discardableResult
109108
// KEYWORD_LAST-NEXT: Keyword/None: GKInspectable[#Declaration Attribute#]; name=GKInspectable{{$}}
110-
// KEYWORD_LAST-NEXT: Keyword/None: escaping[#Declaration Attribute#]; name=escaping{{$}}
111109
// KEYWORD_LAST-NEXT: End completions

test/attr/attr_escaping.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// RUN: %target-parse-verify-swift
22

3-
@escaping var fn : () -> Int = { 4 } // expected-error {{@escaping may only be used on 'parameter' declarations}} {{1-11=}}
3+
@escaping var fn : () -> Int = { 4 } // expected-error {{attribute can only be applied to types, not declarations}}
4+
func paramDeclEscaping(@escaping fn: (Int) -> Void) {} // expected-error {{attribute can only be applied to types, not declarations}}
45

56
func wrongParamType(a: @escaping Int) {} // expected-error {{@escaping attribute only applies to function types}}
67

0 commit comments

Comments
 (0)