fix: don't evict cache entries with no artifacts (#1035)

This commit is contained in:
Matthias Seitz 2022-03-15 11:32:03 +01:00 committed by GitHub
parent 72e280d2cc
commit fac944be00
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions

View File

@ -294,6 +294,12 @@ impl SolFilesCache {
let mut files: HashMap<_, _> = files.into_iter().map(|(p, v)| (p, v)).collect(); let mut files: HashMap<_, _> = files.into_iter().map(|(p, v)| (p, v)).collect();
self.files.retain(|file, entry| { self.files.retain(|file, entry| {
if entry.artifacts.is_empty() {
// keep entries that didn't emit any artifacts in the first place, such as a
// solidity file that only includes error definitions
return true
}
if let Some(versions) = files.remove(file.as_path()) { if let Some(versions) = files.remove(file.as_path()) {
entry.retain_versions(versions); entry.retain_versions(versions);
} else { } else {