Evaling #{do ...} or [do ...] is treated as the do special form
Description
Environment
Attachments
Activity
Screened.
Attached a new patch (p4) that should apply. Also halfway reverted a change that Alex made regarding which files are cleaned up after the test. When I run the tests on my machine with his version, several class files are leftover.
All 3 of the attached patches no longer apply cleanly to latest master as of Aug 14 2013. This may simply be due to extra tests added to file compilation.clj by the patch for CLJ-1154, which was committed earlier today. If so, it should be pretty straightforward to update the stale patch(es). See the section "Updating Stale Patches" at http://dev.clojure.org/display/community/Developing+Patches
Updated description to help it along a bit and marked Screened.
Updated patch very slightly to fix a spelling typo.
Problem: Evaluating a persistent collection for which the function
first
returns the symboldo
leads to that collection being treated as the do special form, even though it may be a vector or even a set. IMHO, the expected result would be to report thatdo
cannot be resolved.[do 1 2] ;=> 2 #{"hello" "goodbye" do} ;=> "hello" ; Wat?
Cause: The check for
do
is checking for IPersistentCollection instead of ISeq.Solution: Change the cast (occurs in two places) for the
do
form check from IPersistentCollection to ISeq:if(form instanceof IPersistentCollection && Util.equals(RT.first(form), DO))
to
if(form instanceof ISeq && Util.equals(RT.first(form), DO))
Current patch: CLJ-1184-p4.patch
Screened by: Alex Miller