Browse Source

raise DisplayTypes if `Type_not_found` occurs in display mode with a known module (see #3288)

Simon Krajewski 11 năm trước cách đây
mục cha
commit
56bc8ab66d
1 tập tin đã thay đổi với 9 bổ sung0 xóa
  1. 9 0
      typer.ml

+ 9 - 0
typer.ml

@@ -3442,6 +3442,15 @@ and handle_display ctx e iscall p =
 		raise (Parser.TypePath ([n],None))
 	| Error (Unknown_ident "trace",_) ->
 		raise (DisplayTypes [tfun [t_dynamic] ctx.com.basic.tvoid])
+	| Error (Type_not_found (path,s),_) as err ->
+		begin try
+			let m = Hashtbl.find ctx.g.modules path in
+			let tl = List.filter (fun t -> not (t_infos t).mt_private) m.m_types in
+			let tl = List.map type_of_module_type tl in
+			raise (DisplayTypes tl)
+		with Not_found ->
+			raise err
+		end
 	in
 	ctx.in_display <- old;
 	let handle_field cf =