From fac944be008330c7e1b3ca1df04354ff66d18724 Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Tue, 15 Mar 2022 11:32:03 +0100 Subject: [PATCH] fix: don't evict cache entries with no artifacts (#1035) --- ethers-solc/src/cache.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ethers-solc/src/cache.rs b/ethers-solc/src/cache.rs index 3a365e2f..edf3b271 100644 --- a/ethers-solc/src/cache.rs +++ b/ethers-solc/src/cache.rs @@ -294,6 +294,12 @@ impl SolFilesCache { let mut files: HashMap<_, _> = files.into_iter().map(|(p, v)| (p, v)).collect(); 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()) { entry.retain_versions(versions); } else {