From 236e9cd882878462a944f2e92669ba87cd490690 Mon Sep 17 00:00:00 2001 From: Peter Bex Date: Thu, 19 Nov 2015 15:55:55 +0100 Subject: [PATCH] Error out when emitting import libraries for nonexistant modules. This fixes #1188 --- NEWS | 2 ++ batch-driver.scm | 7 +++++++ compiler.scm | 4 ++++ 3 files changed, 13 insertions(+) diff --git a/NEWS b/NEWS index 4527b44..0c17541 100644 --- a/NEWS +++ b/NEWS @@ -16,6 +16,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 a5fa323..044b671 100644 --- a/batch-driver.scm +++ b/batch-driver.scm @@ -470,6 +470,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/compiler.scm b/compiler.scm index 55dbda6..8e626fc 100644 --- a/compiler.scm +++ b/compiler.scm @@ -874,6 +874,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