Uploaded image for project: 'Clojure'
  1. CLJ-1585

Report boxed math warning on function that boxes primitive return value

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects versions: Release 1.7
    • Fix versions: None
    • Labels:
    • Patch:
      Code

      Description

      With the new :warn-on-boxed ( CLJ-1325 Closed ), these examples do not report a boxed math warning although they each do boxing:

      user=> (defn f1 [^long x] (inc x))
      f1
      user=> (defn f2 [x] (aget (long-array [1 2]) 0))
      f2
      user=> (defn f3 [x] (aget (int-array [1 2]) 0))
      f3
      user=> (defn f4 [^String s] (.indexOf s "a"))
      

      Cause: emitBoxReturn has a hard-coded call to box a prim return value.

      Solution: If *unchecked-math* is set to :warn-on-boxed, emit a warning on boxing of primitive numeric return types.

      Patch:

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              alexmiller Alex Miller
            • Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated: