Fix warning about re-exporting imported names from libraries.
authorChris Hanson <org/chris-hanson/cph>
Mon, 18 Nov 2019 00:14:20 +0000 (16:14 -0800)
committerChris Hanson <org/chris-hanson/cph>
Mon, 18 Nov 2019 00:14:20 +0000 (16:14 -0800)
src/runtime/library-loader.scm

index 176a0ad42384c1ee408b631de4fdf0b96ebe70e2..ce9052d94cb070a9f8b616a24667d70586568d1c 100644 (file)
@@ -41,16 +41,15 @@ USA.
   (lambda (contents imports exports env)
     (receive (body bound free)
        (syntax-library-forms (expand-contents contents) env)
-      (let ((exports-from (map library-export-from exports)))
-       (if (not (lset<= eq? exports-from (lset-union eq? bound free)))
-           (warn "Library export refers to unbound identifiers:"
-                 (lset-difference eq?
-                                  exports-from
-                                  (lset-union eq? bound free)))))
       (let ((imports-to (map library-import-to imports)))
        (if (not (lset<= eq? free imports-to))
            (warn "Library has free references not provided by imports:"
-                 (lset-difference eq? free imports-to))))
+                 (lset-difference eq? free imports-to)))
+       (let ((exports-from (map library-export-from exports))
+             (bound* (lset-union eq? bound imports-to)))
+         (if (not (lset<= eq? exports-from bound*))
+             (warn "Library export refers to unbound identifiers:"
+                   (lset-difference eq? exports-from bound*)))))
       (values body
              (filter (lambda (import)
                        (memq (library-import-to import) free))