mirror of
https://gitlab.com/embeddable-common-lisp/ecl.git
synced 2026-01-22 04:21:16 -08:00
defstruct: be less strict about struct redefinitions
Only disallow struct redefinition if we are certain about subtype relationships in slots. Otherwise, we can wrongly disallow struct redefinitions which don't change slot types.
This commit is contained in:
parent
177ad215ea
commit
f7cd2b8775
1 changed files with 7 additions and 3 deletions
|
|
@ -313,14 +313,18 @@
|
|||
(or (equal old-def new-def)
|
||||
(destructuring-bind (old-slot-name old-init old-type old-read-only old-offset old-ac)
|
||||
old-def
|
||||
(declare (ignore old-init read-only old-ac))
|
||||
(declare (ignore old-init old-read-only old-ac))
|
||||
(destructuring-bind (new-slot-name new-init new-type new-read-only new-offset new-ac)
|
||||
new-def
|
||||
(declare (ignore new-init new-read-only new-ac))
|
||||
(and (eql old-slot-name new-slot-name)
|
||||
(= old-offset new-offset)
|
||||
(and (subtypep old-type new-type)
|
||||
(subtypep new-type old-type)))))
|
||||
(and (multiple-value-bind (subtypep certain)
|
||||
(subtypep old-type new-type)
|
||||
(or (not certain) subtypep))
|
||||
(multiple-value-bind (subtypep certain)
|
||||
(subtypep new-type old-type)
|
||||
(or (not certain) subtypep))))))
|
||||
(return-from %struct-layout-compatible-p nil)))))
|
||||
|
||||
(defun define-structure (name conc-name type named slots slot-descriptions
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue