instead of a type error, use a domain error

The preceding use of atom_length/2 already ensures that C has the
correct type (i.e., atom). However, its domain may still be wrong,
if its length is greater than 1.
This commit is contained in:
Markus Triska
2020-04-18 14:38:03 +02:00
parent 105e9c8e88
commit 1f7e18f2a9

View File

@@ -61,7 +61,7 @@ get_single_char(C) :-
( var(C) -> '$get_single_char'(C)
; C == end_of_file -> '$get_single_char'(C)
; atom_length(C, 1) -> '$get_single_char'(C)
; throw(error(type_error(in_character, C), get_char/1))
; throw(error(domain_error(in_character, C), get_char/1))
).