mirror of
https://github.com/idris-lang/Idris2.git
synced 2024-11-28 11:05:17 +03:00
parent
d4263441b7
commit
e15c78ce9e
@ -85,11 +85,14 @@ mkModTree loc done modFP mod
|
||||
do file <- maybe (nsToSource loc mod) pure modFP
|
||||
modInfo <- readHeader file mod
|
||||
let imps = map path (imports modInfo)
|
||||
ms <- traverse (mkModTree loc (mod :: done) Nothing) imps
|
||||
let mt = MkModTree mod (Just file) ms
|
||||
all <- get AllMods
|
||||
put AllMods ((mod, mt) :: all)
|
||||
pure mt
|
||||
if mod `elem` imps
|
||||
then coreFail $ CyclicImports [mod, mod]
|
||||
else do
|
||||
ms <- traverse (mkModTree loc (mod :: done) Nothing) imps
|
||||
let mt = MkModTree mod (Just file) ms
|
||||
all <- get AllMods
|
||||
put AllMods ((mod, mt) :: all)
|
||||
pure mt
|
||||
Just m => pure m)
|
||||
-- Couldn't find source, assume it's in a package directory
|
||||
(\err =>
|
||||
|
@ -194,7 +194,7 @@ idrisTests = MkTestPool "Misc" [] Nothing
|
||||
-- Eta equality
|
||||
"eta001",
|
||||
-- Modules and imports
|
||||
"import001", "import002", "import003", "import004", "import005",
|
||||
"import001", "import002", "import003", "import004", "import005", "import006",
|
||||
-- Implicit laziness, lazy evaluation
|
||||
"lazy001", "lazy002",
|
||||
-- Namespace blocks
|
||||
|
3
tests/idris2/import006/A/B.idr
Normal file
3
tests/idris2/import006/A/B.idr
Normal file
@ -0,0 +1,3 @@
|
||||
module A.B
|
||||
|
||||
import A.B
|
3
tests/idris2/import006/A/C.idr
Normal file
3
tests/idris2/import006/A/C.idr
Normal file
@ -0,0 +1,3 @@
|
||||
module A.C
|
||||
|
||||
import A.B
|
3
tests/idris2/import006/cyclic.ipkg
Normal file
3
tests/idris2/import006/cyclic.ipkg
Normal file
@ -0,0 +1,3 @@
|
||||
package cyclic
|
||||
|
||||
modules = A.B, A.C
|
1
tests/idris2/import006/expected
Normal file
1
tests/idris2/import006/expected
Normal file
@ -0,0 +1 @@
|
||||
Uncaught error: Module imports form a cycle: A.B -> A.B
|
3
tests/idris2/import006/run
Normal file
3
tests/idris2/import006/run
Normal file
@ -0,0 +1,3 @@
|
||||
rm -rf build
|
||||
|
||||
$1 --no-color --console-width 0 --no-banner --build cyclic.ipkg
|
Loading…
Reference in New Issue
Block a user