Skip to content

Commit 6e9f4dc

Browse files
committed
Sema: Avoid asking for the SecondType of Constraints that don't have them.
Assertions tripped while trying to reproduce SR-5513.
1 parent 4094737 commit 6e9f4dc

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

lib/Sema/CSDiag.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2833,6 +2833,11 @@ bool FailureDiagnosis::diagnoseGeneralConversionFailure(Constraint *constraint){
28332833
fromType = CS.getType(sub);
28342834
}
28352835

2836+
// Bail on constraints that don't relate two types.
2837+
if (constraint->getKind() == ConstraintKind::Disjunction
2838+
|| constraint->getKind() == ConstraintKind::BindOverload)
2839+
return false;
2840+
28362841
fromType = fromType->getRValueType();
28372842
auto toType =
28382843
CS.simplifyType(constraint->getSecondType())->getWithoutImmediateLabel();

lib/Sema/ConstraintGraph.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -641,7 +641,6 @@ static bool shouldContractEdge(ConstraintKind kind) {
641641
case ConstraintKind::BindParam:
642642
case ConstraintKind::BindToPointerType:
643643
case ConstraintKind::Equal:
644-
case ConstraintKind::BindOverload:
645644

646645
// We currently only allow subtype contractions for the purpose of
647646
// parameter binding constraints.

0 commit comments

Comments
 (0)