Sema: Preserve insertion order in Solution::typeBindings

This commit is contained in:
Slava Pestov
2024-11-20 11:25:29 -05:00
parent b760cfd03d
commit de731b4d5d
3 changed files with 3 additions and 3 deletions

View File

@@ -1497,7 +1497,7 @@ public:
DeclContext *getDC() const;
/// The set of type bindings.
llvm::DenseMap<TypeVariableType *, Type> typeBindings;
llvm::MapVector<TypeVariableType *, Type> typeBindings;
/// The set of overload choices along with their types.
llvm::DenseMap<ConstraintLocator *, SelectedOverload> overloadChoices;

View File

@@ -53,7 +53,7 @@ void KeyPathTypeCheckCompletionCallback::sawSolutionImpl(
return Entry.first->getImpl().getLocator() == RootLocator;
});
if (BaseVariableTypeBinding != S.typeBindings.end()) {
BaseType = S.simplifyType(BaseVariableTypeBinding->getSecond());
BaseType = S.simplifyType(BaseVariableTypeBinding->second);
}
}
} else {

View File

@@ -1872,7 +1872,7 @@ size_t Solution::getTotalMemory() const {
return *TotalMemory;
const_cast<Solution *>(this)->TotalMemory
= sizeof(*this) + typeBindings.getMemorySize() +
= sizeof(*this) + size_in_bytes(typeBindings) +
overloadChoices.getMemorySize() +
ConstraintRestrictions.getMemorySize() +
(Fixes.size() * sizeof(void *)) + DisjunctionChoices.getMemorySize() +