expand a module's toplevel macro calls for its importers
Its interface was read as written, so pub forms a macro wrote never reached them, which list-macros' is-public? flag exists for. The module's macros, and those its imports give it, are lent for the reading and taken back after. One reading a type the module keeps to itself cannot expand there, and gives importers nothing, as before.
This commit is contained in:
@@ -36,6 +36,9 @@
|
||||
;;; Two modules may import each other with `pub': cycle/a and cycle/b,
|
||||
;;; whose interfaces each import the other back.
|
||||
;;;
|
||||
;;; gen/made writes its pub forms by macro calls, which are expanded when
|
||||
;;; its interface is read; the macros it used for that stay its own.
|
||||
;;;
|
||||
;;; csi -s check.scm
|
||||
|
||||
(import scheme
|
||||
@@ -103,6 +106,20 @@
|
||||
'("cycle 1 2")
|
||||
(output-of "./cycle-app"))
|
||||
|
||||
;;; ...it lists pub forms a macro wrote, and not the macros that wrote them
|
||||
(test "a module's interface holds what its macros wrote"
|
||||
'("(pub fn forty-two () int)" "(pub fn seven () int)"
|
||||
"(pub fn one () int)" "(pub fn two () int)")
|
||||
(output-of sexc "--public-interface" "gen/made.sex"))
|
||||
|
||||
(test-assert "and an importer links with them"
|
||||
(and (output-of sexc "gen/made.sex" "-c" "-o" "made.o")
|
||||
(output-of sexc "made-app.sex" "-o" "made-app" "--" "made.o")))
|
||||
|
||||
(test "and calls them"
|
||||
'("made 42 7 1 2")
|
||||
(output-of "./made-app"))
|
||||
|
||||
;;; ...while a realization of a spec importers cannot see is refused by
|
||||
;;; the module that writes it, not by an importer naming it first
|
||||
(test-assert "a pub realization of a spec imported without pub is refused"
|
||||
@@ -127,6 +144,7 @@
|
||||
|
||||
(for-each delete-file* '("greet.o" "ledger.o" "greet-app" "greet-app.d"
|
||||
"page.o" "book.o" "shelf-app"
|
||||
"cycle-a.o" "cycle-b.o" "cycle-app"))
|
||||
"cycle-a.o" "cycle-b.o" "cycle-app"
|
||||
"made.o" "made-app"))
|
||||
|
||||
(test-exit)
|
||||
|
||||
Reference in New Issue
Block a user