jcbeaudoin / MKCL

ManKai Common Lisp
Other
33 stars 8 forks source link

CADR of EQL type specifier shouldn't be evaluated #25

Closed davidmullen closed 6 months ago

davidmullen commented 6 months ago
(defun is-foo-p (object)
  (typep object '(eql foo)))

Compile:

> (compile 'is-foo-p)

;;; Style Warning: Variable FOO was undefined. Compiler assumes it is a global.
IS-FOO-P
T
NIL

Then:

> (is-foo-p 'bar)

Debugger called in: #<thread "Initial" active (873) 0x7f322f182740 7f322c737000>.

#<a UNBOUND-VARIABLE 139853058003712>:
    The variable FOO is unbound.

Clearly, foo shouldn't be evaluated, since the entire type specifier is quoted.

The culprit would appear to be compiler::expand-typep in src/cmp/cmpopt.lsp.

jcbeaudoin commented 6 months ago

You are right! compiler::expand-typep is indeed buggy on EQL typespecs. Please have a look at commit 4e5e9e0 on master/head. It should fix it.