add permission error for attempts at redefining builtins, re:
@@ -124,7 +124,14 @@ fn compile_decl(wam: &mut Machine, tl: TopLevel, queue: Vec<TopLevel>) -> EvalSe
EvalSession::from(ParserError::InvalidModuleDecl),
_ => {
let name = try_eval_session!(if let Some(name) = tl.name() {
- Ok(name)
+ match ClauseType::from(name.clone(), tl.arity(), None) {
+ ClauseType::Named(..) | ClauseType::Op(..) =>
+ Ok(name),
+ _ => {
+ let err_str = format!("{}/{}", name.as_str(), tl.arity());
+ Err(SessionError::ImpermissibleEntry(err_str))
+ }
+ }
} else {
Err(SessionError::NamelessEntry)
});
