type-checking of &optional
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
SBCL |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
Types from FTYPE involving &optional are not respected.
(declaim (ftype (function (integer &optional pathname) t) what))
(defun what (x &optional (p *default-
(what 1 2) => (1 2)
But adding a type declaration works:
(defun what (x &optional (p *default-
(declare (pathname p))
(list x p))
(what 1 2)
"The value 2 is not of type PATHNAME when binding P"
Keywords args are mostly right, but something about how code is generated requires insertion of (OR NULL) which leads to being less strict than is technically correct.
(declaim (ftype (function (integer &key (:p pathname)) t) whatk))
(defun whatk (x &key (p *default-
(whatk 1 :p 2)
"The value 2 is not of type (OR PATHNAME NULL) when binding P"
(whatk 1 :p nil) => (1 NIL) ; why is this allowed?
Changed in sbcl: | |
status: | Fix Committed → Fix Released |
Fixed in https:/ /sourceforge. net/p/sbcl/ sbcl/ci/ 0c884261ab6ac67 8f296da2c5a8b09 a96c2fb11a