I think the following test case is related. If I don't get anything wrong, it should print T both times when being compile-and-loaded.
(eval-when (:compile-toplevel) (deftype bar () 'fixnum))
(defmacro frob-with-bar (thing &environment env) (if (typep thing 'bar env) t nil))
(defun quux1 () (frob-with-bar 42))
(print (quux1)) ; will print T
(eval-when (:compile-toplevel) (deftype foo () 'fixnum))
(eval-when (:load-toplevel :execute) (deftype foo () 'string))
(defmacro frob-with-foo (thing &environment env) (if (typep thing 'foo env) t nil))
(defun quux2 () (frob-with-foo 42))
(print (quux2)) ; will print NIL
I think the following test case is related. If I don't get anything wrong, it should print T both times
when being compile-and-loaded.
(eval-when (:compile-toplevel)
(deftype bar () 'fixnum))
(defmacro frob-with-bar (thing &environment env)
(if (typep thing 'bar env)
t
nil))
(defun quux1 ()
(frob-with-bar 42))
(print (quux1)) ; will print T
(eval-when (:compile-toplevel)
(deftype foo () 'fixnum))
(eval-when (:load-toplevel :execute)
(deftype foo () 'string))
(defmacro frob-with-foo (thing &environment env)
(if (typep thing 'foo env)
t
nil))
(defun quux2 ()
(frob-with-foo 42))
(print (quux2)) ; will print NIL