Skip to content

Commit 2a5eea6

Browse files
committed
[Diagnostics] NFC: Add asserts to verify from/to types in contextual failure
We have a couple of reports that `ContextualFailure` crashes in `trySequenceSubsequenceFixIts` even with the check for a valid stdlib was added, which can only mean that from/to types are somehow invalid. Let's add a couple of asserts to verify their presence to aid us in determining what expressions can cause the problem.
1 parent d303cb1 commit 2a5eea6

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/Sema/CSDiagnostics.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,10 @@ class ContextualFailure : public FailureDiagnostic {
608608
ContextualFailure(const Solution &solution, ContextualTypePurpose purpose,
609609
Type lhs, Type rhs, ConstraintLocator *locator)
610610
: FailureDiagnostic(solution, locator), CTP(purpose), RawFromType(lhs),
611-
RawToType(rhs) {}
611+
RawToType(rhs) {
612+
assert(lhs && "Expected a valid 'from' type");
613+
assert(rhs && "Expected a valid 'to' type");
614+
}
612615

613616
SourceLoc getLoc() const override;
614617

0 commit comments

Comments
 (0)