~ chicken-core (chicken-5) 8aee5a8c10f6b94d786f5d69989114221772465e


commit 8aee5a8c10f6b94d786f5d69989114221772465e
Author:     Evan Hanson <evhan@foldling.org>
AuthorDate: Wed Aug 6 18:33:45 2014 +1200
Commit:     Peter Bex <peter.bex@xs4all.nl>
CommitDate: Fri Aug 8 23:48:58 2014 +0200

    Fix scrutiny special case for list-tail when tail is null
    
    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.
    
    Signed-off-by: Peter Bex <peter.bex@xs4all.nl>

diff --git a/scrutinizer.scm b/scrutinizer.scm
index a4edfb72..c4379331 100644
--- a/scrutinizer.scm
+++ b/scrutinizer.scm
@@ -2262,7 +2262,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
Trap