mirror of
https://gitlab.com/embeddable-common-lisp/ecl.git
synced 2026-03-12 07:50:26 -07:00
cmp: checked-value: don't omit type checks if we detect a type-error at compile time
We now warn at compile time and create a type assertion which errors at runtime.
This commit is contained in:
parent
1f57d7e20a
commit
83ed2e1722
1 changed files with 7 additions and 7 deletions
|
|
@ -119,20 +119,20 @@
|
|||
and-type (type-and form-type type))
|
||||
(eq and-type form-type))
|
||||
form)
|
||||
;; Are the form type and the test disjoint types?
|
||||
((null and-type)
|
||||
(cmpwarn "The expression ~S is not of the expected type ~S"
|
||||
value type)
|
||||
form)
|
||||
;; Otherwise, emit a full test
|
||||
(t
|
||||
(cmpdebug "Checking type of ~S to be ~S" value type)
|
||||
(if (null and-type) ; Are the form type and the test disjoint types?
|
||||
(cmpwarn "The expression ~S is not of the expected type ~S"
|
||||
value type)
|
||||
(cmpdebug "Checking type of ~S to be ~S" value type))
|
||||
(let ((full-check
|
||||
(with-clean-symbols (%checked-value)
|
||||
`(let* ((%checked-value ,value))
|
||||
(declare (:read-only %checked-value))
|
||||
,(expand-type-assertion '%checked-value type *cmp-env* nil)
|
||||
(truly-the ,type %checked-value)))))
|
||||
,(if (null and-type)
|
||||
'%checked-value
|
||||
`(truly-the ,type %checked-value))))))
|
||||
(make-c1form* 'CHECKED-VALUE
|
||||
:type type
|
||||
:args type form (c1expr full-check)))))))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue