This definition of the typep transform works for me:
(deftransform typep ((object type &optional env) * * :node node) (unless (constant-lvar-p type) (give-up-ir1-transform "can't open-code test of non-constant type")) (unless (and (constant-lvar-p env) (null (lvar-value env))) (give-up-ir1-transform "environment argument present and not null")) (multiple-value-bind (expansion fail-p) (source-transform-typep 'object (lvar-value type)) (if fail-p (abort-ir1-transform) expansion)))
Builds and runs tests fine. Efficient code both with and without the optional argument.
Karol Swietlicki
This definition of the typep transform works for me:
(deftransform typep ((object type &optional env) * * :node node) up-ir1- transform "can't open-code test of non-constant type")) up-ir1- transform "environment argument present and not null")) value-bind (expansion fail-p) source- transform- typep 'object (lvar-value type))
(abort- ir1-transform)
expansion) ))
(unless (constant-lvar-p type)
(give-
(unless (and (constant-lvar-p env) (null (lvar-value env)))
(give-
(multiple-
(
(if fail-p
Builds and runs tests fine. Efficient code both with and without the optional argument.
Karol Swietlicki