summaryrefslogtreecommitdiff
path: root/test/lisp/emacs-lisp/cconv-tests.el
diff options
context:
space:
mode:
authorNoam Postavsky <npostavs@gmail.com>2018-06-07 19:58:47 -0400
committerNoam Postavsky <npostavs@gmail.com>2018-06-16 18:34:19 -0400
commit6021e1db92e355fbf5c66765fb0bc4658a80180a (patch)
tree8f25fe69a434b94d34cd1f086dbd9f1f9009d60b /test/lisp/emacs-lisp/cconv-tests.el
parent05345babc988060cca540770599282102c34f2a7 (diff)
downloademacs-6021e1db92e355fbf5c66765fb0bc4658a80180a.tar.gz
emacs-6021e1db92e355fbf5c66765fb0bc4658a80180a.tar.bz2
emacs-6021e1db92e355fbf5c66765fb0bc4658a80180a.zip
Don't forget to analyze args of lambda lifted functions (Bug#30872)
* lisp/emacs-lisp/cconv.el (cconv--convert-funcbody): New function. (cconv--convert-function): Extracted from here. (cconv-convert): Also use it here, in the lambda lifted case, so that mutated args are properly accounted for. * test/lisp/emacs-lisp/cconv-tests.el: New test.
Diffstat (limited to 'test/lisp/emacs-lisp/cconv-tests.el')
-rw-r--r--test/lisp/emacs-lisp/cconv-tests.el40
1 files changed, 40 insertions, 0 deletions
diff --git a/test/lisp/emacs-lisp/cconv-tests.el b/test/lisp/emacs-lisp/cconv-tests.el
new file mode 100644
index 00000000000..d14847ce45e
--- /dev/null
+++ b/test/lisp/emacs-lisp/cconv-tests.el
@@ -0,0 +1,40 @@
+;;; cconv-tests.el -*- lexical-binding: t -*-
+
+;; Copyright (C) 2018 Free Software Foundation, Inc.
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+(require 'ert)
+
+(ert-deftest cconv-convert-lambda-lifted ()
+ "Bug#30872."
+ (should
+ (equal (funcall
+ (byte-compile
+ '#'(lambda (handle-fun arg)
+ (let* ((subfun
+ #'(lambda (params)
+ (ignore handle-fun)
+ (funcall #'(lambda () (setq params 42)))
+ params)))
+ (funcall subfun arg))))
+ nil 99)
+ 42)))
+
+(provide 'cconv-tests)
+;; cconv-tests.el ends here.