rustboot: Don't use ridiculous type names when describing simple types like int and uint
This commit is contained in:
parent
a7840f02b0
commit
194f38fdff
@ -516,6 +516,17 @@ let sane_name (n:name) : bool =
|
||||
| NAME_ext (prefix, _) -> sane_prefix prefix
|
||||
;;
|
||||
|
||||
(* Error messages always refer to simple types structurally, not by their
|
||||
* user-defined names. *)
|
||||
let rec ty_is_simple (ty:ty) : bool =
|
||||
match ty with
|
||||
TY_any | TY_nil | TY_bool | TY_mach _ | TY_int | TY_uint | TY_char
|
||||
| TY_str | TY_task | TY_type -> true
|
||||
| TY_vec ty | TY_chan ty | TY_port ty -> ty_is_simple ty
|
||||
| TY_tup tys -> List.for_all ty_is_simple (Array.to_list tys)
|
||||
| _ -> false
|
||||
;;
|
||||
|
||||
(*
|
||||
* We have multiple subset-categories of expression:
|
||||
*
|
||||
|
@ -971,7 +971,7 @@ let ty_fold_rebuild (id:Ast.ty -> Ast.ty)
|
||||
|
||||
let rec pretty_ty_str (cx:ctxt) (fallback:(Ast.ty -> string)) (ty:Ast.ty) =
|
||||
let cache = cx.ctxt_user_type_names in
|
||||
if Hashtbl.mem cache ty then
|
||||
if not (Ast.ty_is_simple ty) && Hashtbl.mem cache ty then
|
||||
let names = List.map (Ast.sprintf_name ()) (Hashtbl.find_all cache ty) in
|
||||
String.concat " = " names
|
||||
else
|
||||
|
Loading…
x
Reference in New Issue
Block a user