Uploaded image for project: 'ClojureScript'
  1. CLJS-2125

Duplicate HOF invoke warnings if :static-fns true

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Completed
    • Affects versions: 1.9.655
    • Fix versions: 1.9.655
    • Labels:
      None
    • Approval:
      Accepted

      Description

      If you have a HOF invoke, an optimization introduced with CLJS-2046 Closed (when :static-fns true) causes the analyzer to make a second pass, binding the result of the fn expression evaluation to a local so that more efficient code is emitted (not always using call).

      This second analysis pass can cause any warnings to be doubled. To repro in a REPL, set :static-fns true and then:

      cljs.user=> ((x) 3)
      WARNING: Use of undeclared Var cljs.user/x at line 1 <cljs repl>
      WARNING: Use of undeclared Var cljs.user/x at line 1 <cljs repl>
      

      You can see a side effect of this when running tests on master:

      WARNING: z at line 1228 is being replaced at line 1228 src/test/cljs/cljs/core_test.cljs
      WARNING: z at line 1228 is being replaced at line 1228 src/test/cljs/cljs/core_test.cljs
      WARNING: z at line 1228 is being replaced at line 1228 src/test/cljs/cljs/core_test.cljs
      WARNING: w at line 1229 is being replaced at line 1229 src/test/cljs/cljs/core_test.cljs
      WARNING: w at line 1229 is being replaced at line 1229 src/test/cljs/cljs/core_test.cljs
      WARNING: w at line 1229 is being replaced at line 1229 src/test/cljs/cljs/core_test.cljs
      

      whereas previously you would see

      WARNING: z at line 1228 is being replaced at line 1228 src/test/cljs/cljs/core_test.cljs
      WARNING: w at line 1229 is being replaced at line 1229 src/test/cljs/cljs/core_test.cljs
      

        Attachments

          Activity

            People

            • Assignee:
              dnolen David Nolen
              Reporter:
              mfikes Mike Fikes
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: