diff --git a/toplevel/toploop.ml b/toplevel/toploop.ml index 6a83bcc9cf86..f3b5851885fe 100644 --- a/toplevel/toploop.ml +++ b/toplevel/toploop.ml @@ -218,8 +218,10 @@ let execute_phrase print_outcome ppf phr = | Ptop_def sstr -> let oldenv = !toplevel_env in Typecore.reset_delayed_checks (); - let (str, sg, newenv) = Typemod.type_structure oldenv sstr Location.none - in + let (str, sg, newenv) = + Typemod.type_structure oldenv sstr Location.none in + let _ = + Includemod.compunit "//toplevel//" sg "(inferred signature)" sg in Typecore.force_delayed_checks (); let lam = Translmod.transl_toplevel_definition str in Warnings.check_fatal (); diff --git a/typing/typedecl.ml b/typing/typedecl.ml index cfcf55126b06..7aa060c30079 100644 --- a/typing/typedecl.ml +++ b/typing/typedecl.ml @@ -766,12 +766,17 @@ let transl_type_decl env name_sdecl_list = (fun old_callback -> match !current_slot with | Some slot -> slot := (name, td) :: !slot - | None -> List.iter (fun (name, d) -> Env.mark_type_used name d) (get_ref slot); old_callback () + | None -> + List.iter (fun (name, d) -> Env.mark_type_used name d) + (get_ref slot); + old_callback () ); id, Some slot in - let transl_declaration name_sdecl (id, slot) = current_slot := slot; transl_declaration temp_env name_sdecl id in - let decls = List.map2 transl_declaration name_sdecl_list (List.map id_slots id_list) in + let transl_declaration name_sdecl (id, slot) = + current_slot := slot; transl_declaration temp_env name_sdecl id in + let decls = + List.map2 transl_declaration name_sdecl_list (List.map id_slots id_list) in current_slot := None; (* Check for duplicates *) check_duplicates name_sdecl_list;