]> Repositorios git - scryer-prolog.git/commitdiff
ENHANCED: Correct type error for char_type/2.
authorMarkus Triska <[email protected]>
Mon, 29 Nov 2021 18:32:55 +0000 (19:32 +0100)
committerMarkus Triska <[email protected]>
Mon, 29 Nov 2021 18:33:22 +0000 (19:33 +0100)
This addresses #905.

src/lib/charsio.pl

index 5ff611f669c07e92daf01b6efdf8f9fb704a984d..8585681033fecdf12617b85adb49eef026dc84bf 100644 (file)
@@ -66,8 +66,7 @@ extend_var_list_([V|Vs], N, VarList, NewVarList, VarType) :-
 
 
 char_type(Char, Type) :-
-    (   var(Char) -> instantiation_error(char_type/2)
-    ;   atom_length(Char, 1) ->
+        must_be(character, Char),
         (   ground(Type) ->
             (   ctype(Type) ->
                 '$char_type'(Char, Type)
@@ -75,9 +74,7 @@ char_type(Char, Type) :-
             )
         ;   ctype(Type),
             '$char_type'(Char, Type)
-        )
-    ;   type_error(in_character, Char, char_type/2)
-    ).
+        ).
 
 
 ctype(alnum).