552 cond expand no match (#554)

* Issue #552 - Error if no match cond-expand clause

* Issue #552 - Document change to cond-expand
This commit is contained in:
Justin Ethier 2025-01-16 22:31:08 -05:00 committed by GitHub
parent 398f8e91d6
commit 2d833cd6c1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 3 additions and 1 deletions

View file

@ -12,6 +12,7 @@ Bug Fixes
- Added a fix from Yorick Hardy to define `*ai-v4mapped*` to zero on platforms where `AI_V4MAPPED` is undefined. - Added a fix from Yorick Hardy to define `*ai-v4mapped*` to zero on platforms where `AI_V4MAPPED` is undefined.
- Updated `sqrt` to properly handle complex results given non-complex input. EG: `(sqrt -1) ==> 1i`. And updated the parser to properly handle `+i` and `-i`. Thanks to Christopher Hebert for the bug reports! - Updated `sqrt` to properly handle complex results given non-complex input. EG: `(sqrt -1) ==> 1i`. And updated the parser to properly handle `+i` and `-i`. Thanks to Christopher Hebert for the bug reports!
- Updated `cond-expand` to raise an error if no clauses match, instead of returning `#t`.
## 0.36.0 - February 14, 2024 ## 0.36.0 - February 14, 2024

View file

@ -407,7 +407,7 @@
(else (error "cond-expand: bad feature" x))) (else (error "cond-expand: bad feature" x)))
(memq x (features)))) (memq x (features))))
(let expand ((ls (cdr expr))) (let expand ((ls (cdr expr)))
(cond ((null? ls)) ; (error "cond-expand: no expansions" expr) (cond ((null? ls) (error "cond-expand: no expansions" expr))
((not (pair? (car ls))) (error "cond-expand: bad clause" (car ls))) ((not (pair? (car ls))) (error "cond-expand: bad clause" (car ls)))
((eq? 'else (caar ls)) ;(identifier->symbol (caar ls))) ((eq? 'else (caar ls)) ;(identifier->symbol (caar ls)))
(if (pair? (cdr ls)) (if (pair? (cdr ls))

View file

@ -54,6 +54,7 @@
(test "o" (read-line p)) (test "o" (read-line p))
) )
) )
(else #f)
) )
(test-group (test-group