diff --git a/src/session/controller_itp.ml b/src/session/controller_itp.ml index 94d46e6c4733398288ef507c0f6cf17d7eedb8f2..92ec1e4252e55a1b39abfb3b573fd526fee0004a 100644 --- a/src/session/controller_itp.ml +++ b/src/session/controller_itp.ml @@ -240,17 +240,25 @@ let print_session fmt c = (** reload files, associating old proof attempts and transformations to the new goals. old theories and old goals for which we cannot find a corresponding new theory resp. old goal are kept, with - tasks associated to them *) + tasks associated to them. + When [hard_reload] option is true, dependencies and drivers are also + reloaded. + *) -let reload_files (c : controller) ~shape_version = +let reload_files ?(hard_reload=false) (c : controller) ~shape_version = let old_ses = c.controller_session in + if hard_reload then begin + c.controller_env <- Env.create_env (Env.get_loadpath c.controller_env); + Whyconf.Hprover.reset c.controller_provers; + load_drivers c; + end; c.controller_session <- empty_session ~shape_version ~from:old_ses (get_dir old_ses); merge_files ~shape_version c.controller_env c.controller_session old_ses exception Errors_list of exn list -let reload_files (c: controller) ~shape_version = - let errors, b1, b2 = reload_files c ~shape_version in +let reload_files ?(hard_reload=false) (c: controller) ~shape_version = + let errors, b1, b2 = reload_files c ~shape_version ~hard_reload in match errors with | [] -> b1, b2 | _ -> raise (Errors_list errors) diff --git a/src/session/controller_itp.mli b/src/session/controller_itp.mli index 799375aed8e81926d00e7bdb626efcb7cf60a686..62ee50aa3dbd5572182d746f7115f07228808e1b 100644 --- a/src/session/controller_itp.mli +++ b/src/session/controller_itp.mli @@ -122,7 +122,8 @@ val print_session : Format.formatter -> controller -> unit exception Errors_list of exn list -val reload_files : controller -> shape_version:int option -> bool * bool +val reload_files : ?hard_reload:bool -> controller -> + shape_version:int option -> bool * bool (** [reload_files] returns a pair [(o,d)]: [o] true means there are obsolete goals, [d] means there are missed objects (goals, transformations, theories or files) that are now detached in the @@ -175,6 +176,8 @@ val reload_files : controller -> shape_version:int option -> bool * bool proof attempts and transformations, but no task is associated to it, neither to its subgoals. + When the option [hard_reload] is true (false by default), libraries and + drivers are also reloaded. *) diff --git a/src/session/itp_server.ml b/src/session/itp_server.ml index 789dba0ab627fa5717f964644804d085334cb7bb..f366a63d5f850072abb27102ff9f2eab37ac7b96 100644 --- a/src/session/itp_server.ml +++ b/src/session/itp_server.ml @@ -627,9 +627,10 @@ end (* Reload_files that is used even if the controller is not correct. It can be incorrect and end up in a correct state. *) let reload_files cont ~shape_version = + let hard_reload = true in capture_parse_or_type_errors (fun c -> - try let (_,_) = reload_files ~shape_version c in [] with + try let (_,_) = reload_files ~hard_reload ~shape_version c in [] with | Errors_list le -> le) cont let add_file cont ?format fname =