From 22d7344307fbc24676e7f37a539b30f6dc61f070 Mon Sep 17 00:00:00 2001 From: Peter Bex Date: Thu, 19 Nov 2015 15:58:37 +0100 Subject: [PATCH] Error out when emitting import libraries for nonexistant modules. This fixes #1188 --- NEWS | 2 ++ batch-driver.scm | 7 +++++++ core.scm | 4 ++++ 3 files changed, 13 insertions(+) diff --git a/NEWS b/NEWS index eba4c91..e4c6f8a 100644 --- a/NEWS +++ b/NEWS @@ -48,6 +48,8 @@ work, removing the requirement for the inferred types to match declared types exactly. Specializations are matched from first to last to resolve ambiguities (#1214). + - When requesting to emit import libraries that don't exist, the + compiler now gives an error instead of quietly continuing (#1188). 4.10.1 diff --git a/batch-driver.scm b/batch-driver.scm index 514022d..7cf47cb 100644 --- a/batch-driver.scm +++ b/batch-driver.scm @@ -587,6 +587,13 @@ '() ) '((##core#undefined))) ) ) + (unless (null? import-libraries) + (quit "No module definition found for import libraries to emit: ~A" + ;; ~S would be confusing: separate with a comma + (string-intersperse + (map (lambda (il) (->string (car il))) + import-libraries) ", "))) + (when (pair? compiler-syntax-statistics) (with-debugging-output 'S diff --git a/core.scm b/core.scm index 32005bf..c57d48e 100644 --- a/core.scm +++ b/core.scm @@ -967,6 +967,10 @@ (lambda (il) (when enable-module-registration (emit-import-lib name il)) + ;; Remove from list + ;; to avoid error + (set! import-libraries + (delete il import-libraries)) (values (reverse xs) '((##core#undefined))))) -- 2.1.4