Sequence function compilation fails with weird cons types
Bug #1980292 reported by
James Kalenius
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
SBCL |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
(defun s (x) (declare (type (cons (eql 5)) x)) (car (sort x #'<)))
(s (list 5 4)) => 5. correct answer is 4.
I believe this is because the derive-type for SORT just returns the type of the sequence,
which in this case is too specific. SBCL then constant folds the whole function to 5 (and
warns that it is discarding the result of SORT).
You can see similar problems with FILL and other functions with similar derive-type methods.
This is on SBCL 2.2.5.
Changed in sbcl: | |
status: | New → Fix Committed |
Changed in sbcl: | |
status: | Fix Committed → Fix Released |
To post a comment you must log in.