Over aggressive call elimination invoking sets

Description

A regression was introduced with https://github.com/clojure/clojurescript/commit/1a537e57a1fda9ac54f86ed4a88e92713aefdb36 where the optimization is overly aggressive in the case of invoking sets on values returned by Node calls.

Repro:

1 2 3 4 5 6 7 8 9 $ clj -Srepro -Sdeps '{:deps {org.clojure/clojurescript {:git/url "https://github.com/clojure/clojurescript" :sha "1a537e57a1fda9ac54f86ed4a88e92713aefdb36"}}}' -m cljs.main -re node Cloning: https://github.com/clojure/clojurescript Checking out: https://github.com/clojure/clojurescript at 1a537e57a1fda9ac54f86ed4a88e92713aefdb36 cljs.user=> (#{"node"} (.-title (js/require "process"))) Execution error (TypeError) at (<cljs repl>:1). (intermediate value) is not a function cljs.user=> (#{"node"} ^any (.-title (js/require "process"))) "node"

Note that in the above, this can be worked around by suppressing the optimization with an ^any hint.

Using the parent commit SHA shows that things were fine prior to this commit of interest:

1 2 3 4 $ clj -Srepro -Sdeps '{:deps {org.clojure/clojurescript {:git/url "https://github.com/clojure/clojurescript" :sha "3c7c37b27cb24810b2abb6410aa063b599fe2223"}}}' -m cljs.main -re node Checking out: https://github.com/clojure/clojurescript at 3c7c37b27cb24810b2abb6410aa063b599fe2223 cljs.user=> (#{"node"} (.-title (js/require "process"))) "node"

This issue was discovered via Canary for the Hoplon project which has a similar expression [1]

1 (#{"checkbox" "radio"} (.attr e "type"))

[1] https://github.com/hoplon/hoplon/blob/d502e3dd0370b1d86dafca6153a3aa94a3056fb5/src/hoplon/jquery.cljs#L119

Environment

None

Status

Assignee

Unassigned

Reporter

Mike Fikes

Labels

None

Approval

None

Patch

None

Priority

Major
Configure