~ chicken-core (chicken-5) a6c091dc5f7f467d8072c1fc665600fbc1159381


commit a6c091dc5f7f467d8072c1fc665600fbc1159381
Author:     Peter Bex <peter@more-magic.net>
AuthorDate: Thu Oct 10 07:47:24 2019 +0200
Commit:     megane <meganeka@gmail.com>
CommitDate: Thu Oct 10 10:41:29 2019 +0300

    Check if there _is_ a value or syntax binding before warning and declaring it undefined
    
    This unbreaks the build of CHICKEN itself, which "abuses" the
    possibility of having both a procedure and a define-inline version of
    the same procedure in tweaks.scm.
    
    a) Check the list of unexportable stuff _after_ checking if there's a
       regular or syntax identifier defined for that export inside the module.
    
    b) Add types to the list of things checked that cannot be exported.
    
    Signed-off-by: megane <meganeka@gmail.com>

diff --git a/core.scm b/core.scm
index b3177501..b05a68b6 100644
--- a/core.scm
+++ b/core.scm
@@ -1043,7 +1043,8 @@
                                                      (lambda (id)
                                                        (and (not (assq id foreign-variables))
                                                             (not (hash-table-ref inline-table id))
-                                                            (not (hash-table-ref constant-table id))))))
+                                                            (not (hash-table-ref constant-table id))
+                                                            (not (##sys#get id '##compiler#type-abbreviation))))))
 						 (let ((il (or (assq name import-libraries) all-import-libraries)))
 						   (when il
 						     (emit-import-lib name il)
diff --git a/modules.scm b/modules.scm
index e9abd786..1501ab04 100644
--- a/modules.scm
+++ b/modules.scm
@@ -470,11 +470,6 @@
 		    (let* ((h (car xl))
 			   (id (if (symbol? h) h (car h))))
 		      (cond ((assq id sexports) (loop (cdr xl)))
-                            ((not (check-export id))
-                             (set! missing #t)
-                             (##sys#warn "exported identifier does not refer to value or syntax binding"
-                                          id)
-                             (loop (cdr xl)))
                             (else 
                               (cons 
                                 (cons 
@@ -488,12 +483,14 @@
                                                  (cdr a)) 
                                                 ((not def)
                                                  (set! missing #t)
-                                                 (##sys#warn 
-                                                   (string-append 
-					           "exported identifier of module `" 
+                                                 (##sys#warn
+						  (string-append
+					           "exported identifier of module `"
 					           (symbol->string name)
-					           "' has not been defined")
-					           id)
+						   (if (check-export id)
+						       "' has not been defined"
+						       "' does not refer to value or syntax binding"))
+					          id)
                                                  #f)
                                                 (else (module-rename id name)))))))
                               (loop (cdr xl))))))))))
Trap