add predicate existence errors for failed metacalls.
@@ -426,15 +426,14 @@ fn try_call_clause<'a>(&mut self, machine_st: &mut MachineState, code_dirs: Code
Ok(())
},
- &ClauseType::CallN => {
+ &ClauseType::CallN =>
if let Some((name, arity)) = machine_st.setup_call_n(arity) {
if let Some(idx) = code_dirs.get(name.clone(), arity, &machine_st.p.clone()) {
- return self.context_call(machine_st, name, arity, idx, lco);
+ self.context_call(machine_st, name, arity, idx, lco)
} else {
- machine_st.fail = true;
- }
+ Err(predicate_existence_error(name, arity, machine_st.heap.h))
}
-
+ } else {
Ok(())
},
&ClauseType::Compare => {
