@@ -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
@@ -2064,8 +2064,8 @@ void AttributeChecker::visitRequiredAttr(RequiredAttr *attr) {
2064
2064
}
2065
2065
2066
2066
void 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 .
2069
2069
auto fn = dyn_cast<AbstractFunctionDecl>(D);
2070
2070
if (fn->getPolymorphicEffectKind (EffectKind::Throws)
2071
2071
!= PolymorphicEffectKind::Invalid) {
@@ -2076,8 +2076,6 @@ void AttributeChecker::visitRethrowsAttr(RethrowsAttr *attr) {
2076
2076
attr->setInvalid ();
2077
2077
}
2078
2078
2079
- void AttributeChecker::visitAtRethrowsAttr (AtRethrowsAttr *attr) {}
2080
-
2081
2079
// / Collect all used generic parameter types from a given type.
2082
2080
static void collectUsedGenericParameters (
2083
2081
Type Ty, SmallPtrSetImpl<TypeBase *> &ConstrainedGenericParams) {
@@ -5566,10 +5564,17 @@ void AttributeChecker::visitMarkerAttr(MarkerAttr *attr) {
5566
5564
}
5567
5565
5568
5566
void 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
+ }
5571
5574
5572
- void AttributeChecker::visitAtReasyncAttr (AtReasyncAttr *attr) {}
5575
+ diagnose (attr->getLocation (), diag::reasync_without_async_parameter);
5576
+ attr->setInvalid ();
5577
+ }
5573
5578
5574
5579
namespace {
5575
5580
0 commit comments