Skip to content

Commit a5ad953

Browse files
committed
Consider 'async' during classification of call-sites to rethrows functions.
1 parent 5ebb884 commit a5ad953

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/Sema/TypeCheckEffects.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ class ApplyClassifier {
399399
DeclContext *RethrowsDC = nullptr;
400400
bool inRethrowsContext() const { return RethrowsDC != nullptr; }
401401

402-
/// Check to see if the given function application throws.
402+
/// Check to see if the given function application throws or is async.
403403
Classification classifyApply(ApplyExpr *E) {
404404
// An apply expression is a potential throw site if the function throws.
405405
// But if the expression didn't type-check, suppress diagnostics.
@@ -461,7 +461,8 @@ class ApplyClassifier {
461461
if (!type) return Classification::forInvalidCode();
462462

463463
// Use the most significant result from the arguments.
464-
Classification result;
464+
Classification result = isAsync ? Classification::forAsync()
465+
: Classification();
465466
for (auto arg : llvm::reverse(args)) {
466467
auto fnType = type->getAs<AnyFunctionType>();
467468
if (!fnType) return Classification::forInvalidCode();

0 commit comments

Comments
 (0)