]> Repositorios git - scryer-prolog.git/commitdiff
make retract_local_clauses safe, remove warning about overwriting warning in do_not_d...
authorMark Thom <[email protected]>
Tue, 23 Mar 2021 18:37:43 +0000 (12:37 -0600)
committerMark Thom <[email protected]>
Tue, 23 Mar 2021 18:37:43 +0000 (12:37 -0600)
src/machine/load_state.rs
tests/scryer/issues.rs

index d07549361c1955d716befc91b7034ca28d4b178a..e59d4a2abd482d29f9691e2b1404e6462ec8ec3a 100644 (file)
@@ -344,7 +344,7 @@ impl<'a> LoadState<'a> {
         key: PredicateKey,
         clause_locs: &SliceDeque<usize>,
     ) {
-        let (clause_target_poses, is_dynamic) = self
+        let result_opt = self
             .wam
             .indices
             .get_predicate_skeleton(&compilation_target, &key)
@@ -358,14 +358,16 @@ impl<'a> LoadState<'a> {
                     })
                     .collect(),
                  skeleton.is_dynamic)
-            }).unwrap();
-
-        self.retract_local_clauses_by_locs(
-            compilation_target,
-            key,
-            clause_target_poses,
-            is_dynamic,
-        );
+            });
+
+        if let Some((clause_target_poses, is_dynamic)) = result_opt {
+            self.retract_local_clauses_by_locs(
+                compilation_target,
+                key,
+                clause_target_poses,
+                is_dynamic,
+            );
+        }
     }
 
     pub(super) fn retract_local_clauses_by_locs(
index 72f671942c31afdd1a1f647cf28a9e5411d32932..7823cf43c30cf2ef88a962fb7c5e2cba14795611 100644 (file)
@@ -29,7 +29,6 @@ fn do_not_duplicate_path_components() {
         "\
         caught: e\n\
         false.\n\
-        Warning: overwriting $initialization_goals/1\n\
         caught: e\n\
         false.\n\
         ",