Fork me on GitHub
#cljs-dev
<
2018-08-22
>
mfikes03:08:25

Work on a better inference algorithm for and / or forms leads to tighter bounds on the result (fewer types, while still being correct): https://dev.clojure.org/jira/browse/CLJS-2869?focusedCommentId=49893&amp;page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-49893

thheller18:08:06

does someone have a minimal example that uses :global-exports? I just found a code generation issue in shadow-cljs which may also affect :global-exports code. I'm a bit out of the loop how config for this looks though.

thheller18:08:07

(ns demo.stuff
  (:require ["foo" :as foo]))

(defmulti foo ::bar)

thheller18:08:27

basically the exists? check that the defmulti does is invalid because foo resolves to a js/something

thheller18:08:58

if((typeof js !== 'undefined') && (typeof js.module$demo$foo !== 'undefined')){

thheller18:08:32

foo resolves to js/module$demo$foo in the shadow-cljs my case

mfikes18:08:32

There is a minimal example of :global-exports in the description of https://dev.clojure.org/jira/browse/CLJS-2854

👍 4
thheller18:08:07

this looks incorrect. I think the resolve call should be done first and all further checks should be done on the resolved sym, not x

thheller18:08:10

(namespace x) is otherwise pointless since it only works if the input sym is js/... not the resolved sym

dnolen18:08:05

I don’t really see how that line could make a difference at the moment - but yeah make something minimal and report that and assign to me

thheller18:08:25

x is foo, it resolves to js/module$.... (namespace x) (unresolevd) is checked and not= "js". new x becomes js/module$... without having its js/ stripped because the old x wasn't js/

dnolen18:08:37

right, but just provide some minimal non-shadow thing, Slack isn’t JIRA 🙂

dnolen18:08:25

if you can’t make it non-shadow in a reasonable amount of time, then go ahead provide the above - I’m familiar enough with shadow to use that as a starting point

thheller19:08:06

ok I think its not a problem in CLJS since nothing none js/ ever resolves to js/.... The npm stuff just resolves to module$... without js/. at least I can't reproduce it in any way.

dnolen19:08:47

yeah, we don’t do that

thheller19:08:07

ok yeah this is the only (non-locals) case where resolve-var returns a simple-symbol? in :name and shadow-cljs just resolves to js/the-var which I can adjust. https://github.com/clojure/clojurescript/blob/81a1ea127974d43a6166fbdae33bcaa296fe9156/src/main/clojure/cljs/analyzer.cljc#L1051-L1055

thheller19:08:35

thought :name must always be a qualified-symbol?

dnolen19:08:40

hrm I guess :js case is the exception?

thheller19:08:02

I resolve to js/module$... for easier externs inference but otherwise it doesn't matter much I think. locals also return unqualified syms so thats fine.