Comment 0 for bug 384892

Revision history for this message
Tobias C. Rittweiler (tcr) wrote : Difference in type derivation between file compiler and run-time compiler

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