* Reported by Samium Gromoff.
* Test-cases.
(multiple-value-bind (body local-decs doc)
(parse-defmacro `(,lambda-list ,@store-variables)
whole-var body access-fn 'defsetf
+ :environment env-var
:anonymousp t)
`(eval-when (:compile-toplevel :load-toplevel :execute)
(assign-setf-macro
',access-fn
(lambda (,access-form-var ,env-var)
- (declare (ignore ,env-var))
(%defsetf ,access-form-var ,(length store-variables)
(lambda (,whole-var)
,@local-decs
(defmacro-error (format nil "required argument after ~A"
restp)
context name))
- (process-sublist var "REQUIRED-" `(car ,path))
+ (when (process-sublist var "REQUIRED-" `(car ,path))
+ ;; Note &ENVIRONMENT from DEFSETF sublist
+ (aver (eq context 'defsetf))
+ (setf env-arg-used t))
(setq path `(cdr ,path)
minimum (1+ minimum)
maximum (1+ maximum)))
(&environment
(cond (env-illegal
(error "&ENVIRONMENT is not valid with ~S." context))
- (sublist
+ ;; DEFSETF explicitly allows &ENVIRONMENT, and we get
+ ;; it here in a sublist.
+ ((and sublist (neq context 'defsetf))
(error "&ENVIRONMENT is only valid at top level of ~
lambda-list."))
(env-arg-used
(error "Multiple ~A in ~A lambda-list." var context))
(setq allow-other-keys-p t))
(&aux
+ (when (eq context 'defsetf)
+ (error "~A not allowed in a ~A lambda-list." var context))
(when aux-seen
(error "Multiple ~A in ~A lambda-list." '&aux context))
(setq now-processing :auxs
(setf (macro-function 'nothing-at-all nil) fun)
(assert (eq fun (macro-function 'nothing-at-all nil))))
+
+;;; DEFSETF accepts &ENVIRONMENT but not &AUX
+(defsetf test-defsetf-env-1 (&environment env) (new)
+ (declare (ignore new))
+ (if (macro-function 'defsetf-env-trick env)
+ :local
+ :global))
+
+(defsetf test-defsetf-env-2 (local global &environment env) (new)
+ (declare (ignore new))
+ (if (macro-function 'defsetf-env-trick env)
+ local
+ global))
+
+(aver (eq :local (macrolet ((defsetf-env-trick ()))
+ (setf (test-defsetf-env-1) 13))))
+
+(aver (eq :global (setf (test-defsetf-env-1) 13)))
+
+(aver (eq :local (macrolet ((defsetf-env-trick ()))
+ (setf (test-defsetf-env-2 :local :oops) 13))))
+
+(aver (eq :global (setf (test-defsetf-env-2 :oops :global) 13)))
+
+(aver (eq :error
+ (handler-case
+ (eval '(defsetf test-defsetf-aux (&aux aux) (new) nil))
+ (error ()
+ :error))))
+
;;; success
;;; checkins which aren't released. (And occasionally for internal
;;; versions, especially for internal versions off the main CVS
;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".)
-"1.0.4.45"
+"1.0.4.46"