From: Paulo Moura Date: Sun, 6 Mar 2022 21:33:49 +0000 (+0000) Subject: Fix halt/1 built-in predicate for ISO Prolog Core standard compliance X-Git-Tag: v0.9.1~129^2 X-Git-Url: https://git.sagredo.dev/?a=commitdiff_plain;h=495168e7bb0d1a8a8ebd539adb9ca73c7a527e7b;p=scryer-prolog.git Fix halt/1 built-in predicate for ISO Prolog Core standard compliance --- diff --git a/src/lib/builtins.pl b/src/lib/builtins.pl index e21d441e..7dce699a 100644 --- a/src/lib/builtins.pl +++ b/src/lib/builtins.pl @@ -1218,11 +1218,14 @@ op(Priority, OpSpec, Op) :- halt :- halt(0). halt(N) :- - must_be_number(N, halt/1), - ( -2^31 =< N, N =< 2^31 - 1 -> - '$halt'(N) - ; throw(error(domain_error(exit_code, N), halt/1)) - ). + ( var(N) -> + throw(error(instantiation_error, halt/1)) % 8.17.4.3 a) + ; \+ integer(N) -> + throw(error(type_error(integer, N), halt/1)) % 8.17.4.3 b) + ; -2^31 =< N, N =< 2^31 - 1 -> + '$halt'(N) + ; throw(error(domain_error(exit_code, N), halt/1)) + ). atom_length(Atom, Length) :- ( var(Atom) ->