From d9b5734688517327971d9bd3647b503f7073a6e9 Mon Sep 17 00:00:00 2001 From: Mark Thom Date: Wed, 3 Oct 2018 23:08:25 -0600 Subject: [PATCH] mark term_variables type errors with blame --- src/prolog/lib/builtins.pl | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) 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), -- 2.54.0