1 (cl:in-package :cl-user)
3 (declaim (optimize (debug 3) (speed 2) (space 1)))
5 ;;; Until version 0.6.9 or so, SBCL's version of Python couldn't this
6 ;;; correctly, due to the bug patched by Rob MacLachlan on the
7 ;;; cmucl-imp list 2000-06-21, and apply to SBCL by Martin Atzmueller.
8 ;;; (The effectiveness of the test also depends on the implicit
9 ;;; function typing of Python (where DEFUN is like DECLAIM FTYPE),
10 ;;; which violates the ANSI spec, and should be fixed. Once that
11 ;;; unrelated bug is fixed, this code will no longer test the type
12 ;;; inference behavior it's intended to test.)
13 (defun emptyvalues (&rest rest) (declare (ignore rest)) (values))
16 (let ((res (emptyvalues)))
17 (unless (typep res 'foo)
19 (assert (eq (bar) 'expected-value))
21 (declaim (ftype (function (real) (values integer single-float)) valuesify))
24 (coerce x 'single-float)))
25 (defun exercise-valuesify (x)
26 (multiple-value-bind (i f) (valuesify x)
27 (declare (type integer i))
28 (declare (type single-float f))
30 (assert (= (exercise-valuesify 1.25) 2.25))
32 (sb-ext:quit :unix-status 104) ; success