summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2016-10-15 21:36:51 -0700
committerKaz Kylheku <kaz@kylheku.com>2016-10-15 21:36:51 -0700
commit969dff328ab43e3a96248fc9cce41584819b9114 (patch)
tree58e21da914d19bf1abe5f9ec75a63acc3fd3a9b2
parent6a5ea25622c3dbab61b35bab87506c83206ec5fd (diff)
downloadtxr-969dff328ab43e3a96248fc9cce41584819b9114.tar.gz
txr-969dff328ab43e3a96248fc9cce41584819b9114.tar.bz2
txr-969dff328ab43e3a96248fc9cce41584819b9114.zip
Bugfix: unable to assign to x.y.z place.
This regression was caused by commit 957f80f "Bugfix: issue with expansion of place macros" on Sep 7, 2016. The commit itself is sound, but exposes a hidden problem in nearby code. * share/txr/stdlib/place.tl (sys:pl-expand): The conditions for terminating the loop and returning the expansion are too weak, due to the inclusion of an incorrect test. We must not bail when the expansion of a compound form is a compound form with the same symbol. This is because some macros behave that way, such as, oh: qref! The expansion of (qref a b c) is (qref (slot a 'b) 'c): another qref form. To fully expand, we must keep iterating until the returned form is eq to the input form. The original macroexpand (which was replaced by macroexpand-1 in 957f80f) hid this problem because macroexpand doesn't use this broken termination test.
-rw-r--r--share/txr/stdlib/place.tl5
1 files changed, 1 insertions, 4 deletions
diff --git a/share/txr/stdlib/place.tl b/share/txr/stdlib/place.tl
index eb827fd4..e3ba6c0f 100644
--- a/share/txr/stdlib/place.tl
+++ b/share/txr/stdlib/place.tl
@@ -156,10 +156,7 @@
(sys:setq place (macroexpand-1 place env))
(when (or (eq place unex-place)
(null place)
- (and (atom place) (not (symbolp place)))
- (and (consp place)
- (consp unex-place)
- (eq (car place) (car unex-place))))
+ (and (atom place) (not (symbolp place))))
(return place))
(sys:setq unex-place place))))