summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJacques Garrigue <garrigue at math.nagoya-u.ac.jp>2013-04-24 11:02:49 +0000
committerJacques Garrigue <garrigue at math.nagoya-u.ac.jp>2013-04-24 11:02:49 +0000
commitb20679022a37d78a22df65023a434b1b54cfaba0 (patch)
treef7d86bc5407c64f90ae35a0846c0c16ae8dcd4c4
parent1d1d751326b022f72be552e51ca825e0c667e1ec (diff)
printing of anonymous type parameters after strengthening
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13603 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
-rw-r--r--testsuite/tests/typing-gadts/test.ml6
-rw-r--r--testsuite/tests/typing-gadts/test.ml.principal.reference3
-rw-r--r--testsuite/tests/typing-gadts/test.ml.reference3
-rw-r--r--typing/printtyp.ml11
4 files changed, 23 insertions, 0 deletions
diff --git a/testsuite/tests/typing-gadts/test.ml b/testsuite/tests/typing-gadts/test.ml
index 3ba7cc8b8..dc219f421 100644
--- a/testsuite/tests/typing-gadts/test.ml
+++ b/testsuite/tests/typing-gadts/test.ml
@@ -512,3 +512,9 @@ let f : type a. a ty -> a =
let g : type a. a ty -> a =
let () = () in
fun x -> match x with Int y -> y;;
+
+(* Printing of anonymous variables *)
+
+module M = struct type _ t = int end;;
+module M = struct type _ t = T : int t end;;
+module N = M;;
diff --git a/testsuite/tests/typing-gadts/test.ml.principal.reference b/testsuite/tests/typing-gadts/test.ml.principal.reference
index 0a59d045f..21f8526d2 100644
--- a/testsuite/tests/typing-gadts/test.ml.principal.reference
+++ b/testsuite/tests/typing-gadts/test.ml.principal.reference
@@ -309,4 +309,7 @@ Error: This expression has type < bar : int; foo : int; .. > as 'a
# type 'a ty = Int : int -> int ty
# val f : 'a ty -> 'a = <fun>
# val g : 'a ty -> 'a = <fun>
+# module M : sig type _ t = int end
+# module M : sig type _ t = T : int t end
+# module N : sig type 'a t = 'a M.t = T : int t end
#
diff --git a/testsuite/tests/typing-gadts/test.ml.reference b/testsuite/tests/typing-gadts/test.ml.reference
index a226a2a49..3b84f9240 100644
--- a/testsuite/tests/typing-gadts/test.ml.reference
+++ b/testsuite/tests/typing-gadts/test.ml.reference
@@ -295,4 +295,7 @@ Error: This expression has type < bar : int; foo : int; .. > as 'a
# type 'a ty = Int : int -> int ty
# val f : 'a ty -> 'a = <fun>
# val g : 'a ty -> 'a = <fun>
+# module M : sig type _ t = int end
+# module M : sig type _ t = T : int t end
+# module N : sig type 'a t = 'a M.t = T : int t end
#
diff --git a/typing/printtyp.ml b/typing/printtyp.ml
index fe94d8fb9..dad5a13c2 100644
--- a/typing/printtyp.ml
+++ b/typing/printtyp.ml
@@ -683,6 +683,17 @@ let rec tree_of_type_decl id decl =
let params = filter_params decl.type_params in
+ begin match decl.type_manifest with
+ | Some ty ->
+ let vars = free_variables ty in
+ List.iter
+ (function {desc = Tvar (Some "_")} as ty ->
+ if List.memq ty vars then ty.desc <- Tvar None
+ | _ -> ())
+ params
+ | None -> ()
+ end;
+
List.iter add_alias params;
List.iter mark_loops params;
List.iter check_name_of_type (List.map proxy params);