diff --git a/ansi-tests/load-eval-and-compile.lsp b/ansi-tests/load-eval-and-compile.lsp index f29872f50d3520fcc2c22da9f0c810173b71d54e..4dbd9390981b0ee68cffe5b4fc59b43462fc558b 100644 --- a/ansi-tests/load-eval-and-compile.lsp +++ b/ansi-tests/load-eval-and-compile.lsp @@ -22,3 +22,4 @@ (load "macroexpand.lsp") (load "macroexpand-1.lsp") (load "declaration.lsp") +(load "type.lsp") diff --git a/ansi-tests/type.lsp b/ansi-tests/type.lsp new file mode 100644 index 0000000000000000000000000000000000000000..84a6c8aa660e6be1582c42783b71018f845a8d59 --- /dev/null +++ b/ansi-tests/type.lsp @@ -0,0 +1,64 @@ +;-*- Mode: Lisp -*- +;;;; Author: Paul Dietz +;;;; Created: Sun May 29 08:25:46 2005 +;;;; Contains: Tests of TYPE declarations + +(in-package :cl-test) + +;;; Also of implicit type declarations + +(deftest type.1 + (let ((x 1)) + (declare (type (integer 0 1) x)) + (values + x + (setq x 0) + (1+ x))) + 1 0 1) + +(deftest type.2 + (let ((x 1)) + (declare (type (integer -1 1) x)) + (locally (declare (type (integer 0 2) x)) + (values + x + (setq x 0) + (1+ x)))) + 1 0 1) + +(deftest type.3 + (loop for x in *mini-universe* + for tp = (type-of x) + for form = `(let ((y ',x)) + (declare (type ,tp y)) + y) + for val = (eval form) + unless (eql val x) + collect (list x tp form val)) + nil) + +(deftest type.4 + (loop for x in *mini-universe* + for tp = (type-of x) + for form = `(let ((y ',x)) + (declare (,tp y)) + y) + for val = (eval form) + unless (eql val x) + collect (list x tp form val)) + nil) + +(deftest type.5 + (loop for x in *mini-universe* + for class = (class-of x) + for form = `(let ((y ',x)) + (declare (,class y)) + y) + for val = (eval form) + unless (eql val x) + collect (list x class form val)) + nil) + + + +