]> Repositorios git - scryer-prolog.git/commitdiff
Fix halt/1 built-in predicate for ISO Prolog Core standard compliance
authorPaulo Moura <[email protected]>
Sun, 6 Mar 2022 21:33:49 +0000 (21:33 +0000)
committerPaulo Moura <[email protected]>
Sun, 6 Mar 2022 21:33:49 +0000 (21:33 +0000)
src/lib/builtins.pl

index e21d441e076b1379d9d2a8788f99733e15ccdfe1..7dce699ac8ecd1285e6da7e29871cbd1558cd377 100644 (file)
@@ -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)  ->