From: Mark Thom Date: Sat, 20 Aug 2022 05:41:47 +0000 (-0600) Subject: don't return ops with priority 0 when building set for current_op (#1571) X-Git-Tag: v0.9.1^2~34 X-Git-Url: https://git.sagredo.dev/?a=commitdiff_plain;h=d4c0277065d8997b13956eb88cad6351bf3622a8;p=scryer-prolog.git don't return ops with priority 0 when building set for current_op (#1571) --- diff --git a/src/lib/builtins.pl b/src/lib/builtins.pl index 536f0d67..a0df16bf 100644 --- a/src/lib/builtins.pl +++ b/src/lib/builtins.pl @@ -1122,7 +1122,6 @@ current_predicate(Pred) :- can_be_op_priority(Priority) :- var(Priority). can_be_op_priority(Priority) :- op_priority(Priority). - can_be_op_specifier(Spec) :- var(Spec). can_be_op_specifier(Spec) :- op_specifier(Spec). diff --git a/src/machine/loader.rs b/src/machine/loader.rs index 7c9b380c..3495e5b3 100644 --- a/src/machine/loader.rs +++ b/src/machine/loader.rs @@ -757,7 +757,6 @@ impl<'a, LS: LoadState<'a>> Loader<'a, LS> { .map(|code_idx| code_idx.set(old_code_idx)); } RetractionRecord::AddedIndex(index_key, clause_loc) => { - // WAS: inner_index_locs) => { if let Some(index_loc) = index_key.switch_on_term_loc() { let indexing_code = match &mut self.wam_prelude.code[index_loc] { Instruction::IndexingCode(indexing_code) => indexing_code, diff --git a/src/machine/system_calls.rs b/src/machine/system_calls.rs index 46506621..5ce4ff89 100644 --- a/src/machine/system_calls.rs +++ b/src/machine/system_calls.rs @@ -3583,6 +3583,12 @@ impl Machine { let (op_prec, op_spec) = (op_desc.get_prec(), op_desc.get_spec()); + if op_prec == 0 { + // 8.14.4, note 2 + self.machine_st.fail = true; + return; + } + let op_spec = match op_spec as u32 { XFX => atom!("xfx"), XFY => atom!("xfy"), @@ -3609,6 +3615,12 @@ impl Machine { for op_desc in op_descs { if let Some((key, op_desc)) = op_desc { let (prec, spec) = (op_desc.get_prec(), op_desc.get_spec()); + + if prec == 0 { + // 8.14.4, note 2 + continue; + } + unossified_op_dir.insert(*key, (prec as usize, spec as Specifier)); } } @@ -3625,6 +3637,7 @@ impl Machine { let name = key.0; if other_prec == 0 { + // 8.14.4, note 2 return None; }