summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2020-07-02 06:06:08 -0700
committerKaz Kylheku <kaz@kylheku.com>2020-07-02 06:06:08 -0700
commit98a6197e86054d03666a98ecddb318e38b426627 (patch)
tree95bcc6b8d74c9324a87a8c09fe0f11a02bbd5774
parent41df7940c9b3f2dab508529e1a27f41fea6dc4e9 (diff)
downloadtxr-98a6197e86054d03666a98ecddb318e38b426627.tar.gz
txr-98a6197e86054d03666a98ecddb318e38b426627.tar.bz2
txr-98a6197e86054d03666a98ecddb318e38b426627.zip
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.
-rw-r--r--struct.c5
1 files changed, 4 insertions, 1 deletions
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)