Skip to content

Commit 2f91f21

Browse files
committed
[ConstraintSystem] Don't contract edges with type holes
Holes couldn't be contracted instead solving of the constraint has to be delayed until one of the sides is bound to a type, otherwise there is a risk to loose contextual information.
1 parent f68e8d2 commit 2f91f21

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lib/Sema/ConstraintGraph.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1126,6 +1126,10 @@ bool ConstraintGraph::contractEdges() {
11261126
if (isParamBindingConstraint && tyvar1->getImpl().canBindToInOut()) {
11271127
bool isNotContractable = true;
11281128
if (auto bindings = CS.getPotentialBindings(tyvar1)) {
1129+
// Holes can't be contracted.
1130+
if (bindings.IsHole)
1131+
continue;
1132+
11291133
for (auto &binding : bindings.Bindings) {
11301134
auto type = binding.BindingType;
11311135
isNotContractable = type.findIf([&](Type nestedType) -> bool {

0 commit comments

Comments
 (0)