~ chicken-core (chicken-5) 1aa3271bf0a3d4294df570faf8a1ab5726ed5fc5


commit 1aa3271bf0a3d4294df570faf8a1ab5726ed5fc5
Author:     Peter Bex <peter@more-magic.net>
AuthorDate: Thu Jul 10 10:03:44 2025 +0200
Commit:     Peter Bex <peter@more-magic.net>
CommitDate: Mon Jul 28 09:07:54 2025 +0200

    Remove bogus safety measure
    
    The measure used to read (unless (eq? val n) (bomb ...)), which meant
    that we should not allow captured values to be rest ops.
    
    However, with 32067934f we now do allow rest ops to refer to captured
    variables.  That commit also changed the safety check, turning it into
    a tautology - the val will always either be direct, or a reference to
    a closure var.  So it makes no sense to even keep the check.

diff --git a/core.scm b/core.scm
index 0459a214..2ff2396f 100644
--- a/core.scm
+++ b/core.scm
@@ -2625,10 +2625,6 @@
 	  ((##core#rest-cdr ##core#rest-car ##core#rest-null? ##core#rest-length)
 	   (let* ((val (ref-var n here closure))
 		  (rest-var (if (eq? val n) (varnode (first params)) val)))
-	     (unless (or (eq? val n)
-			 (match-node val `(##core#ref (i) (##core#variable (,here))) '(i)))
-	       ;; If it's captured, replacement in optimizer was incorrect
-	       (bomb "Saw rest op for captured variable.  This should not happen!" class) )
 	     ;; If rest-cdrs have not all been eliminated, restore
 	     ;; them as regular cdr calls on the rest list variable.
 	     ;; This can be improved, as it can actually introduce
Trap