0.8.19.22:
[sbcl/lichteblau.git] / tests / clos-ignore.interactive.lisp
blob432f65db95ba0089924b9aad7ea0c66df50d313c
1 ;;;; To test the IGNORE/IGNORABLE behavior in CLOS, run COMPILE-FILE on
2 ;;;; this file and look at the output (warnings, etc.).
3 ;;;;
4 ;;;; (In sbcl-0.6.8.25, the handling of IGNORE and IGNORABLE in
5 ;;;; DEFMETHOD forms was rewritten to systematize the old PCL behavior.
6 ;;;; Now all required variables are IGNORABLE by default.)
8 ;;;; This software is part of the SBCL system. See the README file for
9 ;;;; more information.
10 ;;;;
11 ;;;; While most of SBCL is derived from the CMU CL system, the test
12 ;;;; files (like this one) were written from scratch after the fork
13 ;;;; from CMU CL.
14 ;;;;
15 ;;;; This software is in the public domain and is provided with
16 ;;;; absolutely no warranty. See the COPYING and CREDITS files for
17 ;;;; more information.
19 (in-package :cl-user)
21 (defgeneric foo (x y &key &allow-other-keys))
23 ;;; should have no STYLE-WARNINGs (e.g. about unused vars)
24 (defmethod foo ((x t) (y t))
25 nil)
27 ;;; should have no STYLE-WARNINGs
28 (defmethod foo ((x t) (y t) &key &allow-other-keys)
29 (declare (ignore x)))
31 ;;; should have no STYLE-WARNINGs
32 (defmethod foo ((x t) (y t) &key &allow-other-keys)
33 (declare (ignorable x y))
34 (declare (ignore y)))
36 ;;; should have no STYLE-WARNINGs
37 (defmethod foo ((x t) (y t) &key &allow-other-keys)
40 ;;; should have a STYLE-WARNING: using an IGNOREd variable
41 (defmethod foo ((x t) (y t) &key &allow-other-keys)
42 (declare (ignore x y))
45 ;;; should have no STYLE-WARNINGs
46 (defmethod foo (x y &key &allow-other-keys)
47 (declare (ignore x y))
48 (call-next-method))
50 ;;; should have no STYLE-WARNINGs
51 (defmethod foo ((x integer) (y t) &key &allow-other-keys)
52 (declare (ignore x y))
53 (call-next-method))
55 ;;; should have no STYLE-WARNINGs
56 (defmethod foo ((x integer) (y t) &key &allow-other-keys)
57 (declare (ignore x))
58 (call-next-method))
60 ;;; should have a STYLE-WARNING: Z is unused.
61 (defmethod foo ((x t) (y integer) &key z)
62 nil)