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

Keyword literals referring to a namespace required with :as-alias break cljr-clean-ns in cljc #378

Closed
DerGuteMoritz opened this issue Mar 10, 2022 · 5 comments · Fixed by #379
Assignees

Comments

@DerGuteMoritz
Copy link
Contributor

Expected behavior

When invoking cljr-clean-ns on a cljc namespace which contains an unused require as well as a keyword literal referring to a namespace which is only required with :as-alias like so:

(ns some-ns
  (:require [foo :as-alias f]
            [unused :as-alias clean-me-up]))

(def bar ::f/bar)

The unused namespace should be removed.

Actual behavior

The ns form remains untouched and the following error is logged:

cljr--maybe-rethrow-error: clojure.lang.ExceptionInfo: [line 3, col 17] Invalid keyword: ::f/bar. {:type :reader-exception, :ex-kind :reader-error, :file "[...]/src/some_ns.cljc", :line 3, :col 17}

Steps to reproduce the problem

See above.

Environment & Version information

clj-refactor.el version information

clj-refactor 3.4.2, refactor-nrepl 3.4.1

CIDER version information

CIDER 1.3.0 (Ukraine), nREPL 0.9.0
Clojure 1.11.0-rc1, Java 11.0.12

Clojure CLI version

1.10.3.1029

Emacs version

GNU Emacs 27.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.31, cairo version 1.16.0)

Operating system

NixOS on nixpkgs rev 3e644bd62489b516292c816f70bf0052c693b3c7

@DerGuteMoritz DerGuteMoritz changed the title Keyword literals referring to a namespaces required with :as-alias break cljr-clean-ns in cljc Keyword literals referring to a namespace required with :as-alias break cljr-clean-ns in cljc Mar 10, 2022
@vemv vemv self-assigned this Mar 11, 2022
@vemv
Copy link
Member

vemv commented Mar 15, 2022

clj-refactor and refactor-nrepl latest (for both: 3.5.1) gracefully handle :as-alias and should clean it only when due.

Would be happy if you can give it a spin an confirm that's the case.

Cheers - V

@DerGuteMoritz
Copy link
Contributor Author

clj-refactor and refactor-nrepl latest (for both: 3.5.1) gracefully handle :as-alias and should clean it only when due.

Yep, that's fixed now, thanks 🎉 However that would be clojure-emacs/clj-refactor.el#516 - the issue described in this ticket here still exists. Note that this only affects cljc files!

@DerGuteMoritz
Copy link
Contributor Author

Oh yeah and I'm using it with a clojure-cli REPL if that matters.

@vemv vemv reopened this Mar 15, 2022
@vemv vemv transferred this issue from clojure-emacs/clj-refactor.el Mar 15, 2022
@vemv vemv closed this as completed in #379 Mar 15, 2022
@vemv
Copy link
Member

vemv commented Mar 15, 2022

Fixed in clj-refactor and refactor-nrepl latest (for both: 3.5.2)

Thanks for your collaboration! 🍻

@DerGuteMoritz
Copy link
Contributor Author

Confirmed, works like a charm now 🙌 Thanks a lot for your help!!

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

Successfully merging a pull request may close this issue.

2 participants