Fix make-array transforms.
[sbcl.git] / tests / clos-ignore.interactive.lisp
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.)
7
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.
18
19 (in-package :cl-user)
20
21 (defgeneric foo (x y &key &allow-other-keys))
22
23 ;;; should have no STYLE-WARNINGs (e.g. about unused vars)
24 (defmethod foo ((x t) (y t))
25   nil)
26
27 ;;; should have no STYLE-WARNINGs
28 (defmethod foo ((x t) (y t) &key &allow-other-keys)
29   (declare (ignore x)))
30
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)))
35
36 ;;; should have no STYLE-WARNINGs
37 (defmethod foo ((x t) (y t) &key &allow-other-keys)
38   x)
39
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))
43   x)
44
45 ;;; should have no STYLE-WARNINGs
46 (defmethod foo (x y &key &allow-other-keys)
47   (declare (ignore x y))
48   (call-next-method))
49
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))
54
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))
59
60 ;;; should have a STYLE-WARNING: Z is unused.
61 (defmethod foo ((x t) (y integer) &key z)
62   nil)