Merge pull request #946 from pmoura/fix_char_code_predicate_error_term_on_bould_non_atom_first_argument

Fix char_code/2 predicate wrong error term when the first argument is bound but is not an atom
This commit is contained in:
Mark Thom
2021-05-10 14:42:13 -06:00
committed by GitHub

View File

@@ -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)