There seems to be a subtle difference in type derivation between the file compiler,
and the run-time compiler:
;;; /tmp/barf.lisp
(format t "~&The type is ~S~%" (sb-kernel:%simple-fun-type
(compile nil (lambda (x y &key k1) (declare (fixnum x y)) (declare (boolean k1)) (declare (ignore x y k1)) t))))
Then at the REPL:
SB-INTROSPECT> (load (compile-file "/tmp/barf"))
; compiling file "/tmp/barf.lisp" (written 08 JUN 2009 08:24:31 PM):
; compiling (FORMAT T ...)
; /tmp/barf.fasl written
; compilation finished in 0:00:00.018
The type is (FUNCTION (FIXNUM FIXNUM &KEY (:K1 (MEMBER NIL T))) *)
T
SB-INTROSPECT> (format t "~&The type is ~S~%" (sb-kernel:%simple-fun-type
(compile nil (lambda (x y &key k1) (declare (fixnum x y)) (declare (boolean k1)) (declare (ignore x y k1)) t))))
The type is (FUNCTION (FIXNUM FIXNUM &KEY (:K1 (MEMBER NIL T))) (VALUES (MEMBER T) &OPTIONAL))
NIL
There seems to be a subtle difference in type derivation between the file compiler,
and the run-time compiler:
;;; /tmp/barf.lisp
(format t "~&The type is ~S~%"
(sb- kernel: %simple- fun-type
(declare (fixnum x y))
(declare (boolean k1))
(declare (ignore x y k1))
t) )))
(compile nil (lambda (x y &key k1)
Then at the REPL:
SB-INTROSPECT> (load (compile-file "/tmp/barf"))
; compiling file "/tmp/barf.lisp" (written 08 JUN 2009 08:24:31 PM):
; compiling (FORMAT T ...)
; /tmp/barf.fasl written
(sb- kernel: %simple- fun-type
(declare (fixnum x y))
(declare (boolean k1))
(declare (ignore x y k1))
t) )))
(VALUES (MEMBER T) &OPTIONAL))
; compilation finished in 0:00:00.018
The type is (FUNCTION (FIXNUM FIXNUM &KEY (:K1 (MEMBER NIL T))) *)
T
SB-INTROSPECT> (format t "~&The type is ~S~%"
(compile nil (lambda (x y &key k1)
The type is (FUNCTION (FIXNUM FIXNUM &KEY (:K1 (MEMBER NIL T)))
NIL