Fix nativecomp ICE compiling structure related code (bug#63674)
* lisp/emacs-lisp/cl-macs.el (cl-defstruct): Define the predicate to be effective at compile time as native comp relies on `cl-typep' that relies o predicates to work. * test/src/comp-resources/comp-test-funcs.el (cl-lib): Require. (comp-test-struct): Define struct. (comp-test-63674-1-f): Add new test.
This commit is contained in:
parent
b513036770
commit
b2b2be98da
2 changed files with 14 additions and 3 deletions
|
@ -3093,13 +3093,16 @@ To see the documentation for a defined struct type, use
|
|||
(cons 'and (cdddr pred-form))
|
||||
`(,predicate cl-x))))
|
||||
(when pred-form
|
||||
(push `(,defsym ,predicate (cl-x)
|
||||
(push `(eval-and-compile
|
||||
;; Define the predicate to be effective at compile time
|
||||
;; as native comp relies on `cl-typep' that relies on
|
||||
;; predicates to be defined as they are registered in
|
||||
;; cl-deftype-satisfies.
|
||||
(,defsym ,predicate (cl-x)
|
||||
(declare (side-effect-free error-free) (pure t))
|
||||
,(if (eq (car pred-form) 'and)
|
||||
(append pred-form '(t))
|
||||
`(and ,pred-form t)))
|
||||
forms)
|
||||
(push `(eval-and-compile
|
||||
(define-symbol-prop ',name 'cl-deftype-satisfies ',predicate))
|
||||
forms))
|
||||
(let ((pos 0) (descp descs))
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
|
||||
;;; Code:
|
||||
|
||||
(require 'cl-lib)
|
||||
|
||||
(defvar comp-tests-var1 3)
|
||||
|
||||
(defun comp-tests-varref-f ()
|
||||
|
@ -530,6 +532,12 @@
|
|||
(comp-test-62537-1-f))
|
||||
t)
|
||||
|
||||
(cl-defstruct comp-test-struct)
|
||||
|
||||
(defun comp-test-63674-1-f (x)
|
||||
(or
|
||||
(if (comp-test-struct-p pkg) x)
|
||||
t))
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;
|
||||
|
|
Loading…
Add table
Reference in a new issue