Skip to content

Commit 756b3cc

Browse files
committed
cns:attr_unify_hook
1 parent 97adc56 commit 756b3cc

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

prolog/metta_lang/metta_compiler.pl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -731,7 +731,8 @@
731731
label_arg_types(F,N2,Args).
732732

733733
% label_arg_n_type(F,0,A):- !, label_type_assignment(A,F).
734-
label_arg_n_type(F,N,A):- compound(F),functor_chkd(F,Fn,Add),Is is Add+N, !, label_arg_n_type(Fn,Is,A).
734+
label_arg_n_type(F,N,A):- is_arity_0(F,Fn),!,label_arg_n_type(Fn,N,A).
735+
label_arg_n_type(F,N,A):- compound(F),!,functor_chkd(F,Fn,Add),Is is Add+N, !, label_arg_n_type(Fn,Is,A).
735736
label_arg_n_type(F,N,A):- add_type_to(A,arg(F,N)),!.
736737

737738
add_type_to_var(_,Var):- nonvar(Var),!.
@@ -3742,9 +3743,9 @@
37423743
%extract_constraints(Out,VS),
37433744
renumvars(Out+VS,COut+CVS),
37443745
%CVS = VS, COut = Out,
3745-
in_cmt(in_color((
3746+
maybe_write_info(in_cmt(call(in_color((
37463747
pp_se(COut),
3747-
maplist(ppt_cns,CVS)))))).
3748+
maplist(ppt_cns,CVS)))))))).
37483749

37493750
ppt_cns(put_attr(Var,cns,_=List)):- ppt(Var=List),!.
37503751
ppt_cns(_).

prolog/metta_lang/metta_debug.pl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -805,8 +805,8 @@
805805

806806
sub_var_safely(Sub,Source):- assertion(acyclic_term(Source)),woct(sub_var(Sub,Source)).
807807
sub_term_safely(Sub,Source):- assertion(acyclic_term(Source)),woct(sub_term(Sub,Source)).
808-
functor_chkd(P,F,A):- compound(P),!,compound_name_arity(P,F,AA), if_t(A==0, (bt, prolog)), if_t(AA==0, (bt, prolog)), A=AA.
809-
functor_chkd(P,F,A):- functor(P,F,A), if_t(A==0, (bt, prolog)).
808+
functor_chkd(P,F,A):- compound(P),!,compound_name_arity(P,F,AA), nop(if_t(A==0, ((bt, prolog)))), nop(if_t(AA==0, (bt, prolog))), A=AA.
809+
functor_chkd(P,F,A):- functor(P,F,A), nop(if_t(A==0, (bt, prolog))).
810810

811811
maybe_abort_trace:- \+ is_flag(abort_trace), !.
812812
maybe_abort_trace:- abort_trace.

prolog/metta_lang/metta_types.pl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1616,11 +1616,10 @@
16161616
nop(nopped_non_arg_violation(Self, RequireType, BecomingValue)).
16171617

16181618

1619-
cns:attr_unify_hook(WAS, NewValue) :- attvar(NewValue), get_attr(NewValue,cns,WAS2),!,
1620-
arg(2,WAS,List1),arg(2,WAS2,List2),append(List1,List2,List12),list_to_set(List12,Set),
1619+
cns:attr_unify_hook(WAS, NewValue) :- attvar(NewValue), get_attr(NewValue,cns,WAS2),
1620+
compound(WAS),compound(WAS2),arg(2,WAS,List1),arg(2,WAS2,List2),append(List1,List2,List12),list_to_set(List12,Set),
16211621
setarg(2,WAS,Set),setarg(2,WAS2,Set),!.
16221622

1623-
16241623
cns:attr_unify_hook(_,_):- nb_current(suspend_type_unificaton, true),!.
16251624

16261625
cns:attr_unify_hook(_Slf=_TypeList,_NewValue):- nb_current(suspend_type_unificaton, true),!.

0 commit comments

Comments
 (0)