master: Add a test for foldable functions without a runtime function

stassats via Sbcl-commits <[email protected]>
Newsgroups gmane.lisp.steel-bank.cvs
Message-ID <[email protected]>
The branch "master" has been updated in SBCL:
       via  f19ea95f66005de67ca06aa69720b7e00bb24428 (commit)
      from  d1fabf915bf5345d1b2f662b0ca5d84b4b6e4036 (commit)

- Log -----------------------------------------------------------------
commit f19ea95f66005de67ca06aa69720b7e00bb24428
Author: Stas Boukarev <[email protected]>
Date:   Wed Aug 26 08:31:36 2026 +0300

    Add a test for foldable functions without a runtime function
---
 src/code/numbers.lisp      |  8 +++++++-
 tests/compiler-2.pure.lisp | 18 ++++++++++++++++++
 2 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/src/code/numbers.lisp b/src/code/numbers.lisp
index 800e2117a..401c8fa2d 100644
--- a/src/code/numbers.lisp
+++ b/src/code/numbers.lisp
@@ -1355,7 +1355,13 @@ the first."
 (sb-c::when-vop-existsp (:translate check-range<=)
   (defun check-range<= (low x high)
     (when (typep x 'fixnum)
-      (range<= low x high))))
+      (range<= low x high)))
+  (defun check-range<<= (low x high)
+    (when (typep x 'fixnum)
+      (range<<= low x high)))
+  (defun check-range<=< (low x high)
+    (when (typep x 'fixnum)
+      (range<=< low x high))))
 
 
 ;;;; logicals
diff --git a/tests/compiler-2.pure.lisp b/tests/compiler-2.pure.lisp
index 7d6fc4128..3dfde728a 100644
--- a/tests/compiler-2.pure.lisp
+++ b/tests/compiler-2.pure.lisp
@@ -5162,3 +5162,21 @@
       (let ((g (sb-kernel:the* (symbol :use-annotations t) x)))
         (unless (typep g 'symbol)
           g)))))
+
+(with-test (:name :unfoldable-functions
+            :skipped-on (not :sb-devel)) ;; no sb-c::ir1-attributep
+  (let (no-folders)
+    (do-all-symbols (symbol)
+      (unless (or (equal (package-name (symbol-package symbol))
+                         "SB-BIGNUM")
+                  (eq symbol 'sb-kernel:complex-vector-p))
+        (loop for name in (list symbol `(setf ,symbol))
+              do
+              (let ((info (sb-int:info :function :info name)))
+                (when (and info
+                           (sb-c::ir1-attributep (sb-c::fun-info-attributes info) sb-c::foldable)
+                           (not (sb-c::fun-info-folder info))
+                           (sb-c::fun-info-templates info))
+                  (unless (fboundp name)
+                    (push name no-folders)))))))
+    (assert (not no-folders))))

-----------------------------------------------------------------------


hooks/post-receive
-- 
SBCL
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.