doc macro does not expand special cases properly

Description

The doc macro supports three special cases, mapping & to fn, catch to try, and finally to try. However, the macro does not currently expand these cases - it executes them like a function instead. This is evident if you use the following at a REPL:

user> (macroexpand '(doc try)) ;; ok ((var clojure.repl/print-doc) ((var clojure.repl/special-doc) (quote try))) user> (macroexpand '(doc catch)) ;; broken ;; -- unexpectedly prints try doc -- ;; nil user> (= (with-out-str (doc catch)) (with-out-str (doc try))) ;; broken, expect true ;; -- unexpectedly prints try doc -- ;; false

Workaround: Call doc with the symbol to which the special case is mapped, fn or try.

Cause: Incorrect quoting when handling special cases in doc macro

Solution: Update special case quoting approach to match the other cases.

Patch: CLJ-1358.patch

Environment

None

Attachments

1
  • 18 Feb 2014, 04:41 AM

Activity

Show:

Chad Taylor February 18, 2014 at 4:41 AM

Adding a patch with code and test.

Completed

Details

Assignee

Reporter

Labels

Approval

Ok

Patch

Code and Test

Priority

Affects versions

Fix versions

Created February 18, 2014 at 4:39 AM
Updated September 7, 2017 at 10:25 PM
Resolved September 7, 2017 at 10:25 PM

Flag notifications