1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-18 17:50:29 +02:00

Baseline compiler no longer crashes on (not (list 1 2)).

Fixes <https://bugs.gnu.org/58217>.

* module/language/tree-il/compile-bytecode.scm (canonicalize)
[finish-conditional](predicate?): Do not assume 'lookup-primitive'
returns true.
* test-suite/tests/compiler.test ("regression tests")
["(not (list 1 2))"]: New test.
This commit is contained in:
Ludovic Courtès 2022-10-01 15:36:21 +02:00
parent df86a2a8c8
commit e2797f529b
3 changed files with 12 additions and 2 deletions

View file

@ -409,7 +409,9 @@
(define (finish-conditional exp)
(define (true? x) (match x (($ <const> _ val) val) (_ #f)))
(define (false? x) (match x (($ <const> _ val) (not val)) (_ #f)))
(define (predicate? name) (primitive-predicate? (lookup-primitive name)))
(define (predicate? name)
(and=> (lookup-primitive name) primitive-predicate?))
(match exp
(($ <conditional> src ($ <conditional> _ test (? true?) (? false?))
consequent alternate)