Skip to content

Commit cde18d1

Browse files
committed
Revert "[Constraint solver] De-duplicate potential throw sites when merging partial solutions"
This reverts commit 8e50528. We need more work on this part of the code.
1 parent 87f97c5 commit cde18d1

File tree

2 files changed

+3
-24
lines changed

2 files changed

+3
-24
lines changed

include/swift/Sema/ConstraintSystem.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1466,15 +1466,6 @@ struct PotentialThrowSite {
14661466

14671467
/// The locator that specifies where the throwing operation occurs.
14681468
ConstraintLocator *locator;
1469-
1470-
friend bool operator==(const PotentialThrowSite& lhs, const PotentialThrowSite &rhs) {
1471-
return lhs.kind == rhs.kind && lhs.type.getPointer() == rhs.type.getPointer() &&
1472-
lhs.locator == rhs.locator;
1473-
}
1474-
1475-
friend bool operator!=(const PotentialThrowSite& lhs, const PotentialThrowSite &rhs) {
1476-
return !(lhs == rhs);
1477-
}
14781469
};
14791470

14801471
/// A complete solution to a constraint system.

lib/Sema/CSSolver.cpp

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -353,21 +353,9 @@ void ConstraintSystem::applySolution(const Solution &solution) {
353353
setCaseLabelItemInfo(info.first, info.second);
354354
}
355355

356-
if (!potentialThrowSites.empty() && !solution.potentialThrowSites.empty()) {
357-
DenseMap<void *, std::vector<PotentialThrowSite>> known;
358-
for (const auto &throwSite : potentialThrowSites) {
359-
known[throwSite.first.getOpaqueValue()].push_back(throwSite.second);
360-
}
361-
362-
for (const auto &throwSite : solution.potentialThrowSites) {
363-
auto &sites = known[throwSite.first.getOpaqueValue()];
364-
if (std::find(sites.begin(), sites.end(), throwSite.second) != sites.end())
365-
continue;
366-
367-
sites.push_back(throwSite.second);
368-
potentialThrowSites.push_back(throwSite);
369-
}
370-
}
356+
potentialThrowSites.insert(potentialThrowSites.end(),
357+
solution.potentialThrowSites.begin(),
358+
solution.potentialThrowSites.end());
371359

372360
for (auto param : solution.isolatedParams) {
373361
isolatedParams.insert(param);

0 commit comments

Comments
 (0)