don't add default index for dynamic predicates unless defined at toplevel
@@ -407,9 +407,12 @@ fn add_clause_code(self, wam: &mut Machine, dynamic_code_dir: DynamicClauseMap)
for ((name, arity), _) in dynamic_code_dir {
wam.indices.dynamic_code_dir.insert((name.owning_module(), name.clone(), arity),
DynamicPredicateInfo::default());
+
+ if self.module_name.as_str() == "user" {
wam.indices.code_dir.entry((name, arity))
.or_insert(CodeIndex::dynamic_undefined(self.module_name.clone()));
}
+ }
for ((name, arity), p) in self.pi_to_loc {
let entry = wam
