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

Static usage of ns-unmap not recognized #2259

Closed
borkdude opened this issue Jan 18, 2024 · 1 comment
Closed

Static usage of ns-unmap not recognized #2259

borkdude opened this issue Jan 18, 2024 · 1 comment
Projects

Comments

@borkdude
Copy link
Member

          This continues to trigger if the function is created by a macro that clj-kondo understands:
(ns ns-unmap-records)

(defrecord Example [a b c])

(ns-unmap *ns* '->Example)

(defn ->Example
  [a b c]
  (new Example a b c))

raises corpus/ns_unmap_records.clj:7:1: warning: redefined var #'ns-unmap-records/->Example.

Actually, looking at the code I think the changes were only intended to exclude clojure.core vars. Expanding it to include any existing var seems easy enough here:

-                        (when (or (pos? curr-var-count)
-                                  (not= ns-sym redefined-ns))
+                        (when (and (or (pos? curr-var-count)
+                                       (not= ns-sym redefined-ns))
+                                   (not (contains? (:clojure-excluded ns) var-sym)))

but that shifts the meaning of :clojure-excluded.

Originally posted by @NoahTheDuke in #1384 (comment)

@borkdude borkdude added this to Needs triage in clj-kondo via automation Jan 18, 2024
@borkdude borkdude moved this from Needs triage to High priority (next release) in clj-kondo Jan 18, 2024
@NoahTheDuke
Copy link
Contributor

Oh thank you, should have done this directly.

@borkdude borkdude moved this from High priority (next release) to In progress in clj-kondo Feb 9, 2024
clj-kondo automation moved this from In progress to Done Feb 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
clj-kondo
  
Done
Development

No branches or pull requests

2 participants