~ chicken-core (chicken-5) c8f585fcafd0e5b9e31b1c8910e6b9fc72068124
commit c8f585fcafd0e5b9e31b1c8910e6b9fc72068124
Author: felix <felix@call-with-current-continuation.org>
AuthorDate: Fri May 13 13:54:44 2011 +0200
Commit: felix <felix@call-with-current-continuation.org>
CommitDate: Fri May 13 13:54:44 2011 +0200
added more scrutinizer tests
diff --git a/tests/scrutiny-tests.scm b/tests/scrutiny-tests.scm
index 2f65cf19..f7f08a12 100644
--- a/tests/scrutiny-tests.scm
+++ b/tests/scrutiny-tests.scm
@@ -32,7 +32,6 @@
((values 1 2)) ; expected procedure, got fixnum (canonicalizes to 1 result)
; this should *not* signal a warning:
-
(define (test-values x)
(define (fail) (error "failed"))
(if x
@@ -45,3 +44,27 @@
(if foo 2) ; not in tail position
(if bar 3)) ; should warn
+;; noreturn conditional branch enforces "number" on x
+(define (foo2 x)
+ (if (string? x) (error "foo") (+ x 3))
+ (string-append x "abc"))
+
+;; implicit declaration of foo3
+(declare (hide foo3))
+
+(define (foo3 x)
+ (string-append x "abc"))
+
+(foo3 99)
+
+;; predicate
+(define (foo4 x)
+ (if (string? x)
+ (+ x 1)
+ (+ x 2))) ; ok
+
+;; enforcement
+(define (foo5 x)
+ (string-append x "abc")
+ (+ x 3))
+
Trap