From 3743324273f592681947eca6949f4d22560eae9b Mon Sep 17 00:00:00 2001 From: Oscar Waddell Date: Tue, 7 Nov 2023 05:44:43 -0500 Subject: [PATCH] fix port-bol? return type --- mats/6.ms | 9 +++++++++ s/io.ss | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/mats/6.ms b/mats/6.ms index 041fed618..8fef13bbd 100644 --- a/mats/6.ms +++ b/mats/6.ms @@ -713,6 +713,15 @@ (call-with-input-file "testfile.ss" (lambda (p) (string=? (get-string-all p) "a\n\nbc\n"))) + (let ([op (open-output-string)]) + ;; disguise boolean? check just enough to prevent cp0 from folding + ;; based on the declared return type; we need to actually check it + (define (check) (assert (memq (port-bol? op) '(#t #f))) #t) + (check) + (fprintf op "okay\n") + (check) + (write-char #\x op) + (check)) ) (mat char-ready? diff --git a/s/io.ss b/s/io.ss index 3af87d589..63a5e4085 100644 --- a/s/io.ss +++ b/s/io.ss @@ -214,7 +214,7 @@ implementation notes: (define eol-char? (lambda (c) - (memv c '(#\newline #\return #\nel #\ls)))) + (and (memv c '(#\newline #\return #\nel #\ls)) #t))) (define-syntax port-gz-mode (syntax-rules ()