Fix type mismatch in the &rest-ref transform.
[sbcl.git] / tests / bad-code.pure.lisp
blob17f8b97db9bfbbd623f912b0ff0665dc9710f29a
1 (in-package :cl-user)
3 (with-test (:name (make-array :bad-initial-contents))
4 (assert
5 (nth-value 1
6 (checked-compile
7 `(lambda () (make-array '(1) :initial-contents 'foo))
8 :allow-warnings t))))
10 (with-test (:name (make-string-output-stream :bad-element-type))
11 (assert
12 (nth-value 1
13 (checked-compile
14 `(lambda ()
15 (make-string-output-stream :element-type '((x))))
16 :allow-warnings t))))
18 (with-test (:name (coerce :bad-type-specifier))
19 (assert
20 (nth-value 1
21 (checked-compile
22 `(lambda () (coerce (list 2) 1))
23 :allow-warnings t))))
25 (with-test (:name :zombie-entry-point-reference)
26 (assert
27 (nth-value 1
28 (checked-compile
29 `(lambda () (labels ((%f ())) (%f #'%f)))
30 :allow-warnings t))))
31 (with-test (:name :ir1-optimize-combination-dead-node)
32 (assert
33 (nth-value 1
34 (checked-compile
35 `(lambda ()
36 (flet ((%f2 (x) x))
37 (list (%f2 1)
38 (multiple-value-call #'%f2 (values)))))
39 :allow-warnings t))))
41 (with-test (:name (:bogus-block &key))
42 (assert
43 (nth-value 1
44 (checked-compile `(lambda (&key (x (block 1 10))) x)
45 :allow-failure t))))
47 (with-test (:name :type-error-reporting)
48 (assert
49 (nth-value 1
50 (checked-compile `(lambda ()
51 (lambda ()
52 (let ((v3 0))
53 (cdr (1- (block b5 (if nil v3 0)))))))
54 :allow-warnings t))))
56 (with-test (:name :dx-on-deleted-nodes)
57 (assert
58 (nth-value 1
59 (checked-compile `(lambda ()
60 (restart-bind ((1 3))))
61 :allow-warnings t))))
63 (with-test (:name :transform-call-dfo-consistency)
64 (assert
65 (nth-value 1
66 (checked-compile
67 `(lambda ()
68 (flet ((%f (&optional x) x))
69 (%f)
70 ;; Two of the %f calls are erroneous, with an extra argument
71 (flet ((%f6 (&key (k (%f (%f -1 (%f -2 -3))))) 0))
72 5)))
73 :allow-warnings t))))
75 (with-test (:name :&aux-check-variable-names)
76 (assert
77 (nth-value 1
78 (checked-compile
79 `(lambda (&aux (nil 10))
80 nil)
81 :allow-failure t))))
83 (with-test (:name :mv-call-too-many-values)
84 (assert
85 (nth-value 1
86 (checked-compile
87 `(lambda (a)
88 (flet ((%f1 (x) x))
89 (apply #'%f1 a 2 (list 0))))
90 :allow-warnings t))))
92 (with-test (:name :mv-call-too-many-values)
93 (assert
94 (nth-value 1
95 (checked-compile
96 `(lambda ()
97 (make-array (list 'x)))
98 :allow-warnings t))))
100 (with-test (:name (map :values-type))
101 (assert
102 (nth-value 1
103 (checked-compile
104 `(lambda ()
105 (map '* #'+ #(1) #(2)))
106 :allow-warnings t))))
109 (with-test (:name :bad-type-specifier)
110 (assert
111 (nth-value 1
112 (checked-compile
113 `(lambda ()
114 (make-array 10 :element-type '((x))))
115 :allow-warnings t))))
117 (with-test (:name (make-array :bad-dimensions))
118 (assert
119 (nth-value 1
120 (checked-compile
121 `(lambda ()
122 (make-array '(x)))
123 :allow-warnings t)))
124 (assert
125 (nth-value 1
126 (checked-compile
127 `(lambda ()
128 (make-array '(-10)))
129 :allow-warnings t))))
131 (with-test (:name (make-array :initial-contents :bad-macro))
132 (assert
133 (nth-value 1
134 (checked-compile
135 `(lambda ()
136 (make-array '(10) :initial-contents (do)))
137 :allow-failure t))))
139 (with-test (:name :&rest-ref-bad-n)
140 (assert
141 (nth-value 1
142 (checked-compile
143 `(lambda (&rest a) (lambda () (nth nil a)))
144 :allow-warnings t))))