changeset: 5282:dcc34e28cd84
tag: tip
user: Aidan Kehoe <kehoea(a)parhasard.net>
date: Sun Oct 10 12:32:38 2010 +0100
files: lisp/ChangeLog lisp/bytecomp.el
description:
Warn at byte-compile in #'the if FORM constant & not TYPE; fix
byte-compile-constp
2010-10-10 Aidan Kehoe <kehoea(a)parhasard.net>
* bytecomp.el (byte-compile-constp) Forms quoted with FUNCTION are
also constant.
(byte-compile-initial-macro-environment): In #'the, if FORM is
constant and does not match TYPE, warn at byte-compile time.
diff -r aa20a889ff14 -r dcc34e28cd84 lisp/ChangeLog
--- a/lisp/ChangeLog Sun Oct 10 12:13:32 2010 +0100
+++ b/lisp/ChangeLog Sun Oct 10 12:32:38 2010 +0100
@@ -1,3 +1,10 @@
+2010-10-10 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * bytecomp.el (byte-compile-constp) Forms quoted with FUNCTION are
+ also constant.
+ (byte-compile-initial-macro-environment): In #'the, if FORM is
+ constant and does not match TYPE, warn at byte-compile time.
+
2010-10-10 Aidan Kehoe <kehoea(a)parhasard.net>
* backquote.el (bq-vector-contents, bq-list*): Remove; the former
diff -r aa20a889ff14 -r dcc34e28cd84 lisp/bytecomp.el
--- a/lisp/bytecomp.el Sun Oct 10 12:13:32 2010 +0100
+++ b/lisp/bytecomp.el Sun Oct 10 12:32:38 2010 +0100
@@ -505,6 +505,10 @@
(cons 'progn body)))
(the .
,#'(lambda (type form)
+ (if (cl-const-expr-p form)
+ (or (eval (cl-make-type-test form type))
+ (byte-compile-warn
+ "%s is not of type %s" form type)))
(if byte-compile-delete-errors
form
(funcall (cdr (symbol-function 'the)) type form)))))
@@ -1391,7 +1395,7 @@
(defmacro byte-compile-constp (form)
;; Returns non-nil if FORM is a constant.
- `(cond ((consp ,form) (eq (car ,form) 'quote))
+ `(cond ((consp ,form) (memq (car ,form) '(quote function)))
((symbolp ,form) (byte-compile-constant-symbol-p ,form))
(t)))
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches