@@ -131,6 +131,8 @@ class AttributeChecker : public AttributeVisitor<AttributeChecker> {
131
131
IGNORED_ATTR(NoDerivative)
132
132
IGNORED_ATTR(SpecializeExtension)
133
133
IGNORED_ATTR(Concurrent)
134
+ IGNORED_ATTR(AtRethrows)
135
+ IGNORED_ATTR(AtReasync)
134
136
#undef IGNORED_ATTR
135
137
136
138
void visitAlignmentAttr (AlignmentAttr *attr) {
@@ -225,7 +227,6 @@ class AttributeChecker : public AttributeVisitor<AttributeChecker> {
225
227
void visitNSCopyingAttr (NSCopyingAttr *attr);
226
228
void visitRequiredAttr (RequiredAttr *attr);
227
229
void visitRethrowsAttr (RethrowsAttr *attr);
228
- void visitAtRethrowsAttr (AtRethrowsAttr *attr);
229
230
230
231
void checkApplicationMainAttribute (DeclAttribute *attr,
231
232
Identifier Id_ApplicationDelegate,
@@ -280,7 +281,6 @@ class AttributeChecker : public AttributeVisitor<AttributeChecker> {
280
281
void visitMarkerAttr (MarkerAttr *attr);
281
282
282
283
void visitReasyncAttr (ReasyncAttr *attr);
283
- void visitAtReasyncAttr (AtReasyncAttr *attr);
284
284
};
285
285
} // end anonymous namespace
286
286
@@ -2054,8 +2054,8 @@ void AttributeChecker::visitRequiredAttr(RequiredAttr *attr) {
2054
2054
}
2055
2055
2056
2056
void 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 .
2059
2059
auto fn = dyn_cast<AbstractFunctionDecl>(D);
2060
2060
if (fn->getPolymorphicEffectKind (EffectKind::Throws)
2061
2061
!= PolymorphicEffectKind::Invalid) {
@@ -2066,8 +2066,6 @@ void AttributeChecker::visitRethrowsAttr(RethrowsAttr *attr) {
2066
2066
attr->setInvalid ();
2067
2067
}
2068
2068
2069
- void AttributeChecker::visitAtRethrowsAttr (AtRethrowsAttr *attr) {}
2070
-
2071
2069
// / Collect all used generic parameter types from a given type.
2072
2070
static void collectUsedGenericParameters (
2073
2071
Type Ty, SmallPtrSetImpl<TypeBase *> &ConstrainedGenericParams) {
@@ -5489,10 +5487,17 @@ void AttributeChecker::visitMarkerAttr(MarkerAttr *attr) {
5489
5487
}
5490
5488
5491
5489
void 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
+ }
5494
5497
5495
- void AttributeChecker::visitAtReasyncAttr (AtReasyncAttr *attr) {}
5498
+ diagnose (attr->getLocation (), diag::reasync_without_async_parameter);
5499
+ attr->setInvalid ();
5500
+ }
5496
5501
5497
5502
namespace {
5498
5503
0 commit comments