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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user