]> Repositorios git - scryer-prolog.git/commitdiff
add proper error throwing for call_with_inference_limit/3 (#1296)
authorMark Thom <[email protected]>
Sat, 26 Feb 2022 17:57:52 +0000 (10:57 -0700)
committerMark Thom <[email protected]>
Sun, 27 Feb 2022 18:38:44 +0000 (11:38 -0700)
src/lib/iso_ext.pl

index 37044a405a34671594e6fd8d7e44a2026ad29b19..e614b1f64f2c3100c8190cacfd73e9b0327953b3 100644 (file)
@@ -137,6 +137,15 @@ handle_ile(B, E, _) :-
 :- meta_predicate(call_with_inference_limit(0, ?, ?)).
 
 call_with_inference_limit(G, L, R) :-
+    (  integer(L) ->
+       (  L < 0 ->
+          domain_error(not_less_than_zero, L, call_with_inference_limit/3)
+       ;  true
+       )
+    ;  var(L) ->
+       instantiation_error(call_with_inference_limit/3)
+    ;  type_error(integer, L, call_with_inference_limit/3)
+    ),
     '$get_current_block'(Bb),
     '$get_b_value'(B),
     '$call_with_default_policy'(call_with_inference_limit(G, L, R, Bb, B)),