about summary refs log tree commit diff
path: root/src/boot
diff options
context:
space:
mode:
Diffstat (limited to 'src/boot')
-rw-r--r--src/boot/fe/ast.ml11
-rw-r--r--src/boot/me/semant.ml2
2 files changed, 12 insertions, 1 deletions
diff --git a/src/boot/fe/ast.ml b/src/boot/fe/ast.ml
index 78b3ac51a97..f81f614fc82 100644
--- a/src/boot/fe/ast.ml
+++ b/src/boot/fe/ast.ml
@@ -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:
  *
diff --git a/src/boot/me/semant.ml b/src/boot/me/semant.ml
index 0bb6a8bbeab..4f278d12745 100644
--- a/src/boot/me/semant.ml
+++ b/src/boot/me/semant.ml
@@ -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