Skip to content

Commit 5ed4411

Browse files
committed
Don't double-set the "throws" bit in ApplyExpr in invalid code
1 parent ae1c023 commit 5ed4411

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/Sema/TypeCheckEffects.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2922,7 +2922,12 @@ class CheckEffectsCoverage : public EffectsHandlingWalker<CheckEffectsCoverage>
29222922
auto asyncKind = classification.getConditionalKind(EffectKind::Async);
29232923
E->setNoAsync(asyncKind == ConditionalEffectKind::None);
29242924
} else {
2925-
E->setThrows(ThrownErrorDestination());
2925+
// HACK: functions can get queued multiple times in
2926+
// definedFunctions, so be sure to be idempotent.
2927+
if (!E->isThrowsSet()) {
2928+
E->setThrows(ThrownErrorDestination());
2929+
}
2930+
29262931
E->setNoAsync(true);
29272932
}
29282933

0 commit comments

Comments
 (0)