From feb933b32c436fc0d04f9390f63edcad0e55cfee Mon Sep 17 00:00:00 2001 From: letouzey Date: Thu, 21 Mar 2013 10:37:07 +0000 Subject: Printmod: fresh fake namespaces for non-visible modules (fix #2668, #2983) git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@16328 85f007b7-540e-0410-9357-904b9bb8a0f7 --- printing/printmod.ml | 9 ++++++++- test-suite/bugs/closed/shouldsucceed/2668.v | 6 ++++++ test-suite/bugs/closed/shouldsucceed/2983.v | 8 ++++++++ 3 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 test-suite/bugs/closed/shouldsucceed/2668.v create mode 100644 test-suite/bugs/closed/shouldsucceed/2983.v diff --git a/printing/printmod.ml b/printing/printmod.ml index 0c28e64f6..e9fc35e2f 100644 --- a/printing/printmod.ml +++ b/printing/printmod.ml @@ -69,8 +69,15 @@ let print_kn locals kn = with Not_found -> print_modpath locals kn +(** Each time we have to print a non-globally visible structure, + we place its elements in a fake fresh namespace. *) + +let mk_fake_top = + let r = ref 0 in + fun () -> incr r; Id.of_string ("FAKETOP"^(string_of_int !r)) + let nametab_register_dir mp = - let id = Id.of_string "FAKETOP" in + let id = mk_fake_top () in let fp = Libnames.make_path DirPath.empty id in let dir = DirPath.make [id] in Nametab.push_dir (Nametab.Until 1) dir (DirModule (dir,(mp,DirPath.empty))); diff --git a/test-suite/bugs/closed/shouldsucceed/2668.v b/test-suite/bugs/closed/shouldsucceed/2668.v new file mode 100644 index 000000000..74c8fa347 --- /dev/null +++ b/test-suite/bugs/closed/shouldsucceed/2668.v @@ -0,0 +1,6 @@ +Require Import MSetPositive. +Require Import MSetProperties. + +Module Pos := MSetPositive.PositiveSet. +Module PPPP := MSetProperties.WPropertiesOn(Pos). +Print Module PPPP. \ No newline at end of file diff --git a/test-suite/bugs/closed/shouldsucceed/2983.v b/test-suite/bugs/closed/shouldsucceed/2983.v new file mode 100644 index 000000000..15598352b --- /dev/null +++ b/test-suite/bugs/closed/shouldsucceed/2983.v @@ -0,0 +1,8 @@ +Module Type ModA. +End ModA. +Module Type ModB(A : ModA). +End ModB. +Module Foo(A : ModA)(B : ModB A). +End Foo. + +Print Module Foo. \ No newline at end of file -- cgit v1.2.3