]> Repositorios git - scryer-prolog.git/commitdiff
throw evaluable type error for unrecognized atoms in arith_eval_by_metacall
authorMark Thom <[email protected]>
Sat, 23 May 2020 19:33:05 +0000 (13:33 -0600)
committerMark Thom <[email protected]>
Sat, 23 May 2020 19:33:05 +0000 (13:33 -0600)
src/prolog/machine/arithmetic_ops.rs

index 61627aa87407e514b812ef179ef97bacc75fe1e0..45aecb9bff6b235ef5fba823070bf5f4aea969bb 100644 (file)
@@ -269,6 +269,18 @@ impl MachineState {
                         caller,
                     ));
                 }
+                &HeapCellValue::Atom(ref name, _) => {
+                    let evaluable_stub = MachineError::functor_stub(name.clone(), 0);
+
+                    return Err(self.error_form(
+                        MachineError::type_error(
+                            self.heap.h(),
+                            ValidType::Evaluable,
+                            evaluable_stub,
+                        ),
+                        caller,
+                    ));
+                }
                 &HeapCellValue::Addr(addr) if addr.is_ref() => {
                     return Err(self.error_form(
                         MachineError::instantiation_error(),