chicken-hackers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Chicken-hackers] [PATCH] Fix scrutiny special case for list-tail when t


From: Evan Hanson
Subject: [Chicken-hackers] [PATCH] Fix scrutiny special case for list-tail when tail is null
Date: Wed, 6 Aug 2014 18:33:45 +1200

Due to an off-by-one, the special-cased scrutiny for `list-tail` fails
when the index argument is equal to the length of the list, giving a
(list-of ...) as the result type rather than null. While that isn't
technically incorrect, it also isn't as accurate as possible; this patch
fixes this case.
---
 scrutinizer.scm |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scrutinizer.scm b/scrutinizer.scm
index 49f72c6..d66d8a7 100644
--- a/scrutinizer.scm
+++ b/scrutinizer.scm
@@ -2261,7 +2261,7 @@
                    (val (first (node-parameters index)))
                    ((fixnum? val))
                    ((>= val 0))
-                   ((< val (length (cdr arg1)))))   ;XXX could warn on failure 
(but needs location)
+                   ((<= val (length (cdr arg1)))))   ;XXX could warn on 
failure (but needs location)
           (let ((rest (list-tail (cdr arg1) val)))
             (list (if (null? rest)
                       'null
-- 
1.7.10.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]