Clojure

Evaling #{do ...} or [do ...] is treated as the do special form

Details

  • Type: Defect Defect
  • Status: Closed Closed
  • Priority: Trivial Trivial
  • Resolution: Completed
  • Affects Version/s: Release 1.5
  • Fix Version/s: Release 1.6
  • Component/s: None
  • Labels:
  • Patch:
    Code and Test
  • Approval:
    Ok

Description

Problem: Evaluating a persistent collection for which the function first returns the symbol do 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 that do 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

  1. CLJ-1184-p1.patch
    26/May/13 2:13 PM
    2 kB
    Gary Fredericks
  2. CLJ-1184-p2.patch
    02/Jul/13 9:52 PM
    3 kB
    Gary Fredericks
  3. CLJ-1184-p3.patch
    23/Jul/13 10:49 PM
    3 kB
    Alex Miller
  4. CLJ-1184-p4.patch
    14/Aug/13 9:23 PM
    3 kB
    Gary Fredericks

Activity

People

Vote (0)
Watch (2)

Dates

  • Created:
    Updated:
    Resolved: