From: Andrea Corallo Date: Sat, 3 Aug 2019 17:42:57 +0000 (+0200) Subject: fix comp-limplify-listn X-Git-Tag: emacs-28.0.90~2727^2~1320 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=318c4772af4fa04fd8dc498bdc252b691b3cdab5;p=emacs.git fix comp-limplify-listn --- diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el index 4841753172f..71d747428d8 100644 --- a/lisp/emacs-lisp/comp.el +++ b/lisp/emacs-lisp/comp.el @@ -381,7 +381,7 @@ If NEGATED non nil negate the tested condition." (defun comp-limplify-listn (n) "Limplify list N." - (comp-with-sp (1- n) + (comp-with-sp (+ (comp-sp) n -1) (comp-emit-set-call `(call Fcons ,(comp-slot) ,(make-comp-mvar :constant nil)))) diff --git a/test/src/comp-tests.el b/test/src/comp-tests.el index 58846ed50d0..9fbff7639e9 100644 --- a/test/src/comp-tests.el +++ b/test/src/comp-tests.el @@ -45,6 +45,8 @@ "Testing cons car cdr." (defun comp-tests-list-f () (list 1 2 3)) + (defun comp-tests-list2-f (a b c) + (list a b c)) (defun comp-tests-car-f (x) ;; Bcar (car x)) @@ -59,12 +61,14 @@ (cdr-safe x)) (native-compile #'comp-tests-list-f) + (native-compile #'comp-tests-list2-f) (native-compile #'comp-tests-car-f) (native-compile #'comp-tests-cdr-f) (native-compile #'comp-tests-car-safe-f) (native-compile #'comp-tests-cdr-safe-f) (should (equal (comp-tests-list-f) '(1 2 3))) + (should (equal (comp-tests-list2-f 1 2 3) '(1 2 3))) (should (= (comp-tests-car-f '(1 . 2)) 1)) (should (null (comp-tests-car-f nil))) (should (= (condition-case err