count a unit among its own imports

Two modules importing each other with pub hand the unit its own
interface back, and its types were defined twice.
This commit is contained in:
2026-10-19 14:18:56 +03:00
parent 2d7f58e15e
commit 2b88286411
6 changed files with 46 additions and 3 deletions

View File

@@ -33,6 +33,9 @@
;;; book its siblings page, with `pub', and spine, without. A pub macro
;;; of page's expands into a private one, which crosses with it.
;;;
;;; Two modules may import each other with `pub': cycle/a and cycle/b,
;;; whose interfaces each import the other back.
;;;
;;; csi -s check.scm
(import scheme
@@ -83,6 +86,15 @@
'("pages 2 3" "number 2")
(output-of "./shelf-app"))
(test-assert "modules importing each other with pub compile"
(and (output-of sexc "cycle/a.sex" "-c" "-o" "cycle-a.o")
(output-of sexc "cycle/b.sex" "-c" "-o" "cycle-b.o")
(output-of sexc "cycle-app.sex" "-o" "cycle-app" "--" "cycle-a.o" "cycle-b.o")))
(test "and the app runs through them"
'("cycle 1 2")
(output-of "./cycle-app"))
(test "the app runs through both"
'("hello, world"
"hello, sex"
@@ -100,6 +112,7 @@
(output-of "./greet-app"))
(for-each delete-file* '("greet.o" "ledger.o" "greet-app" "greet-app.d"
"page.o" "book.o" "shelf-app"))
"page.o" "book.o" "shelf-app"
"cycle-a.o" "cycle-b.o" "cycle-app"))
(test-exit)