From feb9672e2f19e2df20a75417dbdcd5895a0facac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jun=20FURUSE=20/=20=E5=8F=A4=E7=80=AC=20=E6=B7=B3?= Date: Fri, 28 Jun 2002 12:13:45 +0000 Subject: printing dynamic modified git-svn-id: http://caml.inria.fr/svn/ocaml/branches/dynamics@4967 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02 --- toplevel/genprintval.ml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/toplevel/genprintval.ml b/toplevel/genprintval.ml index 7aafe8cec6..6403ebcc8b 100644 --- a/toplevel/genprintval.ml +++ b/toplevel/genprintval.ml @@ -193,8 +193,18 @@ module Make(O : OBJ)(EVP : EVALPATH with type value = O.t) = struct when Path.same path Predef.path_dyn -> let rt = (O.magic (O.field obj 1) : rtype) in let ty = Transltype.type_expr_of_run_type rt in - Oval_dynamic (tree_of_val depth (O.field obj 0) ty, - Printtyp.tree_of_type_scheme ty) + let oty = Transltype.tree_of_run_type rt in + (* try to print the content *) + let v = + try + (* run time type check ... *) + let rt' = Transltype.run_type_of_typexp env ty in + Rtype.import_comp ("",0,0) [|rt'|] ((),rt); + Some (tree_of_val depth (O.field obj 0) ty) + with + | _ -> None + in + Oval_dynamic (v, oty) /GENERIC *) (* DYN *) | Tconstr(path, [], _) -- cgit v1.2.1