소스 검색

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

Simon Krajewski 11 년 전
부모
커밋
56bc8ab66d
1개의 변경된 파일9개의 추가작업 그리고 0개의 파일을 삭제
  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 =