diff --git a/src/machine/system_calls.rs b/src/machine/system_calls.rs index 7efcc2df..86d7944a 100644 --- a/src/machine/system_calls.rs +++ b/src/machine/system_calls.rs @@ -1693,9 +1693,12 @@ impl Machine { } } _ => { + let h = self.machine_st.heap.len(); let call_form = functor!(atom!(":"), [cell(module_name), cell(self.machine_st.registers[2])]); + self.machine_st.heap.extend(call_form); + let stub = functor_stub(atom!("call"), narity + 1); - let err = self.machine_st.type_error(ValidType::Callable, call_form); + let err = self.machine_st.type_error(ValidType::Callable, str_loc_as_cell!(h)); return Err(self.machine_st.error_form(err, stub)); } );