From 335330690fd946b8830c6f44d6b5367139547acb Mon Sep 17 00:00:00 2001 From: Mark Date: Mon, 18 Dec 2023 14:57:22 -0700 Subject: [PATCH] don't replace undefined module predicates (#2232) --- src/machine/load_state.rs | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/machine/load_state.rs b/src/machine/load_state.rs index 079ee29e..456cfb9a 100644 --- a/src/machine/load_state.rs +++ b/src/machine/load_state.rs @@ -497,19 +497,21 @@ impl<'a, LS: LoadState<'a>> Loader<'a, LS> { } for (key, code_index) in removed_module.code_dir.iter_mut() { - if skipped_local_predicates.contains(&key) { + if skipped_local_predicates.contains(key) { continue; } - let old_index_ptr = code_index.replace(IndexPtr::undefined()); + if !code_index.is_undefined() && !code_index.is_dynamic_undefined() { + let old_index_ptr = code_index.replace(IndexPtr::undefined()); - self.payload - .retraction_info - .push_record(RetractionRecord::ReplacedModulePredicate( - module_name, - *key, - old_index_ptr, - )); + self.payload + .retraction_info + .push_record(RetractionRecord::ReplacedModulePredicate( + module_name, + *key, + old_index_ptr, + )); + } } for (key, skeleton) in removed_module.extensible_predicates.drain(..) { -- 2.54.0