|
@@ -3784,9 +3784,11 @@ let make_generic ctx ps pt p =
|
|
in
|
|
in
|
|
let name =
|
|
let name =
|
|
String.concat "_" (List.map2 (fun (s,_) t ->
|
|
String.concat "_" (List.map2 (fun (s,_) t ->
|
|
|
|
+ let rec subst s = "_" ^ string_of_int (Char.code (String.get (Str.matched_string s) 0)) ^ "_" in
|
|
|
|
+ let ident_safe = Str.global_substitute (Str.regexp "[^a-zA-Z0-9_]") subst in
|
|
let s_type_path_underscore (p,s) = match p with [] -> s | _ -> String.concat "_" p ^ "_" ^ s in
|
|
let s_type_path_underscore (p,s) = match p with [] -> s | _ -> String.concat "_" p ^ "_" ^ s in
|
|
let rec loop top t = match follow t with
|
|
let rec loop top t = match follow t with
|
|
- | TInst(c,tl) -> (s_type_path_underscore c.cl_path) ^ (loop_tl tl)
|
|
|
|
|
|
+ | TInst(c,tl) -> (ident_safe (s_type_path_underscore c.cl_path)) ^ (loop_tl tl)
|
|
| TEnum(en,tl) -> (s_type_path_underscore en.e_path) ^ (loop_tl tl)
|
|
| TEnum(en,tl) -> (s_type_path_underscore en.e_path) ^ (loop_tl tl)
|
|
| TAbstract(a,tl) -> (s_type_path_underscore a.a_path) ^ (loop_tl tl)
|
|
| TAbstract(a,tl) -> (s_type_path_underscore a.a_path) ^ (loop_tl tl)
|
|
| _ when not top -> "_" (* allow unknown/incompatible types as type parameters to retain old behavior *)
|
|
| _ when not top -> "_" (* allow unknown/incompatible types as type parameters to retain old behavior *)
|