Fix char_code/2 predicate wrong error term when the first argument is bound but is not an atom

This commit is contained in:
Paulo Moura
2021-05-10 21:27:04 +01:00
parent 6eb36226b1
commit 8acbdfbf1d

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)