~ chicken-core (chicken-5) /tests/scrutiny-tests-3.scm
Trap1;;;; scrutiny-tests-3.scm - scrutinizer-tests, compiled in block mode and executed234;;; ensure implicit global type-declarations are "smashed" (i.e. have5;;; their component types invalidated, due to possible mutation)67(define vec (make-vector 10 #f))8(vector-set! vec 0 99)9(assert10 (compiler-typecase vec11 ((vector-of boolean) #f)12 (vector #t)))131415;;; reduce OR-types in alternative branch of conditional with predicate1617(define something)1819(let ((x (the (or string number) something)))20 (if (number? x)21 (compiler-typecase x22 (number 1))23 (compiler-typecase x24 (string 2))))2526(let ((x (the (or string number) something)))27 (if (fixnum? x)28 (compiler-typecase x29 (fixnum 1))30 (compiler-typecase x31 ((or string number) 2))))3233(let ((x (the (forall ((a string) (b number)) (or a b)) something)))34 (if (number? x)35 (compiler-typecase x36 (number 3))37 (compiler-typecase x38 (string 4))))394041;;; #1399 incorrect return type after merge with noreturn procedure4243(let ((x (the (->) something))44 (y (the (-> noreturn) something)))45 (compiler-typecase (if something x y)46 ((->) (error "#1399 regression test failure"))47 (else 'ok)))