From 70508b6a6cff9cd1bb6383be939914edf1fc653a Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Mon, 7 Dec 2020 19:58:05 +0000 Subject: fix: fix import ordering issue --- dhall/src/semantics/resolve/resolve.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'dhall/src/semantics') diff --git a/dhall/src/semantics/resolve/resolve.rs b/dhall/src/semantics/resolve/resolve.rs index 116e1a5..2dc1ffe 100644 --- a/dhall/src/semantics/resolve/resolve.rs +++ b/dhall/src/semantics/resolve/resolve.rs @@ -381,13 +381,6 @@ fn fetch_import<'cx>( // If the import is in the in-memory cache, or the hash is in the on-disk cache, return // the cached contents. - if let Some(res_id) = env.get_from_mem_cache(&location) { - // The same location may be used with different or no hashes. Thus we need to check - // the hashes every time. - env.check_hash(import_id, res_id)?; - env.write_to_disk_cache(&import.hash, res_id); - return Ok(res_id); - } if let Some(typed) = env.get_from_disk_cache(&import.hash) { // No need to check the hash, it was checked before reading the file. // We also don't write to the in-memory cache, because the location might be completely @@ -397,6 +390,13 @@ fn fetch_import<'cx>( let res_id = cx.push_import_result(typed); return Ok(res_id); } + if let Some(res_id) = env.get_from_mem_cache(&location) { + // The same location may be used with different or no hashes. Thus we need to check + // the hashes every time. + env.check_hash(import_id, res_id)?; + env.write_to_disk_cache(&import.hash, res_id); + return Ok(res_id); + } // Resolve this import, making sure that recursive imports don't cycle back to the // current one. -- cgit v1.2.3