summaryrefslogtreecommitdiff
path: root/test/lisp/help-fns-tests.el
diff options
context:
space:
mode:
authorMattias EngdegÄrd <mattiase@acm.org>2023-02-20 15:23:12 +0100
committerMattias EngdegÄrd <mattiase@acm.org>2023-02-21 10:42:00 +0100
commitdb3fea2e5ce46229ae40aa9ca6a89964261a7a5a (patch)
tree43264b77f2bc165a310090c40065ee6dfc750169 /test/lisp/help-fns-tests.el
parentc4c4af022d6091537fb0d748342eba5e7d3ddd23 (diff)
downloademacs-db3fea2e5ce46229ae40aa9ca6a89964261a7a5a.tar.gz
Detect and prevent function alias loops in `fset` and `defalias`
Make `fset` and `defalias` signal an error on attempts to create circular alias chains. This is more effective, efficient and convenient than permitting alias loops to be created and trying to detect them at run time each time a function is called, which is what we have been doing until now, badly. * lisp/help-fns.el (help-fns--analyze-function): Don't pass obsolete argument. * lisp/subr.el (function-alias-p): * src/data.c (indirect_function, Findirect_function): Simplify. Now error-free, second argument obsolete. (Ffset): Detect loops. * test/lisp/help-fns-tests.el (help-fns--analyze-function-recursive): * test/lisp/subr-tests.el (test-alias-p): Adapt tests. * test/src/data-tests.el (data-tests-fset, data-tests-defalias): New. * doc/lispref/eval.texi (Function Indirection): * doc/lispref/functions.texi (Defining Functions, Function Cells): Update manual. * etc/NEWS: Announce.
Diffstat (limited to 'test/lisp/help-fns-tests.el')
-rw-r--r--test/lisp/help-fns-tests.el4
1 files changed, 0 insertions, 4 deletions
diff --git a/test/lisp/help-fns-tests.el b/test/lisp/help-fns-tests.el
index 4d715cde1d5..243a45ae6d2 100644
--- a/test/lisp/help-fns-tests.el
+++ b/test/lisp/help-fns-tests.el
@@ -181,10 +181,6 @@ Return first line of the output of (describe-function-1 FUNC)."
(ert-deftest help-fns--analyze-function-recursive ()
(defalias 'help-fns--a 'help-fns--b)
(should (equal (help-fns--analyze-function 'help-fns--a)
- '(help-fns--a help-fns--b t help-fns--b)))
- ;; Make a loop and see that it doesn't infloop.
- (defalias 'help-fns--b 'help-fns--a)
- (should (equal (help-fns--analyze-function 'help-fns--a)
'(help-fns--a help-fns--b t help-fns--b))))
;;; help-fns-tests.el ends here