Changeset 12047


Ignore:
Timestamp:
May 13, 2009, 8:44:00 PM (10 years ago)
Author:
gz
Message:

Tests for type warnings

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/ansi-tests/ccl.lsp

    r12016 r12047  
    8888        (when (typep c 'ccl::compiler-warning)
    8989          (ccl::compiler-warning-warning-type c))))
    90   :unknown-type-declaration)
     90  :undefined-type)
    9191
    9292
     
    506506          (test-compile (test-source-file test1) :hide-warnings t)
    507507          (test-compile (test-source-file test2) :hide-warnings t))
    508         (test-compile (test-source-file test1 :hide-warnings t))))
     508        (test-compile (test-source-file test1) :hide-warnings t)))
    509509    warnings))
    510510
     
    823823  :error)
    824824
     825#+ccl-0711 ;; typechecking declarations
    825826(deftest ccl.loop-on
    826827    (locally (declare (optimize (safety 3) (speed 1)))
     
    847848      (funcall 'cl-test::ccl.next-method-gf 3))
    848849  3)
     850
     851(deftest ccl.49345-1
     852    (test-dup-warnings
     853     "(defclass test.ccl-49345-1 () ())
     854      (defclass test.ccl-49345-1 () ())")
     855  (:duplicate-definition))
     856
     857(deftest ccl.49345-2
     858    (test-dup-warnings
     859     "(defstruct (test.ccl-49345-2 (:copier  nil) (:predicate nil) (:constructor nil)))
     860      (defstruct (test.ccl-49345-2 (:copier  nil) (:predicate nil) (:constructor nil)))")
     861  (:duplicate-definition))
     862
     863(deftest ccl.49345-3
     864    (test-dup-warnings
     865     "(deftype test.ccl-49345-3 () 'integer)
     866      (deftype test.ccl-49345-3 () 'integer)")
     867  (:duplicate-definition))
     868
     869(deftest ccl.49345-4
     870    (test-dup-warnings
     871     "(defclass test.ccl-49345-4 () ())
     872      (deftype test.ccl-49345-4 () 'integer)")
     873  (:duplicate-definition))
     874
     875#+not-yet
     876(deftest ccl.49345-5
     877    (test-dup-warnings
     878     "(defclass test.ccl-49345-5 () ())
     879      (let ((closed nil))
     880         (defclass test.ccl-49345-5 () ((slot :initform closed))))")
     881  (:duplicate-definition))
     882
     883#+not-yet
     884(deftest ccl.49345-6
     885    (test-dup-warnings
     886     "(defclass test.ccl-49345-6 () ())"
     887     "(let ((closed nil))
     888         (defstruct test.ccl-49345-6 (x closed)))")
     889  (:duplicate-definition))
     890
     891(deftest ccl.49345-7
     892    (test-dup-warnings
     893     "(defclass test.ccl-49345-7 () ())
     894      (when (find-class 'test.ccl-49345-7 nil)
     895         (defclass test.ccl-49345-7 () ()))")
     896  ())
     897
     898(defun test-compiler-warning (text)
     899  (let ((warnings nil))
     900    (handler-bind ((ccl::compiler-warning (lambda (c)
     901                                            (push (ccl::compiler-warning-warning-type c) warnings)
     902                                            (muffle-warning c))))
     903      (test-compile (test-source-file text) :hide-warnings t))
     904    warnings))
     905 
     906(deftest ccl.49345-u1
     907    (test-compiler-warning "(defun ccl.49345-u1 (x) (typep x 'ccl.49345-u1-type))")
     908  (:undefined-type))
     909
     910(deftest ccl.49345-u2
     911    (test-compiler-warning "(defun ccl.49345-u2 (x) (declare (type ccl.49345-u2-type x)) x)")
     912  (:undefined-type))
     913
     914(deftest ccl.49345-u3
     915    (test-compiler-warning "(defun ccl.49345-u3 (x) (the ccl.49345-u3-type x))")
     916  (:undefined-type))
     917
     918(deftest ccl.49345-u4
     919    (test-compiler-warning "(defun ccl.49345-u4 (x) (make-array x :element-type 'ccl.49345-u4-type))")
     920  (:undefined-type))
     921
     922(deftest ccl.49345-u5
     923    (test-compiler-warning "(defun ccl.49345-u5 (x) (coerce x 'ccl.49345-u5-type))")
     924  (:undefined-type))
     925
     926(deftest ccl.49345-u6
     927    (test-compiler-warning "(declaim (type ccl.49345-u6-type *ccl.49345-u6*))")
     928  (:undefined-type))
     929
     930(deftest ccl.49345-i1
     931    (test-compiler-warning "(defun ccl.49345-i1 (x) (typep x '(sequence integer)))")
     932  (:invalid-type))
     933
     934(deftest ccl.49345-i2
     935    (test-compiler-warning "(defun ccl.49345-i2 (x) (declare (type (sequence integer) x)) x)")
     936  (:invalid-type))
     937
     938(deftest ccl.49345-i3
     939    (test-compiler-warning "(defun ccl.49345-i3 (x) (the (sequence integer) x))")
     940  (:invalid-type))
     941
     942(deftest ccl.49345-i4
     943    (test-compiler-warning "(defun ccl.49345-i4 (x) (make-array x :element-type '(sequence integer)))")
     944  (:invalid-type))
     945
     946(deftest ccl.49345-i5
     947    (test-compiler-warning "(defun ccl.49345-i5 (x) (coerce x '(sequence integer)))")
     948  (:invalid-type))
     949
     950(deftest ccl.49345-i6
     951    (test-compiler-warning "(declaim (type (sequence integer) *ccl.49345-i6*))")
     952  (:invalid-type))
     953
     954(deftest ccl.49345-fwd
     955    (test-compiler-warning "(defun ccl.49345-fwd-fn (x ) (typep x 'ccl.49345-fwd-type))
     956                            (defclass ccl.49345-fwd-type () ())")
     957  ())
    849958
    850959;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Note: See TracChangeset for help on using the changeset viewer.