mark term_variables type errors with blame
@@ -207,8 +207,12 @@ get_args([Arg|Args], Func, I0, 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.
