* lisp/emacs-lisp/comp.el (comp-emit-set-call-subr): Rework based
on the fact that the subr can now be redefined.
* test/src/comp-tests.el (primitive-redefine-compile-44221):
New testcase.
SP-DELTA is the stack adjustment."
(let ((subr (symbol-function subr-name))
(nargs (1+ (- sp-delta))))
- (unless (subrp subr)
- (signal 'native-ice (list "not a subr" subr)))
- (let* ((arity (subr-arity subr))
+ (let* ((arity (func-arity subr))
(minarg (car arity))
(maxarg (cdr arity)))
(when (eq maxarg 'unevalled)
;; Bug#42664, Bug#43280, Bug#44209.
(should-not (subr-native-elisp-p (symbol-function #'comp-test-defsubst-f))))
+(comp-deftest primitive-redefine-compile-44221 ()
+ "Test the compiler still works while primitives are redefined (bug#44221)."
+ (cl-letf (((symbol-function #'delete-region)
+ (lambda (_ _))))
+ (should (subr-native-elisp-p
+ (native-compile
+ '(lambda ()
+ (delete-region (point-min) (point-max))))))))
+
\f
;;;;;;;;;;;;;;;;;;;;;
;; Tromey's tests. ;;