Permalink
Browse files

added *unused-declarations-behavior*

The new configuration variable `*unused-declarations-behavior*`
controls how `bind` behaves when it finds an unused declaration.
  • Loading branch information...
1 parent 1c16735 commit 8822a11e18c5c7aa38c321a3135992d35efbda26 Gary King committed with Jan 14, 2012
Showing with 12 additions and 23 deletions.
  1. +12 −12 unit-tests/test-bind.lisp
  2. +0 −11 website/source/user-guide.mmd
View
@@ -9,27 +9,27 @@
simple-list
(ensure-same (bind-fix-nils-destructured '(a b c)) (values '(a b c) nil)
:test #'equal))
-
+
(addtest (test-bind-fix-nils-destructured)
simple-list-with-nil
(multiple-value-bind (vars ignores)
- (bind-fix-nils-destructured '(a nil c))
+ (bind-fix-nils-destructured '(a nil c))
(ensure-same (first vars) 'a)
(ensure-same (third vars) 'c)
(ensure-same (second vars) (first ignores))))
(addtest (test-bind-fix-nils-destructured)
simple-list-with-_
(multiple-value-bind (vars ignores)
- (bind-fix-nils-destructured '(a _ c))
+ (bind-fix-nils-destructured '(a _ c))
(ensure-same (first vars) 'a)
(ensure-same (third vars) 'c)
(ensure-same (second vars) (first ignores))))
(addtest (test-bind-fix-nils-destructured)
simple-list-with-_-2
(multiple-value-bind (vars ignores)
- (bind-fix-nils-destructured '(a _ c _ _))
+ (bind-fix-nils-destructured '(a _ c _ _))
(ensure-same (first vars) 'a)
(ensure-same (third vars) 'c)
(ensure (member (second vars) ignores))
@@ -39,39 +39,39 @@
(addtest (test-bind-fix-nils-destructured)
dotted-list
(multiple-value-bind (vars ignores)
- (bind-fix-nils-destructured '(a . b))
+ (bind-fix-nils-destructured '(a . b))
(ensure-same (car vars) 'a)
(ensure-same (cdr vars) 'b)
(ensure-same ignores nil)))
(addtest (test-bind-fix-nils-destructured)
dotted-list-with-nil-1
(multiple-value-bind (vars ignores)
- (bind-fix-nils-destructured '(nil . b))
+ (bind-fix-nils-destructured '(nil . b))
(ensure-same (car vars) (first ignores))
(ensure-same (cdr vars) 'b)
(ensure-same (length ignores) 1)))
(addtest (test-bind-fix-nils-destructured)
keyword-list
(multiple-value-bind (vars ignores)
- (bind-fix-nils-destructured '(a b &key (c 1) d (e x y)))
+ (bind-fix-nils-destructured '(a b &key (c 1) d (e x y)))
(ensure-same (length vars) 6)
(ensure-same (length ignores) 0)
(ensure-same vars '(a b &key (c 1) d (e x y)) :test #'equal)))
(addtest (test-bind-fix-nils-destructured)
keyword-list-with-nil-non-keyword
(multiple-value-bind (vars ignores)
- (bind-fix-nils-destructured '(nil b &key (c 1) d (e x y)))
+ (bind-fix-nils-destructured '(nil b &key (c 1) d (e x y)))
(ensure-same (length ignores) 1)
(ensure-same (rest vars) '(b &key (c 1) d (e x y)) :test #'equal)
(ensure-same (first vars) (first ignores))))
(addtest (test-bind-fix-nils-destructured)
keyword-list-with-nil-keyword
(multiple-value-bind (vars ignores)
- (bind-fix-nils-destructured '(a b &key (c 1) nil (e x y)))
+ (bind-fix-nils-destructured '(a b &key (c 1) nil (e x y)))
(ensure-same (length ignores) 1)
(ensure-same (subseq vars 0 3) '(a b &key) :test #'equal)
(ensure-same (fifth vars) (first ignores))
@@ -88,7 +88,7 @@
keyword-list-with-allow-other-keys
(multiple-value-bind (vars ignores)
(bind-fix-nils-destructured '(a b &key (c 1) d (e x y)
- &allow-other-keys))
+ &allow-other-keys))
(ensure-same (length ignores) 0)
(ensure-same vars '(a b &key (c 1) d (e x y)
&allow-other-keys) :test #'equal)))
@@ -197,7 +197,7 @@
(let ((bind:*unused-declarations-behavior* :warn))
(ensure-condition bind::bind-unused-declarations-warning
(eval '(bind:bind (((:values _ b ) (values 1 2)))
- (declare (type fixnum b) (ignorable b)
+ (declare (type fixnum b) (ignorable b)
(simple-vector d) (optimize (speed 3)))
b)))))
@@ -206,7 +206,7 @@
(let ((bind:*unused-declarations-behavior* nil))
(ensure-no-warning
(eval '(bind:bind (((:values _ b ) (values 1 2)))
- (declare (type fixnum b) (ignorable b)
+ (declare (type fixnum b) (ignorable b)
(simple-vector d) (optimize (speed 3)))
b)))))
@@ -34,17 +34,6 @@ first item in a binding is a list and the first item in the list is
the keyword ':values'.
-{remark
-### Summary
-
-<table>
-<tr>
-<td>symbol</td><td>`x` or `(x 45)`</td><td>`let`</td>
-<td>array</td><td>`(#(a b) #(4 5))`</td><td>`let`</td>
-</tr>
-</table>
-}
-
{remark
### Summary

0 comments on commit 8822a11

Please sign in to comment.