Skip to content

Commit

Permalink
Merge pull request #1319 from GaloisInc/T1313
Browse files Browse the repository at this point in the history
Make `:module` work more like `:load`.
  • Loading branch information
yav authored Feb 8, 2022
2 parents 413788c + 2d1f2c1 commit 335216f
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 9 deletions.
15 changes: 12 additions & 3 deletions src/Cryptol/REPL/Command.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1124,9 +1124,18 @@ moduleCmd :: String -> REPL ()
moduleCmd modString
| null modString = return ()
| otherwise = do
case parseModName modString of
Just m -> loadHelper (M.loadModuleByName m)
Nothing -> rPutStrLn "Invalid module name."
case parseModName modString of
Just m
| M.isParamInstModName m -> loadHelper (M.loadModuleByName m)
| otherwise ->
do mpath <- liftModuleCmd (M.findModule m)
case mpath of
M.InFile file ->
do setEditPath file
setLoadedMod LoadedModule { lName = Just m, lPath = mpath }
loadHelper (M.loadModuleByPath file)
M.InMem {} -> loadHelper (M.loadModuleByName m)
Nothing -> rPutStrLn "Invalid module name."

loadPrelude :: REPL ()
loadPrelude = moduleCmd $ show $ pp M.preludeName
Expand Down
2 changes: 1 addition & 1 deletion tests/modsys/T14.icry.stdout
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Loading module Cryptol

Parse error at ./T14/Main.cry:3:9,
Parse error at T14/Main.cry:3:9,
unexpected: MalformedUtf8
2 changes: 1 addition & 1 deletion tests/modsys/T14.icry.stdout.mingw32
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Loading module Cryptol

Parse error at .\T14\Main.cry:3:9,
Parse error at T14\Main.cry:3:9,
unexpected: MalformedUtf8
2 changes: 1 addition & 1 deletion tests/modsys/T16.icry.stdout
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Loading module Cryptol
Loading module T16::A
Loading module T16::B

[error] at ./T16/B.cry:5:5--5:11
[error] at T16/B.cry:5:5--5:11
Multiple definitions for symbol: update
(at Cryptol:899:11--899:17, update)
(at ./T16/A.cry:3:1--3:7, T16::A::update)
2 changes: 1 addition & 1 deletion tests/modsys/T16.icry.stdout.mingw32
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Loading module Cryptol
Loading module T16::A
Loading module T16::B

[error] at .\T16\B.cry:5:5--5:11
[error] at T16\B.cry:5:5--5:11
Multiple definitions for symbol: update
(at Cryptol:899:11--899:17, update)
(at .\T16\A.cry:3:1--3:7, T16::A::update)
2 changes: 1 addition & 1 deletion tests/modsys/T18.icry.stdout
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Loading module T18::A
Loading module T18::A1
Loading module T18::B

[error] at ./T18/B.cry:6:5--6:6
[error] at T18/B.cry:6:5--6:6
Multiple definitions for symbol: u
(at ./T18/A.cry:3:1--3:2, T18::A::u)
(at ./T18/A1.cry:3:1--3:2, T18::A1::u)
2 changes: 1 addition & 1 deletion tests/modsys/T18.icry.stdout.mingw32
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Loading module T18::A
Loading module T18::A1
Loading module T18::B

[error] at .\T18\B.cry:6:5--6:6
[error] at T18\B.cry:6:5--6:6
Multiple definitions for symbol: u
(at .\T18\A.cry:3:1--3:2, T18::A::u)
(at .\T18\A1.cry:3:1--3:2, T18::A1::u)

0 comments on commit 335216f

Please sign in to comment.