libc = "0.2.62"
nix = "0.15.0"
ordered-float = "0.5.0"
-prolog_parser = "0.8.31"
+prolog_parser = "0.8.32"
ref_thread_local = "0.0.0"
rug = "1.4.0"
rustyline = "5.0.3"
match self {
&ClauseType::Op(_, ref spec, _) => Some(spec.clone()),
&ClauseType::Inlined(InlinedClauseType::CompareNumber(..))
- | &ClauseType::BuiltIn(BuiltInClauseType::Is(..))
- | &ClauseType::BuiltIn(BuiltInClauseType::CompareTerm(_))
- | &ClauseType::BuiltIn(BuiltInClauseType::NotEq)
- | &ClauseType::BuiltIn(BuiltInClauseType::Eq) => Some(SharedOpDesc::new(700, XFX)),
+ | &ClauseType::BuiltIn(BuiltInClauseType::Is(..))
+ | &ClauseType::BuiltIn(BuiltInClauseType::CompareTerm(_))
+ | &ClauseType::BuiltIn(BuiltInClauseType::NotEq)
+ | &ClauseType::BuiltIn(BuiltInClauseType::Eq) => Some(SharedOpDesc::new(700, XFX)),
_ => None,
}
}
spec: Option<SharedOpDesc>,
op_dir: &OpDir,
) -> Option<SharedOpDesc> {
+ if let Some(ref op_desc) = &spec {
+ if op_desc.arity() != arity {
+ /* it's possible to extend operator functors with
+ * additional terms. When that happens,
+ * void the op_spec by returning None. */
+ return None;
+ }
+ }
+
spec.or_else(|| match arity {
2 => op_dir
.get(&(name, Fixity::In))
match heap_val {
HeapCellValue::NamedStr(arity, name, spec) => {
- if let Some(spec) = fetch_op_spec(name.clone(), arity, spec.clone(), self.op_dir) {
+ let spec = fetch_op_spec(name.clone(), arity, spec.clone(), self.op_dir);
+
+ if let Some(spec) = spec {
self.handle_op_as_struct(
name,
arity,
}
fn pow(&self, n1: Number, n2: Number, culprit: &'static str) -> Result<Number, MachineStub> {
- if n2.is_negative() {
+ if n2.is_negative() && n1.is_zero() {
let stub = MachineError::functor_stub(clause_name!(culprit), 2);
return Err(self.error_form(MachineError::evaluation_error(EvalError::Undefined), stub));
}
&IndexingInstruction::SwitchOnConstant(_, ref hm) => {
let a1 = self.registers[1].clone();
let addr = self.store(self.deref(a1));
-
+
let offset = match addr {
Addr::Con(constant) => match hm.get(&constant) {
Some(offset) => *offset,
!.
'$print_exception'(E) :-
- ( E = error(_, _:_) -> true % if the error source contains a line
- % number, a GNU-style error message
- % is expected to be printed instead.
- ; write_term('caught: ', [quoted(false)]),
- writeq(E),
- nl
- ).
+ write_term('caught: ', [quoted(false)]),
+ writeq(E),
+ nl.
'$predicate_indicator'(Source, PI) :-
( nonvar(PI) ->