Browse Source

[display] don't forget about sub-types when cleaning up

Simon Krajewski 7 years ago
parent
commit
f53b200fc1
1 changed files with 12 additions and 2 deletions
  1. 12 2
      src/compiler/main.ml

+ 12 - 2
src/compiler/main.ml

@@ -836,8 +836,18 @@ try
 					(* Tricky stuff: We want to remove the module from our lookups and load it again in
 					   display mode. This covers some cases like --macro typing it in non-display mode (issue #7017). *)
 					if clear then begin
-						Hashtbl.remove mctx.g.modules cpath;
-						Hashtbl.remove mctx.g.types_module cpath;
+						begin try
+							let m = Hashtbl.find mctx.g.modules cpath in
+							Hashtbl.remove mctx.g.modules cpath;
+							Hashtbl.remove mctx.g.types_module cpath;
+							List.iter (fun mt ->
+								let ti = t_infos mt in
+								Hashtbl.remove mctx.g.modules ti.mt_path;
+								Hashtbl.remove mctx.g.types_module ti.mt_path;
+							) m.m_types
+						with Not_found ->
+							()
+						end;
 					end;
 					let _ = MacroContext.load_macro_module tctx cpath true p in
 					Finalization.finalize mctx;