From: Paulo Moura <> Date: Mon, 10 May 2021 20:27:04 +0000 (+0100) Subject: Fix char_code/2 predicate wrong error term when the first argument is bound but is... X-Git-Tag: v0.9.0~73^2 X-Git-Url: https://git.sagredo.dev/?a=commitdiff_plain;h=8acbdfbf1deed992f9761bebd4d9ce81d15e38ce;p=scryer-prolog.git Fix char_code/2 predicate wrong error term when the first argument is bound but is not an atom --- diff --git a/src/lib/builtins.pl b/src/lib/builtins.pl index 9643d899..ff08ca9d 100644 --- a/src/lib/builtins.pl +++ b/src/lib/builtins.pl @@ -1296,6 +1296,8 @@ char_code(Char, Code) :- '$char_code'(Char, Code) ; throw(error(type_error(integer, Code), char_code/2)) ) + ; \+ atom(Char) -> + throw(error(type_error(character, Char), char_code/2)) ; atom_length(Char, 1) -> ( var(Code) -> '$char_code'(Char, Code)