Overly aggressive removal of call

Description

With https://github.com/clojure/clojurescript/commit/8f38049d543b04b8da55029f140b6577e3ec245a in a situation illustrated below, code gen that previously involved .call has been optimized to avoid .call.

Note elem(attr,kids) in the following:

1 2 3 4 5 6 7 $ clj -Srepro -Sdeps '{:deps {org.clojure/clojurescript {:git/url "https://github.com/clojure/clojurescript" :sha "8f38049d543b04b8da55029f140b6577e3ec245a"}}}' -m cljs.main cljs.user=> (set! *print-fn-bodies* true) true cljs.user=> (let [xmlns "http://www.w3.org/2000/svg" elem (.createElementNS js/document xmlns "svg") attr {:svg/viewBox "0 0 10 10"} kids []] #(elem attr kids)) #object[Function "function (){ return elem(attr,kids); }"]

The previous commit that causes code gen with elem.call(null,attr,kids):

1 2 3 4 5 6 7 $ clj -Srepro -Sdeps '{:deps {org.clojure/clojurescript {:git/url "https://github.com/clojure/clojurescript" :sha "7ef8fd92e8a4a566fc5a26d91923f30d3f2f862c"}}}' -m cljs.main cljs.user=> (set! *print-fn-bodies* true) true cljs.user=> (let [xmlns "http://www.w3.org/2000/svg" elem (.createElementNS js/document xmlns "svg") attr {:svg/viewBox "0 0 10 10"} kids []] #(elem attr kids)) #object[Function "function (){ return elem.call(null,attr,kids); }"]

In the downstream Hoplon [1] target test environment, this appears to have differing semantics at runtime, with the elision of .call resulting in an error

1 #object[TypeError TypeError: SVGSVGElement is not a constructor (evaluating 'elem(attr,kids)')]

[1] https://github.com/hoplon/hoplon/blob/4669838feaeae578ef51bd6d6499104c0bab2cc3/src/hoplon/svg.cljs#L26

Environment

None

Status

Assignee

Unassigned

Reporter

Mike Fikes

Labels

None

Approval

None

Patch

None

Priority

Major
Configure