From: Andrea Corallo Date: Mon, 28 Dec 2020 10:54:34 +0000 (+0100) Subject: Propagate function calls also when hiddend under funcall X-Git-Tag: emacs-28.0.90~2727^2~203 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=eafcc8eda0a78e78d1a53b30dafb22786dd60591;p=emacs.git Propagate function calls also when hiddend under funcall * lisp/emacs-lisp/comp.el (comp-fwprop-call): Propagate functions also when called under `funcall'. * test/src/comp-tests.el (comp-tests-type-spec-tests): Add a test. --- diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el index c6bd040e5f6..2ca7c50045e 100644 --- a/lisp/emacs-lisp/comp.el +++ b/lisp/emacs-lisp/comp.el @@ -2642,6 +2642,10 @@ Return non-nil if the function is folded successfully." F is the function being called with arguments ARGS. Fold the call in case." (unless (comp-function-call-maybe-fold insn f args) + (when (and (eq 'funcall f) + (comp-mvar-value-vld-p (car args))) + (setf f (comp-mvar-value (car args)) + args (cdr args))) (when-let ((cstr-f (gethash f comp-known-func-cstr-h))) (let ((cstr (comp-cstr-f-ret cstr-f))) (setf (comp-mvar-range lval) (comp-cstr-range cstr) diff --git a/test/src/comp-tests.el b/test/src/comp-tests.el index dbfa3702ff1..d4eb39a736f 100644 --- a/test/src/comp-tests.el +++ b/test/src/comp-tests.el @@ -1137,7 +1137,12 @@ Return a list of results." ((defun comp-tests-ret-type-spec-f (x) (when (<= 1 x 5) (1- x))) - (or null float (integer 0 4))))) + (or null float (integer 0 4))) + + ;; 47 + ((defun comp-tests-ret-type-spec-f () + (error "foo")) + nil))) (defun comp-tests-define-type-spec-test (number x) `(comp-deftest ,(intern (format "ret-type-spec-%d" number)) ()