@@ -131,6 +131,8 @@ class AttributeChecker : public AttributeVisitor<AttributeChecker> {
131131 IGNORED_ATTR(NoDerivative)
132132 IGNORED_ATTR(SpecializeExtension)
133133 IGNORED_ATTR(Concurrent)
134+ IGNORED_ATTR(AtRethrows)
135+ IGNORED_ATTR(AtReasync)
134136#undef IGNORED_ATTR
135137
136138 void visitAlignmentAttr (AlignmentAttr *attr) {
@@ -225,7 +227,6 @@ class AttributeChecker : public AttributeVisitor<AttributeChecker> {
225227 void visitNSCopyingAttr (NSCopyingAttr *attr);
226228 void visitRequiredAttr (RequiredAttr *attr);
227229 void visitRethrowsAttr (RethrowsAttr *attr);
228- void visitAtRethrowsAttr (AtRethrowsAttr *attr);
229230
230231 void checkApplicationMainAttribute (DeclAttribute *attr,
231232 Identifier Id_ApplicationDelegate,
@@ -280,7 +281,6 @@ class AttributeChecker : public AttributeVisitor<AttributeChecker> {
280281 void visitMarkerAttr (MarkerAttr *attr);
281282
282283 void visitReasyncAttr (ReasyncAttr *attr);
283- void visitAtReasyncAttr (AtReasyncAttr *attr);
284284};
285285} // end anonymous namespace
286286
@@ -2054,8 +2054,8 @@ void AttributeChecker::visitRequiredAttr(RequiredAttr *attr) {
20542054}
20552055
20562056void AttributeChecker::visitRethrowsAttr (RethrowsAttr *attr) {
2057- // 'rethrows' only applies to functions that take throwing functions
2058- // as parameters .
2057+ // Make sure the function takes a 'throws' function argument or a
2058+ // conformance to a '@rethrows' protocol .
20592059 auto fn = dyn_cast<AbstractFunctionDecl>(D);
20602060 if (fn->getPolymorphicEffectKind (EffectKind::Throws)
20612061 != PolymorphicEffectKind::Invalid) {
@@ -2066,8 +2066,6 @@ void AttributeChecker::visitRethrowsAttr(RethrowsAttr *attr) {
20662066 attr->setInvalid ();
20672067}
20682068
2069- void AttributeChecker::visitAtRethrowsAttr (AtRethrowsAttr *attr) {}
2070-
20712069// / Collect all used generic parameter types from a given type.
20722070static void collectUsedGenericParameters (
20732071 Type Ty, SmallPtrSetImpl<TypeBase *> &ConstrainedGenericParams) {
@@ -5489,10 +5487,17 @@ void AttributeChecker::visitMarkerAttr(MarkerAttr *attr) {
54895487}
54905488
54915489void AttributeChecker::visitReasyncAttr (ReasyncAttr *attr) {
5492- // FIXME
5493- }
5490+ // Make sure the function takes a 'throws' function argument or a
5491+ // conformance to a '@rethrows' protocol.
5492+ auto fn = dyn_cast<AbstractFunctionDecl>(D);
5493+ if (fn->getPolymorphicEffectKind (EffectKind::Async)
5494+ != PolymorphicEffectKind::Invalid) {
5495+ return ;
5496+ }
54945497
5495- void AttributeChecker::visitAtReasyncAttr (AtReasyncAttr *attr) {}
5498+ diagnose (attr->getLocation (), diag::reasync_without_async_parameter);
5499+ attr->setInvalid ();
5500+ }
54965501
54975502namespace {
54985503
0 commit comments