]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix a nativecomp type propagation bug (bug#74771)
authorAndrea Corallo <acorallo@gnu.org>
Wed, 11 Dec 2024 23:06:43 +0000 (00:06 +0100)
committerEshel Yaron <me@eshelyaron.com>
Sun, 23 Mar 2025 19:34:54 +0000 (20:34 +0100)
* lisp/emacs-lisp/comp.el (comp--add-cond-cstrs): Don't emit negated
cstr.
* test/src/comp-tests.el (comp-tests-type-spec-tests): Add a test.

(cherry picked from commit d565a6747a2bb3c6699a95e60e5f522f80a1ca0a)

lisp/emacs-lisp/comp.el
test/src/comp-tests.el

index 8b57f48b7de57e0e9ca2890c48f46157024604bb..2cd3d2d03b9d8f131fe03fed4424f113754f34e3 100644 (file)
@@ -2027,15 +2027,11 @@ TARGET-BB-SYM is the symbol name of the target block."
               (call symbol-value ,(and (pred comp-cstr-cl-tag-p) mvar-tag)))
          (set ,(and (pred comp-mvar-p) mvar-3)
               (call memq ,(and (pred comp-mvar-p) mvar-1) ,(and (pred comp-mvar-p) mvar-2)))
-         (cond-jump ,(and (pred comp-mvar-p) mvar-3) ,(pred comp-mvar-p) ,bb1 ,bb2))
+         (cond-jump ,(and (pred comp-mvar-p) mvar-3) ,(pred comp-mvar-p) ,_bb1 ,bb2))
        (comp--emit-assume 'and mvar-tested
-                         (make--comp-mvar :type (comp-cstr-cl-tag mvar-tag))
-                         (comp--add-cond-cstrs-target-block b bb2)
-                         nil)
-       (comp--emit-assume 'and mvar-tested
-                         (make--comp-mvar :type (comp-cstr-cl-tag mvar-tag))
-                         (comp--add-cond-cstrs-target-block b bb1)
-                         t))
+                          (make--comp-mvar :type (comp-cstr-cl-tag mvar-tag))
+                          (comp--add-cond-cstrs-target-block b bb2)
+                          nil))
       (`((set ,(and (pred comp-mvar-p) cmp-res)
               (,(pred comp--call-op-p)
                ,(and (or (pred comp--equality-fun-p)
index 2991a05d771a995aff79584bf8ff05eba1b2a7db..6b608d735402f880c3784c05dc01028270e9305d 100644 (file)
@@ -1512,7 +1512,12 @@ Return a list of results."
          (if (functionp x)
              (error "")
            x))
-       '(not function))))
+       '(not function))
+      ;; 81
+      ((defun comp-tests-ret-type-spec-f (x)
+         (print (comp-foo-p x))
+         (comp-foo-p x))
+       'boolean)))
 
   (defun comp-tests-define-type-spec-test (number x)
     `(comp-deftest ,(intern (format "ret-type-spec-%d" number)) ()