Skip to content

Commit e95e43d

Browse files
committedOct 22, 2021
[ConstraintSystem] Convert ImplicitValueConversions to a map vector to avoid duplicates
1 parent 568c27f commit e95e43d

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed
 

‎include/swift/Sema/ConstraintSystem.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -2399,7 +2399,7 @@ class ConstraintSystem {
23992399

24002400
/// The set of implicit value conversions performed by the solver on
24012401
/// a current path to reach a solution.
2402-
SmallVector<std::pair<ConstraintLocator *, ConversionRestrictionKind>, 2>
2402+
llvm::SmallMapVector<ConstraintLocator *, ConversionRestrictionKind, 2>
24032403
ImplicitValueConversions;
24042404

24052405
/// The worklist of "active" constraints that should be revisited

‎lib/Sema/CSSimplify.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -11322,7 +11322,7 @@ ConstraintSystem::simplifyRestrictedConstraintImpl(
1132211322
FunctionType::get({FunctionType::Param(type1)}, type2),
1132311323
memberTy, applicationLoc);
1132411324

11325-
ImplicitValueConversions.push_back(
11325+
ImplicitValueConversions.insert(
1132611326
{getConstraintLocator(locator), restriction});
1132711327
return SolutionKind::Solved;
1132811328
}

‎lib/Sema/CSSolver.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ void ConstraintSystem::applySolution(const Solution &solution) {
305305
}
306306

307307
for (auto &valueConversion : solution.ImplicitValueConversions) {
308-
ImplicitValueConversions.push_back(valueConversion);
308+
ImplicitValueConversions.insert(valueConversion);
309309
}
310310

311311
// Register the argument lists.

0 commit comments

Comments
 (0)