emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

scratch/comp-safety 7639971460a 4/4: Add a safety test


From: Andrea Corallo
Subject: scratch/comp-safety 7639971460a 4/4: Add a safety test
Date: Sun, 5 May 2024 03:43:10 -0400 (EDT)

branch: scratch/comp-safety
commit 7639971460a0e36bf97b04ab47a0331d72f9fbda
Author: Andrea Corallo <acorallo@gnu.org>
Commit: Andrea Corallo <acorallo@gnu.org>

    Add a safety test
---
 test/src/comp-resources/comp-test-funcs.el | 12 ++++++++++++
 test/src/comp-tests.el                     |  7 +++++++
 2 files changed, 19 insertions(+)

diff --git a/test/src/comp-resources/comp-test-funcs.el 
b/test/src/comp-resources/comp-test-funcs.el
index 54f339f6373..820fe57ec37 100644
--- a/test/src/comp-resources/comp-test-funcs.el
+++ b/test/src/comp-resources/comp-test-funcs.el
@@ -562,6 +562,18 @@
 (defun comp-test-67883-1-f ()
   '#1=(1 . #1#))
 
+(defun comp-test-safety-0-f ()
+  (declare (type (function () fixnum)))
+  4)
+
+(defun comp-test-safety-1-f ()
+  (declare (safety 0))
+  (comp-test-safety-0-f))
+
+(defun comp-test-safety-2-f ()
+  (declare (safety 1))
+  (comp-test-safety-0-f))
+
 
 ;;;;;;;;;;;;;;;;;;;;
 ;; Tromey's tests ;;
diff --git a/test/src/comp-tests.el b/test/src/comp-tests.el
index 5deff03fd84..9e82db93d9b 100644
--- a/test/src/comp-tests.el
+++ b/test/src/comp-tests.el
@@ -587,6 +587,12 @@ dedicated byte-op code."
   "<https://lists.gnu.org/archive/html/bug-gnu-emacs/2023-11/msg00925.html>"
   (should-not (comp-test-67239-1-f)))
 
+(comp-deftest safety-1 ()
+  (should (equal (subr-type (symbol-function #'comp-test-safety-1-f))
+                 `(function () (integer ,most-negative-fixnum 
,most-positive-fixnum))))
+  (should (equal (subr-type (symbol-function #'comp-test-safety-2-f))
+                 '(function () integer))))
+
 
 ;;;;;;;;;;;;;;;;;;;;;
 ;; Tromey's tests. ;;
@@ -925,6 +931,7 @@ Return a list of results."
 (defun comp-tests-check-ret-type-spec (func-form ret-type)
   (let ((lexical-binding t)
         (native-comp-speed 2)
+        (safety 0)
         (f-name (cl-second func-form)))
     (eval func-form t)
     (native-compile f-name)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]