Skip to content

Commit f83c719

Browse files
committed
[ConstraintSystem] Make sure that invalid state is always diagnosed via fallback diagnostic
1 parent 48d4997 commit f83c719

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lib/Sema/ConstraintSystem.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5472,6 +5472,14 @@ void ConstraintSystem::diagnoseFailureFor(SolutionApplicationTarget target) {
54725472
SWIFT_DEFER { setPhase(ConstraintSystemPhase::Finalization); };
54735473

54745474
auto &DE = getASTContext().Diags;
5475+
5476+
// If constraint system is in invalid state always produce
5477+
// a fallback diagnostic that asks to file a bug.
5478+
if (inInvalidState()) {
5479+
DE.diagnose(target.getLoc(), diag::failed_to_produce_diagnostic);
5480+
return;
5481+
}
5482+
54755483
if (auto expr = target.getAsExpr()) {
54765484
if (auto *assignment = dyn_cast<AssignExpr>(expr)) {
54775485
if (isa<DiscardAssignmentExpr>(assignment->getDest()))

0 commit comments

Comments
 (0)