1 ;;;; miscellaneous compiler tests with side-effects (e.g. DEFUN
2 ;;;; changing FDEFINITIONs and globaldb stuff)
4 ;;;; This software is part of the SBCL system. See the README file for
7 ;;;; While most of SBCL is derived from the CMU CL system, the test
8 ;;;; files (like this one) were written from scratch after the fork
11 ;;;; This software is in the public domain and is provided with
12 ;;;; absolutely no warranty. See the COPYING and CREDITS files for
13 ;;;; more information.
15 (cl:in-package :cl-user)
17 (declaim (optimize (debug 3) (speed 2) (space 1)))
19 ;;; Until version 0.6.9 or so, SBCL's version of Python couldn't this
20 ;;; correctly, due to the bug patched by Rob MacLachlan on the
21 ;;; cmucl-imp list 2000-06-21, and apply to SBCL by Martin Atzmueller.
22 ;;; (The effectiveness of the test also depends on the implicit
23 ;;; function typing of Python (where DEFUN is like DECLAIM FTYPE),
24 ;;; which violates the ANSI spec, and should be fixed. Once that
25 ;;; unrelated bug is fixed, this code will no longer test the type
26 ;;; inference behavior it's intended to test.)
27 (defun emptyvalues (&rest rest) (declare (ignore rest)) (values))
30 (let ((res (emptyvalues)))
31 (unless (typep res 'foo)
33 (assert (eq (bar) 'expected-value))
35 (declaim (ftype (function (real) (values integer single-float)) valuesify))
38 (coerce x 'single-float)))
39 (defun exercise-valuesify (x)
40 (multiple-value-bind (i f) (valuesify x)
41 (declare (type integer i))
42 (declare (type single-float f))
44 (assert (= (exercise-valuesify 1.25) 2.25))
47 ;;; Don Geddis reported this test case 25 December 1999 on a CMU CL
48 ;;; mailing list: dumping circular lists caused an infinite loop.
49 ;;; Douglas Crosher reported a patch 27 Dec 1999. The patch was tested
50 ;;; on SBCL by Martin Atzmueller 2 Nov 2000, and merged in
52 (defun q1 () (dolist (x '#1=("A" "B" . #1#)) x))
53 (defun q2 () (dolist (x '#1=("C" "D" . #1#)) x))
54 (defun q3 () (dolist (x '#1=("E" "F" . #1#)) x))
55 (defun q4 () (dolist (x '#1=("C" "D" . #1#)) x))
58 (declare (type list keys))
60 for c in '#1=("Red" "Blue" . #1#)
63 (sb-ext:quit :unix-status 104) ; success