diff options
| author | Jun FURUSE / 古瀬 淳 <jun.furuse@gmail.com> | 2002-06-28 12:13:45 +0000 |
|---|---|---|
| committer | Jun FURUSE / 古瀬 淳 <jun.furuse@gmail.com> | 2002-06-28 12:13:45 +0000 |
| commit | feb9672e2f19e2df20a75417dbdcd5895a0facac (patch) | |
| tree | 81748f22740d7380f7830ec72809490a1820e6a6 | |
| parent | e44a179ce932c3bc012103de9ff3e2afe7c6c1cb (diff) | |
| download | ocaml-feb9672e2f19e2df20a75417dbdcd5895a0facac.tar.gz | |
printing dynamic modified
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/dynamics@4967 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
| -rw-r--r-- | toplevel/genprintval.ml | 14 |
1 files 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, [], _) |
