ClojureScript

Duplicate HOF invoke warnings if :static-fns true

Details

  • Type: Defect Defect
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Completed
  • Affects Version/s: 1.9.655
  • Fix Version/s: 1.9.655
  • Component/s: None
  • Labels:
    None
  • Approval:
    Accepted

Description

If you have a HOF invoke, an optimization introduced with CLJS-2046 (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

Activity

Hide
Mike Fikes added a comment -

Confirmed fix in self-host (downstream Planck).

Show
Mike Fikes added a comment - Confirmed fix in self-host (downstream Planck).

People

Vote (0)
Watch (2)

Dates

  • Created:
    Updated:
    Resolved: