Completed
Details
Assignee
UnassignedUnassignedReporter
chouserchouserLabels
Approval
OkPatch
CodePriority
MinorAffects versions
Fix versions
Details
Details
Assignee
Unassigned
UnassignedReporter
chouser
chouserLabels
Approval
Ok
Patch
Code
Priority
Affects versions
Fix versions
Created June 20, 2017 at 5:18 PM
Updated September 7, 2017 at 10:25 PM
Resolved September 7, 2017 at 10:25 PM
The
doto
macro currently produces lists without metadata, which among other things means errors and warnings are misleading or less specific than they could be. For example, this code generates reflection warnings, but the warnings point to the beginning of thedoto
block itself:(set! *warn-on-reflection* true) (def a "a") (def b (int \b)) (doto "abc" (.indexOf a) (.indexOf b))
Note the line and column numbers in these warnings:
Reflection warning, t1.clj:6:1 - call to method indexOf on java.lang.String can't be resolved (argument types: unknown). Reflection warning, t1.clj:6:1 - call to method indexOf on java.lang.String can't be resolved (argument types: unknown).
A more specific and accurate output would look like this:
Reflection warning, t1.clj:7:3 - call to method indexOf on java.lang.String can't be resolved (argument types: unknown). Reflection warning, t1.clj:8:3 - call to method indexOf on java.lang.String can't be resolved (argument types: unknown).
Similar macros like
->
take pains to propagate metadata from the users forms to the macro's output. This is more important for those macros because of how they interact with type hints.Since the return values of the interior
doto
forms are ignored, the metadata is somewhat less important, but the example above shows the the propagation would still be valuable.Patch: CLJ-2184-patch-00.patch
Prescreened by: Alex Miller