Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typehint confuses CLJS compiler #499

Closed
thheller opened this issue Jan 13, 2021 · 2 comments
Closed

Typehint confuses CLJS compiler #499

thheller opened this issue Jan 13, 2021 · 2 comments

Comments

@thheller
Copy link

https://github.com/borkdude/sci/blob/472ca74041f082f86e7f8cb1d9f2dafa3492d40c/src/sci/impl/fns.cljc#L118

The ^clojure.lang.Associative hint is sort of invalid for CLJS and leads to a bunch (35+) of

------ WARNING #4 - :undeclared-var --------------------------------------------
 File: ../sci/src/sci/impl/fns.cljc:141:28
--------------------------------------------------------------------------------
 138 |                     (if recur? (recur) ret)))
 139 |               1 #?(:clj (gen-fn 1)
 140 |                    :cljs (if disable-arity-checks?
 141 |                            (gen-fn 1 true)
----------------------------------^---------------------------------------------
 Use of undeclared Var sci.impl.fns/clojure
--------------------------------------------------------------------------------
 142 |                            (gen-fn 1 false)))
 143 |               2 #?(:clj (gen-fn 2)
 144 |                    :cljs (if disable-arity-checks?
 145 |                            (gen-fn 2 true)
--------------------------------------------------------------------------------

warnings when compiling with shadow-cljs. The errors however originate in the actual CLJS compiler, it just doesn't display those warnings since it treats all dotted symbols as valid. They are however not valid and will confuse the type inference logic since it introduces an unknown type. I'm not sure the typehint does anything useful here anyways so it might be good to remove it or create a proper #?(:clj ... :cljs ...) conditional so this CLJ specific info doesn't leak into the CLJS compilation.

@borkdude
Copy link
Collaborator

Hi @thheller, thanks for the issue.

This has already been reported in:
#435

but your information describes the issue better. I'll close the other one.

borkdude added a commit that referenced this issue Jan 13, 2021
@borkdude
Copy link
Collaborator

Should be fixed with fe9ba20

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants