Pending further work, do not contract related parameter binding constraints that refer to the same type variable. (E.g., "$0 == $0")

This commit is contained in:
Joe Pamer
2016-01-22 15:29:00 -08:00
parent 5b2531848d
commit 32121ecdc6

View File

@@ -773,16 +773,23 @@ bool ConstraintGraph::contractEdges() {
// wrapper for the argument type.
if (kind == ConstraintKind::BindParam) {
auto node = tyvar1->getImpl().getGraphNode();
auto hasStrictSubtypeConstraint = false;
auto hasDependentConstraint = false;
for (auto t1Constraint : node->getConstraints()) {
if (isStrictInoutSubtypeConstraint(t1Constraint)) {
hasStrictSubtypeConstraint = true;
hasDependentConstraint = true;
break;
}
// TODO: Temporarily inhibit contraction for chained param binding
// constraints. (E.g., "$0 == $0")
if (t1Constraint != constraint &&
t1Constraint->getKind() == ConstraintKind::BindParam) {
hasDependentConstraint = true;
break;
}
}
if (hasStrictSubtypeConstraint)
if (hasDependentConstraint)
continue;
}