From: Mark Thom Date: Thu, 4 Oct 2018 05:08:25 +0000 (-0600) Subject: mark term_variables type errors with blame X-Git-Tag: v0.8.110~352 X-Git-Url: https://git.sagredo.dev/?a=commitdiff_plain;h=d9b5734688517327971d9bd3647b503f7073a6e9;p=scryer-prolog.git mark term_variables type errors with blame --- diff --git a/src/prolog/lib/builtins.pl b/src/prolog/lib/builtins.pl index 66638a35..a8a0023f 100644 --- a/src/prolog/lib/builtins.pl +++ b/src/prolog/lib/builtins.pl @@ -206,11 +206,15 @@ get_args([Arg|Args], Func, I0, N) :- '$call_with_default_policy'(get_args(Args, Func, I1, N)). % term_variables. - + +can_be(Type, Term) :- error:can_be(Type, Term). + term_variables(Term, Vars) :- - error:can_be(list, Vars), + catch(can_be(list, Vars), error(E, Ctx), + ( ( var(Ctx) -> Ctx = term_variables/2 ; true ), + throw(error(E, Ctx)) ) ), '$term_variables'(Term, Vars). - + % setup_call_cleanup. setup_call_cleanup(S, G, C) :- '$get_b_value'(B),