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)
|
'$char_code'(Char, Code)
|
||||||
; throw(error(type_error(integer, Code), char_code/2))
|
; throw(error(type_error(integer, Code), char_code/2))
|
||||||
)
|
)
|
||||||
|
; \+ atom(Char) ->
|
||||||
|
throw(error(type_error(character, Char), char_code/2))
|
||||||
; atom_length(Char, 1) ->
|
; atom_length(Char, 1) ->
|
||||||
( var(Code) ->
|
( var(Code) ->
|
||||||
'$char_code'(Char, Code)
|
'$char_code'(Char, Code)
|
||||||
|
|||||||
Reference in New Issue
Block a user