Generalize the @noescape attribute to be a type attribute allowed

in arbitrary places.  This fixes a regression caught by SR-770 that
would otherwise be introduced by us removing automatic currying syntax,
it allows the use of @noescape on typealiases (resolving SR-824),
allows @noescape on nested function types (fixing rdar://19997680)
and allows @noescape to be used on local variables (fixing
rdar://19997577).

At this point, @noescape should stop being a decl attribute, but I'll bring
that up on swift-evolution.
This commit is contained in:
Chris Lattner
2016-03-03 13:48:09 -08:00
parent ceb1069199
commit c3c6beac72
6 changed files with 83 additions and 11 deletions

View File

@@ -46,7 +46,7 @@ TYPE_ATTR(in)
TYPE_ATTR(inout)
TYPE_ATTR(inout_aliasable)
TYPE_ATTR(in_guaranteed)
TYPE_ATTR(noescape) // Only valid in sil mode.
TYPE_ATTR(noescape)
TYPE_ATTR(owned)
TYPE_ATTR(unowned_inner_pointer)
TYPE_ATTR(guaranteed)

View File

@@ -2045,7 +2045,8 @@ NOTE(fix_unqualified_access_top_level_multi,none,
ERROR(type_of_metatype,none,
"'.dynamicType' is not allowed after a type name", ())
ERROR(invalid_noescape_use,none,
"@noescape parameter %0 may only be called", (Identifier))
"@noescape %select{value|parameter}1 %0 may only be called",
(Identifier, bool))
NOTE(noescape_autoclosure,none,
"parameter %0 is implicitly @noescape because it was declared @autoclosure",
(Identifier))