From f3101cf296dfa0c7f97fd573ded8409905ae9ca1 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Thu, 2 Jul 2020 06:06:08 -0700 Subject: struct: bugfix: autoload on instance slot also. * struct.c (slot_types): Try lisplib_try_load, just like in static_slot_types. The reason for this is that there is code like (or (sys:slot-types slot) (sys:static-slot-types slot)) which occurs in sys:check-slot, testing both hashes. This code gets fooled in the following way: the sys:slot-types slot reports nil for a particular slot being probed. It doesn't try autoloading, checking the hash just once. Next, sys:static-slot-types is called and triggers an autoload. The autoload instantiates the slot as an instance slot (but not as a static slot). Then sys:static-slot-types returns nil also because there is no such static slot. The effect is that the slot exists due to the autload, but since both functions yielded nil, the overall (or ...) expression yields nil, which is interpreted as the slot not existing. --- struct.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/struct.c b/struct.c index e8a862a7..e12ffcec 100644 --- a/struct.c +++ b/struct.c @@ -1885,7 +1885,10 @@ val get_slot_syms(val package, val is_current, val method_only) val slot_types(val slot) { - return gethash(slot_type_hash, slot); + uses_or2; + return or2(gethash(slot_type_hash, slot), + if2(lisplib_try_load(slot), + gethash(slot_type_hash, slot))); } val static_slot_types(val slot) -- cgit v1.2.3