Comment 1 for bug 309788

Revision history for this message
Karol Swietlicki (abcdef123456) wrote :

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