Skip to content

Commit 4f32fda

Browse files
committed
Merge pull request #1098 from apple/revert-1088-sr215-fix
Revert "[Parser] Fix-it for declaration attributes being applied to parameter types (SR-215)"
2 parents 4f4ec2c + d046d88 commit 4f32fda

File tree

2 files changed

+0
-20
lines changed

2 files changed

+0
-20
lines changed

lib/Parse/ParsePattern.cpp

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -259,24 +259,6 @@ Parser::parseParameterClause(SourceLoc &leftParenLoc,
259259
if (Tok.is(tok::colon)) {
260260
param.ColonLoc = consumeToken();
261261

262-
// Check if token is @ sign ergo an attribute
263-
if (Tok.is(tok::at_sign)) {
264-
Token nextToken = peekToken();
265-
// Check if attribute is invalid type attribute
266-
// and actually a declaration attribute
267-
TypeAttrKind TK = TypeAttributes::getAttrKindFromString(nextToken.getText());
268-
DeclAttrKind DK = DeclAttribute::getAttrKindFromString(nextToken.getText());
269-
if ((TK == TAK_Count || (TK == TAK_noescape && !isInSILMode()))
270-
&& DK != DAK_Count
271-
&& DeclAttribute::getOptions(declKind) & OnParam) {
272-
SourceLoc AtLoc = consumeToken(tok::at_sign);
273-
SourceLoc AttrLoc = consumeToken(tok::identifier);
274-
diagnose(AtLoc, diag::decl_attribute_applied_to_type)
275-
.fixItRemove(SourceRange(AtLoc, AttrLoc))
276-
.fixItInsert(StartLoc, "@" + nextToken.getText().str()+" ");
277-
}
278-
}
279-
280262
auto type = parseType(diag::expected_parameter_type);
281263
status |= type;
282264
param.Type = type.getPtrOrNull();

test/attr/attr_noescape.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
@noescape var fn : () -> Int = { 4 } // expected-error {{@noescape may only be used on 'parameter' declarations}} {{1-11=}}
44

5-
func appliedToType(g: @noescape ()->Void) { g() } // expected-error {{attribute can only be applied to declarations, not types}} {{20-20=@noescape }} {{23-33=}}
6-
75
func doesEscape(fn : () -> Int) {}
86

97
func takesGenericClosure<T>(a : Int, @noescape _ fn : () -> T) {}

0 commit comments

Comments
 (0)