name_of_type now replaces non-identifiers by dummy names.
authorberghofe
Wed, 13 Nov 2002 15:27:27 +0100
changeset 13707 55670a70a5f9
parent 13706 9d84cfc77ace
child 13708 a3a410782c95
name_of_type now replaces non-identifiers by dummy names.
src/HOL/Tools/datatype_aux.ML
--- a/src/HOL/Tools/datatype_aux.ML	Wed Nov 13 15:26:19 2002 +0100
+++ b/src/HOL/Tools/datatype_aux.ML	Wed Nov 13 15:27:27 2002 +0100
@@ -224,8 +224,11 @@
 
 fun dest_TFree (TFree (n, _)) = n;
 
-fun name_of_typ (Type (s, Ts)) = space_implode "_"
-      (filter (not o equal "") (map name_of_typ Ts) @ [Sign.base_name s])
+fun name_of_typ (Type (s, Ts)) =
+      let val s' = Sign.base_name s
+      in space_implode "_" (filter (not o equal "") (map name_of_typ Ts) @
+        [if Symbol.is_identifier s' then s' else "x"])
+      end
   | name_of_typ _ = "";
 
 fun dtyp_of_typ _ (TFree (n, _)) = DtTFree n