cursive-ide/cursive

Renaming a namespace alias breaks destructured locals

Opened this issue · 0 comments

If I have this code

(ns abcd
  (:require [abcd :as a]))

(defn get-id [{:keys [::a/id]}]
  (str id))

And Refactor→Rename alias a to aa, it will produce the following code:

(ns abcd
  (:require [abcd :as aa]))

(defn get-id [{:keys [::aa/id]}]
  (str ::aa/id))

This renaming replaces destructured local variables with keywords, thus breaking the code very subtly — there are no compilation errors, and in many cases no linting warnings.