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
_______________________________________________
Chicken-hackers mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/chicken-hackers