Make :m work the same way as :l

More precisely, in both cases we unload all modules and then reload
everything (this is what `:l` used to do, while `:m` only reloaded
the current module).  This fixes #668.

There are opportunities to be smarter here: in particular when we
reload modules, we do need to parse them so that we can find out what
their dependencies are, and if needed to reload those.  However, if
none of the dependencies have changed, and we didn't change, then we
could reuse the current module.  This could be quite useful for modules
that take a long time to load.
This commit is contained in:
Iavor Diatchki 2020-07-07 15:34:03 -07:00
parent be408d7bfe
commit 372d2bf3aa
18 changed files with 18 additions and 1 deletions

View File

@ -70,7 +70,7 @@ loadModuleByPath path (evo,env) = runModuleM (evo,resetModuleEnv env) $ do
-- | Load the given parsed module.
loadModuleByName :: P.ModName -> ModuleCmd (ModulePath,T.Module)
loadModuleByName n env = runModuleM env $ do
loadModuleByName n (evo,env) = runModuleM (evo,resetModuleEnv env) $ do
unloadModule ((n ==) . lmName)
(path,m') <- Base.loadModuleFrom (FromModule n)
setFocusedModule (T.mName m')

View File

@ -1,4 +1,5 @@
Loading module Cryptol
Loading module Cryptol
Loading module issue290
Loading module issue290bar
Showing a specific instance of polymorphic result:

View File

@ -1,3 +1,4 @@
Loading module Cryptol
Loading module Cryptol
Loading module T1::Main
0x02

View File

@ -1,4 +1,5 @@
Loading module Cryptol
Loading module Cryptol
Loading module T10::Main
Symbols
=======

View File

@ -1,3 +1,4 @@
Loading module Cryptol
Loading module Cryptol
Loading module T11::A
Loading module T11::Main

View File

@ -1,3 +1,4 @@
Loading module Cryptol
Loading module Cryptol
Loading module T12::A
Loading module T12::Main

View File

@ -1,4 +1,5 @@
Loading module Cryptol
Loading module Cryptol
Loading module T13::A
Loading module T13::B
Loading module T13::Main

View File

@ -1,4 +1,5 @@
Loading module Cryptol
Loading module Cryptol
Loading module T2::A
Loading module T2::Main
0x00

View File

@ -1,4 +1,5 @@
Loading module Cryptol
Loading module Cryptol
Loading module T3::A
[error] Import of a non-instantiated parameterized module: T3::A

View File

@ -1,4 +1,5 @@
Loading module Cryptol
Loading module Cryptol
Loading module T4::A
Loading module T4::Main
main : T

View File

@ -1,4 +1,5 @@
Loading module Cryptol
Loading module Cryptol
Loading module T5::A
Loading module T5::B
Loading module T5::Main

View File

@ -1,4 +1,5 @@
Loading module Cryptol
Loading module Cryptol
Loading module T5::A
Loading module T5::B
Loading module T5::Main

View File

@ -1,4 +1,5 @@
Loading module Cryptol
Loading module Cryptol
Loading module T7::Main
Expression depends on definitions from a parameterized module:

View File

@ -1,3 +1,4 @@
Loading module Cryptol
Loading module Cryptol
Loading module T8::Main
f : {x : [8]} -> [8]

View File

@ -1,4 +1,5 @@
Loading module Cryptol
Loading module Cryptol
Loading module T9::A
Loading module T9::Main
main : [16]

View File

@ -1,4 +1,5 @@
Loading module Cryptol
Loading module Cryptol
Loading module Array
Primitive Types
===============

View File

@ -1,4 +1,5 @@
Loading module Cryptol
Loading module Cryptol
Loading module Float
Loading module FloatTests
"-- Float Formatting-----------------------------------------------------------"

View File

@ -1,4 +1,5 @@
Loading module Cryptol
Loading module Cryptol
Loading module r03
Satisfiable
True