~ chicken-core (chicken-5) 3875d1361b2f285cd5bafd987869e5a011e304fb
commit 3875d1361b2f285cd5bafd987869e5a011e304fb
Author: felix <felix@call-with-current-continuation.org>
AuthorDate: Tue Jun 12 10:40:15 2012 +0200
Commit: Christian Kellermann <ckeen@pestilenz.org>
CommitDate: Tue Jun 12 10:40:15 2012 +0200
reexport must update module-exist-list for modules having wildcard export list (contributed by megane)
Signed-off-by: felix <felix@call-with-current-continuation.org>
Signed-off-by: Christian Kellermann <ckeen@pestilenz.org>
diff --git a/modules.scm b/modules.scm
index 1a4cadad..6cea21e9 100644
--- a/modules.scm
+++ b/modules.scm
@@ -696,13 +696,21 @@
(when reexp?
(unless cm
(##sys#syntax-error-hook loc "`reexport' only valid inside a module"))
- (set-module-export-list!
- cm
- (append
- (let ((xl (module-export-list cm) ))
- (if (eq? #t xl) '() xl))
- (map car vsv)
- (map car vss)))
+
+ (if (eq? #t (module-export-list cm))
+ (begin
+ (set-module-exist-list!
+ cm
+ (append (module-exist-list cm)
+ (map car vsv)
+ (map car vss))))
+ (set-module-export-list!
+ cm
+ (append
+ (let ((xl (module-export-list cm) ))
+ (if (eq? #t xl) '() xl))
+ (map car vsv)
+ (map car vss))))
(when (pair? prims)
(set-module-meta-expressions!
cm
diff --git a/tests/module-tests.scm b/tests/module-tests.scm
index ca1de1a4..4314f689 100644
--- a/tests/module-tests.scm
+++ b/tests/module-tests.scm
@@ -248,5 +248,33 @@
b)
2)
+;; (contributed by "megane")
+
+(module m25 *
+ (import chicken scheme)
+ (define foo 1))
+
+(module m26 (bar)
+ (import chicken scheme)
+ (reexport m25)
+ (define bar 2))
+
+(module m27 *
+ (import chicken scheme)
+ (reexport m25) ;; <- oops, bar not exported anymore
+ (define bar 2))
+
+(test-equal
+ "handle star-exporting module with reexport"
+ (module m28 ()
+ (import scheme chicken)
+ (import (prefix m26 b/))
+ (import (prefix m27 c/))
+ (print b/foo)
+ (print c/foo)
+ (print b/bar)
+ c/bar) ;; <- Error: unbound variable: c/bar
+ 2)
+
(test-end "modules")
Trap