expander: fix reader bug

Fix incorrect comparison of character to EOF. There's a test, already,
but the test fails only if the expander is compiled in safe mode.
This commit is contained in:
Matthew Flatt 2019-09-06 17:01:34 -06:00
parent 4c630a2442
commit f4fa74e6f2
3 changed files with 5 additions and 4 deletions

View File

@ -1122,7 +1122,8 @@
(parameterize ([print-unreadable #f]) (parameterize ([print-unreadable #f])
(display x p))) (display x p)))
(err/rt-test (parameterize ([print-unreadable #f]) (err/rt-test (parameterize ([print-unreadable #f])
(write x p))))] (write x p))
exn:fail?))]
[try-good [try-good
(lambda (x) (lambda (x)
(test (void) (list x) (test (void) (list x)

View File

@ -5,7 +5,7 @@ RACKET = ../../bin/racket
SCHEME = scheme SCHEME = scheme
# Controls whether Racket layers are built as unsafe: # Controls whether Racket layers are built as unsafe:
UNSAFE_COMP = # --unsafe UNSAFE_COMP = --unsafe
# Controls whether compiled code is compressed: # Controls whether compiled code is compressed:
COMPRESS_COMP = # --compress COMPRESS_COMP = # --compress

View File

@ -43,7 +43,7 @@
in in
config)) config))
(define c (read-char/special in config)) (define c (read-char/special in config))
(unless (char=? c #\space) (unless (eqv? c #\space)
(reader-error in config (reader-error in config
"expected a single space after `~a`" "expected a single space after `~a`"
extend-str)) extend-str))
@ -56,7 +56,7 @@
(define (read-extension-#! read-recur dispatch-c in config (define (read-extension-#! read-recur dispatch-c in config
#:get-info? [get-info? #f]) #:get-info? [get-info? #f])
(define c (read-char/special in config)) (define c (read-char/special in config))
(unless (char-lang-nonsep? c) (unless (and (char? c) (char-lang-nonsep? c))
(bad-syntax-error in config (if (char? c) (bad-syntax-error in config (if (char? c)
(string dispatch-c #\! c) (string dispatch-c #\! c)
(string dispatch-c #\!)))) (string dispatch-c #\!))))