~ chicken-core (master) 3c719f6929065aadfc553fe994c6faf5f7c8542d


commit 3c719f6929065aadfc553fe994c6faf5f7c8542d
Author:     felix <felix@call-with-current-continuation.org>
AuthorDate: Thu Nov 20 14:05:15 2025 +0100
Commit:     felix <felix@call-with-current-continuation.org>
CommitDate: Thu Nov 20 14:05:15 2025 +0100

    handle ##core#undefined in library declarations, fix broken case for ##code#begin

diff --git a/expand.scm b/expand.scm
index 858c9f68..df58bf03 100644
--- a/expand.scm
+++ b/expand.scm
@@ -1325,10 +1325,14 @@
                    `(##core#begin ,(process-include-decls (cdr spec))
                                   ,(parse-decls more)))
                   ((cond-expand)
-                   (parse-decls (append (list (process-cond-expand (cdr spec)))
-                                        more)))
+                   (parse-decls
+                     `((##core#begin
+                        ,(process-cond-expand (cdr spec))
+                        ,@more))))
                   ((##core#begin)
-                    (parse-decls (cdr spec)))
+                    (parse-decls (append (cdr spec) more)))
+                  ((##core#undefined)	; residue from cond-expand
+                    (parse-decls more))
                   ((begin)
                    `(##core#begin ,@(cdr spec)
                                   ,(parse-decls more)))
Trap