sbcl.sbcl/tests/clos-method-em-caches.impure.lisp
Christophe Rhodes 04dc20de81
Some checks failed
Linux qemu / ppc64le (push) Failing after 1s
CL-host / ecl (push) Has been cancelled
CL-host / clisp (push) Has been cancelled
CL-host / ccl (push) Has been cancelled
CL-host / cmucl (push) Has been cancelled
CL-host / sbcl (push) Has been cancelled
Linux / build (x86, --with-sb-thread, ) (push) Has been cancelled
Linux / build (x86, --without-sb-thread, ) (push) Has been cancelled
Linux / build (x86, --without-sb-unicode, ) (push) Has been cancelled
Linux / build (x86-64, --with-mark-region-gc) (push) Has been cancelled
Linux / build (x86-64, --with-sb-fasteval --without-sb-eval, fasteval) (push) Has been cancelled
Linux / build (x86-64, --with-sb-thread, ) (push) Has been cancelled
Linux / build (x86-64, --with-sb-thread, sse4) (push) Has been cancelled
Linux / build (x86-64, --without-sb-thread, ) (push) Has been cancelled
Linux / build (x86-64, --without-sb-unicode, ) (push) Has been cancelled
Mac / build (--without-sb-thread, x86-64) (push) Has been cancelled
Mac / build (arm64, --with-mark-region-gc) (push) Has been cancelled
Mac / build (arm64, --with-sb-thread) (push) Has been cancelled
Mac / build (x86-64, --with-mark-region-gc) (push) Has been cancelled
Mac / build (x86-64, --with-sb-thread) (push) Has been cancelled
Windows / build (push) Has been cancelled
CL-host / compare-xc-host-fasls (ccl, false) (push) Has been cancelled
CL-host / compare-xc-host-fasls (clisp, false) (push) Has been cancelled
CL-host / compare-xc-host-fasls (cmucl, false) (push) Has been cancelled
CL-host / compare-xc-host-fasls (self, false) (push) Has been cancelled
Fix lack of effective method cache invalidation
Since the effective method must do keyword argument checking when
exactly one method is applicable, we must invalidate the cache of
those effective methods when the set of keywords acceptable to the
generic function changes (as well as when the generic function's
method combination changes).  Make it so, by defining a new state
for ARG-INFO-KEYS to be able to distinguish between &KEY and
&KEY &ALLOW-OTHER-KEYS.

Reported by Robert Strandh
2024-10-31 21:56:44 +00:00

38 lines
1.4 KiB
Common Lisp

;;;; testing the caching of effective methods
;;;; This software is part of the SBCL system. See the README file for
;;;; more information.
;;;;
;;;; While most of SBCL is derived from the CMU CL system, the test
;;;; files (like this one) were written from scratch after the fork
;;;; from CMU CL.
;;;;
;;;; This software is in the public domain and is provided with
;;;; absolutely no warranty. See the COPYING and CREDITS files for
;;;; more information.
(with-test (:name (defmethod (defgeneric &allow-other-keys) funcall))
(defmethod foo1 (&key x) x)
(defgeneric foo1 (&key &allow-other-keys))
(assert (null (foo1 :y 234))))
(with-test (:name (defmethod funcall (defgeneric &allow-other-keys) funcall))
(defmethod foo2 (&key x) x)
(assert-error (foo2 :y 234) program-error)
(defgeneric foo2 (&key &allow-other-keys))
(assert (null (foo2 :y 234))))
(with-test (:name (defgeneric defmethod funcall (defgeneric &allow-other-keys) funcall))
(defgeneric foo3 (&key))
(defmethod foo3 (&key x))
(assert-error (foo3 :y 234) program-error)
(defgeneric foo3 (&key &allow-other-keys))
(assert (null (foo3 :y 234))))
(with-test (:name ((defgeneric &allow-other-keys) defmethod funcall defgeneric funcall))
(defgeneric foo4 (&key &allow-other-keys))
(defmethod foo4 (&key x))
(assert (null (foo4 :y 234)))
(defgeneric foo4 (&key))
(assert-error (foo4 :y 234) program-error))