detect character type errors in atom_{chars|codes}/2 (#1472)
This commit is contained in:
@@ -1258,10 +1258,12 @@ atom_chars(Atom, List) :-
|
|||||||
( var(Tail) ->
|
( var(Tail) ->
|
||||||
throw(error(instantiation_error, atom_chars/2))
|
throw(error(instantiation_error, atom_chars/2))
|
||||||
; ground(List) ->
|
; ground(List) ->
|
||||||
|
chars_or_vars(List, atom_chars/2),
|
||||||
'$atom_chars'(Atom, List)
|
'$atom_chars'(Atom, List)
|
||||||
; throw(error(instantiation_error, atom_chars/2))
|
; throw(error(instantiation_error, atom_chars/2))
|
||||||
)
|
)
|
||||||
; atom(Atom) ->
|
; atom(Atom) ->
|
||||||
|
chars_or_vars(List, atom_chars/2),
|
||||||
'$atom_chars'(Atom, List)
|
'$atom_chars'(Atom, List)
|
||||||
; throw(error(type_error(atom, Atom), atom_chars/2))
|
; throw(error(type_error(atom, Atom), atom_chars/2))
|
||||||
).
|
).
|
||||||
@@ -1275,11 +1277,13 @@ atom_codes(Atom, List) :-
|
|||||||
( var(Atom) ->
|
( var(Atom) ->
|
||||||
( var(Tail) ->
|
( var(Tail) ->
|
||||||
throw(error(instantiation_error, atom_codes/2))
|
throw(error(instantiation_error, atom_codes/2))
|
||||||
; ground(List), Tail == [] ->
|
; ground(List) ->
|
||||||
|
codes_or_vars(List, atom_codes/2),
|
||||||
'$atom_codes'(Atom, List)
|
'$atom_codes'(Atom, List)
|
||||||
; throw(error(instantiation_error, atom_codes/2))
|
; throw(error(instantiation_error, atom_codes/2))
|
||||||
)
|
)
|
||||||
; atom(Atom) ->
|
; atom(Atom) ->
|
||||||
|
codes_or_vars(List, atom_codes/2),
|
||||||
'$atom_codes'(Atom, List)
|
'$atom_codes'(Atom, List)
|
||||||
; throw(error(type_error(atom, Atom), atom_codes/2))
|
; throw(error(type_error(atom, Atom), atom_codes/2))
|
||||||
).
|
).
|
||||||
|
|||||||
Reference in New Issue
Block a user