Skip to content

Commit fa73be2

Browse files
committed
Revert "Sema: Remove one-way constraint handling from computeConnectedComponents()"
This reverts commit dd3e49c.
1 parent 8af183c commit fa73be2

File tree

3 files changed

+376
-8
lines changed

3 files changed

+376
-8
lines changed

include/swift/Sema/Constraint.h

+5
Original file line numberDiff line numberDiff line change
@@ -820,6 +820,11 @@ class Constraint final : public llvm::ilist_node<Constraint>,
820820
/// from the rest of the constraint system.
821821
bool isIsolated() const { return IsIsolated; }
822822

823+
/// Whether this is a one-way constraint.
824+
bool isOneWayConstraint() const {
825+
return false;
826+
}
827+
823828
/// Retrieve the overload choice for an overload-binding constraint.
824829
OverloadChoice getOverloadChoice() const {
825830
assert(Kind == ConstraintKind::BindOverload);

lib/Sema/CSStep.cpp

+10
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,16 @@ StepResult ComponentStep::take(bool prevFailed) {
337337
CS.replaySolution(*partial);
338338
}
339339

340+
// Activate all of the one-way constraints.
341+
SmallVector<Constraint *, 4> oneWayConstraints;
342+
for (auto &constraint : CS.InactiveConstraints) {
343+
if (constraint.isOneWayConstraint())
344+
oneWayConstraints.push_back(&constraint);
345+
}
346+
for (auto constraint : oneWayConstraints) {
347+
CS.activateConstraint(constraint);
348+
}
349+
340350
// Simplify again.
341351
if (CS.failedConstraint || CS.simplify())
342352
return done(/*isSuccess=*/false);

0 commit comments

Comments
 (0)