@@ -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
@@ -2064,8 +2064,8 @@ void AttributeChecker::visitRequiredAttr(RequiredAttr *attr) {
20642064}
20652065
20662066void AttributeChecker::visitRethrowsAttr (RethrowsAttr *attr) {
2067- // 'rethrows' only applies to functions that take throwing functions
2068- // as parameters .
2067+ // Make sure the function takes a 'throws' function argument or a
2068+ // conformance to a '@rethrows' protocol .
20692069 auto fn = dyn_cast<AbstractFunctionDecl>(D);
20702070 if (fn->getPolymorphicEffectKind (EffectKind::Throws)
20712071 != PolymorphicEffectKind::Invalid) {
@@ -2076,8 +2076,6 @@ void AttributeChecker::visitRethrowsAttr(RethrowsAttr *attr) {
20762076 attr->setInvalid ();
20772077}
20782078
2079- void AttributeChecker::visitAtRethrowsAttr (AtRethrowsAttr *attr) {}
2080-
20812079// / Collect all used generic parameter types from a given type.
20822080static void collectUsedGenericParameters (
20832081 Type Ty, SmallPtrSetImpl<TypeBase *> &ConstrainedGenericParams) {
@@ -5566,10 +5564,17 @@ void AttributeChecker::visitMarkerAttr(MarkerAttr *attr) {
55665564}
55675565
55685566void AttributeChecker::visitReasyncAttr (ReasyncAttr *attr) {
5569- // FIXME
5570- }
5567+ // Make sure the function takes a 'throws' function argument or a
5568+ // conformance to a '@rethrows' protocol.
5569+ auto fn = dyn_cast<AbstractFunctionDecl>(D);
5570+ if (fn->getPolymorphicEffectKind (EffectKind::Async)
5571+ != PolymorphicEffectKind::Invalid) {
5572+ return ;
5573+ }
55715574
5572- void AttributeChecker::visitAtReasyncAttr (AtReasyncAttr *attr) {}
5575+ diagnose (attr->getLocation (), diag::reasync_without_async_parameter);
5576+ attr->setInvalid ();
5577+ }
55735578
55745579namespace {
55755580
0 commit comments