diff options
author | Nadrieril | 2020-12-07 19:58:05 +0000 |
---|---|---|
committer | Nadrieril | 2020-12-08 20:25:20 +0000 |
commit | 70508b6a6cff9cd1bb6383be939914edf1fc653a (patch) | |
tree | 6401e207346036fa013ddb5b3f00a51786cee834 /dhall/src | |
parent | 109dcf894e759bce1c28f9ae94f3fdaa6e08feb5 (diff) |
fix: fix import ordering issue
Diffstat (limited to 'dhall/src')
-rw-r--r-- | dhall/src/semantics/resolve/resolve.rs | 14 |
1 files changed, 7 insertions, 7 deletions
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. |