Merge pull request #936 from pmoura/fix_throw_1_control_construct_with_var_argument

Fix throw/1 control construct to throw an instantiation error when the argument is not bound
This commit is contained in:
Mark Thom
2021-05-10 11:09:59 -06:00
committed by GitHub

View File

@@ -615,8 +615,12 @@ handle_ball(C, C, R) :-
handle_ball(_, _, _) :-
'$unwind_stack'.
throw(Ball) :- '$set_ball'(Ball), '$unwind_stack'.
throw(Ball) :-
( var(Ball) ->
'$set_ball'(error(instantiation_error,throw/1))
; '$set_ball'(Ball)
),
'$unwind_stack'.
:- non_counted_backtracking '$iterate_find_all'/4.
'$iterate_find_all'(Template, Goal, _, LhOffset) :-