~ chicken-core (chicken-5) 89f418de361960420ff0f4cf97179d61514b26f7
commit 89f418de361960420ff0f4cf97179d61514b26f7
Author: Kristian Lein-Mathisen <kristianlein@gmail.com>
AuthorDate: Thu Apr 13 14:15:07 2017 +0200
Commit: Evan Hanson <evhan@foldling.org>
CommitDate: Wed Apr 19 11:16:59 2017 +1200
Use s8vector-set! for the s8vector-ref's setter
This fixes a bug where u8vector-set! was used instead.
Signed-off-by: Peter Bex <peter@more-magic.net>
Signed-off-by: Evan Hanson <evhan@foldling.org>
diff --git a/NEWS b/NEWS
index b43e851e..4713c834 100644
--- a/NEWS
+++ b/NEWS
@@ -10,6 +10,8 @@
interrupted by a signal, we now retry (thanks to Joerg Wittenberger).
- char-ready? on string ports now also returns #t at EOF, as per R5RS;
in other words, it always returns #t (thanks to Moritz Heidkamp)
+ - Unit srfi-4: Fixed typo that broke SRFI-17 generalised set! syntax
+ on s8vectors (thanks to Kristian Lein-Mathisen).
- Build system
- Fixed broken compilation on NetBSD, due to missing _NETBSD_SOURCE.
diff --git a/srfi-4.scm b/srfi-4.scm
index 69f58ba4..89e62aeb 100644
--- a/srfi-4.scm
+++ b/srfi-4.scm
@@ -189,7 +189,7 @@ EOF
(let ((len (##core#inline "C_u_i_s8vector_length" x)))
(check-range i 0 len 's8vector-ref)
(##core#inline "C_u_i_s8vector_ref" x i)))
- u8vector-set!
+ s8vector-set!
"(s8vector-ref v i)"))
(define u16vector-ref
diff --git a/tests/srfi-4-tests.scm b/tests/srfi-4-tests.scm
index 9daaa78e..9af6c25d 100644
--- a/tests/srfi-4-tests.scm
+++ b/tests/srfi-4-tests.scm
@@ -16,12 +16,17 @@
(assert (= 100 (,(conc "vector-ref") x 0)))
(assert (,(conc "vector?") x))
(assert (number-vector? x))
+ ;; Test direct setter and ref
(,(conc "vector-set!") x 1 99)
(assert (= 99 (,(conc "vector-ref") x 1)))
+ ;; Test SRFI-17 generalised set! and ref
+ (set! (,(conc "vector-ref") x 0) 127)
+ (assert (= 127 (,(conc "vector-ref") x 0)))
+ ;; Ensure length is okay
(assert (= 2 (,(conc "vector-length") x)))
(assert
(every =
- '(100 99)
+ '(127 99)
(,(conc "vector->list") x))))))))
(test1 u8)
Trap