Skip to content

Commit de731b4

Browse files
committed
Sema: Preserve insertion order in Solution::typeBindings
1 parent b760cfd commit de731b4

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
@@ -1497,7 +1497,7 @@ class Solution {
14971497
DeclContext *getDC() const;
14981498

14991499
/// The set of type bindings.
1500-
llvm::DenseMap<TypeVariableType *, Type> typeBindings;
1500+
llvm::MapVector<TypeVariableType *, Type> typeBindings;
15011501

15021502
/// The set of overload choices along with their types.
15031503
llvm::DenseMap<ConstraintLocator *, SelectedOverload> overloadChoices;

lib/IDE/KeyPathCompletion.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ void KeyPathTypeCheckCompletionCallback::sawSolutionImpl(
5353
return Entry.first->getImpl().getLocator() == RootLocator;
5454
});
5555
if (BaseVariableTypeBinding != S.typeBindings.end()) {
56-
BaseType = S.simplifyType(BaseVariableTypeBinding->getSecond());
56+
BaseType = S.simplifyType(BaseVariableTypeBinding->second);
5757
}
5858
}
5959
} else {

lib/Sema/ConstraintSystem.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1872,7 +1872,7 @@ size_t Solution::getTotalMemory() const {
18721872
return *TotalMemory;
18731873

18741874
const_cast<Solution *>(this)->TotalMemory
1875-
= sizeof(*this) + typeBindings.getMemorySize() +
1875+
= sizeof(*this) + size_in_bytes(typeBindings) +
18761876
overloadChoices.getMemorySize() +
18771877
ConstraintRestrictions.getMemorySize() +
18781878
(Fixes.size() * sizeof(void *)) + DisjunctionChoices.getMemorySize() +

0 commit comments

Comments
 (0)