From 4da8ca54b60e373cf8f344601e19daabbac25437 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Kochma=C5=84ski?= Date: Thu, 7 May 2020 12:21:55 +0200 Subject: [PATCH] slot-definitions-compatible-p: check for the slot class too The spec says: The generic function make-instances-obsolete is invoked automatically by the system when defclass has been used to redefine an existing standard class and the set of local slots accessible in an instance is changed or the order of slots in storage is changed. It can also be explicitly invoked by the user. If the local slot's class is changed then indeed the set has changed. We also check whether the slot class is S-D-S-D or S-E-S-D and in both cases we also decide that layouts are not compatible. Fixes #586. --- src/clos/change.lsp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/clos/change.lsp b/src/clos/change.lsp index c7ad26dec..ffd62fafe 100644 --- a/src/clos/change.lsp +++ b/src/clos/change.lsp @@ -226,13 +226,20 @@ for n = (pop new-slotds) while (and o n) do (let ((old-alloc (slot-definition-allocation o)) - (new-alloc (slot-definition-allocation n))) + (new-alloc (slot-definition-allocation n)) + (old-class (class-of o)) + (new-class (class-of n))) (unless (and (eq old-alloc new-alloc) (eq (slot-definition-name o) (slot-definition-name n)) (or (not (eq old-alloc :instance)) (= (slot-definition-location o) - (slot-definition-location n)))) + (slot-definition-location n))) + (eq old-class new-class) + (or (eq new-class + (find-class 'standard-direct-slot-definition)) + (eq new-class + (find-class 'standard-effective-slot-definition)))) (return-from slot-definitions-compatible-p nil))) finally (return (and (null o)