@@ -535,6 +535,9 @@ let is_rec_module id md =
535
535
Btype. unmark_iterators.it_module_declaration Btype. unmark_iterators md;
536
536
rs
537
537
538
+ let secretly_the_same_path env path1 path2 =
539
+ let norm path = Printtyp. rewrite_double_underscore_paths env path in
540
+ Path. same (norm path1) (norm path2)
538
541
539
542
let () =
540
543
reg_show_prim " show_module"
@@ -544,19 +547,22 @@ let () =
544
547
| Pident id -> id
545
548
| _ -> id
546
549
in
547
- let rec accum_aliases md acc =
548
- let acc rs =
550
+ let rec accum_aliases path md acc =
551
+ let def rs =
549
552
Sig_module (id, Mp_present ,
550
553
{md with md_type = trim_signature md.md_type},
551
- rs, Exported ) :: acc in
554
+ rs, Exported ) in
552
555
match md.md_type with
553
- | Mty_alias path ->
554
- let md = Env. find_module path env in
555
- accum_aliases md (acc Trec_not )
556
+ | Mty_alias new_path ->
557
+ let md = Env. find_module new_path env in
558
+ accum_aliases new_path md
559
+ (if secretly_the_same_path env path new_path
560
+ then acc
561
+ else def Trec_not :: acc)
556
562
| Mty_ident _ | Mty_signature _ | Mty_functor _ ->
557
- List. rev (acc (is_rec_module id md))
563
+ List. rev (def (is_rec_module id md) :: acc )
558
564
in
559
- accum_aliases md []
565
+ accum_aliases path md []
560
566
)
561
567
" Print the signature of the corresponding module."
562
568
@@ -568,16 +574,19 @@ let () =
568
574
| Pident id -> id
569
575
| _ -> id
570
576
in
571
- let rec accum_defs mtd acc =
572
- let acc = Sig_modtype (id, mtd, Exported ) :: acc in
577
+ let rec accum_defs path mtd acc =
578
+ let def = Sig_modtype (id, mtd, Exported ) in
573
579
match mtd.mtd_type with
574
- | Some (Mty_ident path ) ->
575
- let mtd = Env. find_modtype path env in
576
- accum_defs mtd acc
580
+ | Some (Mty_ident new_path ) ->
581
+ let mtd = Env. find_modtype new_path env in
582
+ accum_defs new_path mtd
583
+ (if secretly_the_same_path env path new_path
584
+ then acc
585
+ else def :: acc)
577
586
| None | Some (Mty_alias _ | Mty_signature _ | Mty_functor _ ) ->
578
- List. rev acc
587
+ List. rev (def :: acc)
579
588
in
580
- accum_defs mtd []
589
+ accum_defs path mtd []
581
590
)
582
591
" Print the signature of the corresponding module type."
583
592
0 commit comments