IDE: Add CodeCompleteInitsInPostfixExpr to completion cache key

This fixes a source of non-determinism. The IDE/complete_constructor
test would sometimes fail depending on the order in which prior tests
ran, since those prior tests might populate the code completion cache.
This commit is contained in:
Slava Pestov
2016-10-02 23:45:40 -04:00
parent 7af52384e0
commit 0b8beea69b
3 changed files with 17 additions and 11 deletions

View File

@@ -39,13 +39,15 @@ public:
std::vector<std::string> AccessPath;
bool ResultsHaveLeadingDot;
bool ForTestableLookup;
bool CodeCompleteInitsInPostfixExpr;
friend bool operator==(const Key &LHS, const Key &RHS) {
return LHS.ModuleFilename == RHS.ModuleFilename &&
LHS.ModuleName == RHS.ModuleName &&
LHS.AccessPath == RHS.AccessPath &&
LHS.ResultsHaveLeadingDot == RHS.ResultsHaveLeadingDot &&
LHS.ForTestableLookup == RHS.ForTestableLookup;
LHS.ModuleName == RHS.ModuleName &&
LHS.AccessPath == RHS.AccessPath &&
LHS.ResultsHaveLeadingDot == RHS.ResultsHaveLeadingDot &&
LHS.ForTestableLookup == RHS.ForTestableLookup &&
LHS.CodeCompleteInitsInPostfixExpr == RHS.CodeCompleteInitsInPostfixExpr;
}
};
@@ -101,10 +103,10 @@ template<>
struct DenseMapInfo<swift::ide::CodeCompletionCache::Key> {
using KeyTy = swift::ide::CodeCompletionCache::Key;
static inline KeyTy getEmptyKey() {
return KeyTy{"", "", {}, false, false};
return KeyTy{"", "", {}, false, false, false};
}
static inline KeyTy getTombstoneKey() {
return KeyTy{"", "", {}, true, false};
return KeyTy{"", "", {}, true, false, false};
}
static unsigned getHashValue(const KeyTy &Val) {
size_t H = 0;