Inline Binding with Parinfer breaks code
This seems related to issues #2786 and #2106, which were fixed in 1.13.0-eap1, but this bug still happens on 1.13.0-eap1
Given Parinfer is enabled and we have the following code. (The only difference between the functions is that the :ddddddddddddddd and :kkkkkkkkkkkkkkk keywords are one character longer in bad than in good1 and good2 respectively.)
(ns example)
(defn g [_]
[:div])
(defn bad [a]
(let [b (:b a)]
[:div
(into [:<>] (for [c (:c b)]
[:<>
(let [x (:ddddddddddddddd c)]
[:<>
[g {:e x
:f 1}]
[g x]])]))
[g {:i 1
:j (:kkkkkkkkkkkkkkk b)}]]))
(defn good1 [a]
(let [b (:b a)]
[:div
(into [:<>] (for [c (:c b)]
[:<>
(let [x (:dddddddddddddd c)]
[:<>
[g {:e x
:f 1}]
[g x]])]))
[g {:i 1
:j (:kkkkkkkkkkkkkkk b)}]]))
(defn good2 [a]
(let [b (:b a)]
[:div
(into [:<>] (for [c (:c b)]
[:<>
(let [x (:ddddddddddddddd c)]
[:<>
[g {:e x
:f 1}]
[g x]])]))
[g {:i 1
:j (:kkkkkkkkkkkkkk b)}]]))
Place the cursor on the x variable and do the Inline Binding (Ctrl+Alt+N) refactoring on all three functions. In the good1 and good2 functions the variable is inlined without problems, but in the bad function it produces broken code.
The resulting code:
(ns example)
(defn g [_]
[:div])
(defn bad [a]
(let [b (:b a)]
[:div
(into [:<>] (for [c (:c b)]
[:<>
[:<>
[g {:e (:ddddddddddddddd c)
:f 1}]
[g (:ddddddddddddddd c)
[g {:i 1
:j (:kkkkkkkkkkkkkkk b)}]]]]))]))
(defn good1 [a]
(let [b (:b a)]
[:div
(into [:<>] (for [c (:c b)]
[:<>
[:<>
[g {:e (:dddddddddddddd c)
:f 1}]
[g (:dddddddddddddd c)]]]))
[g {:i 1
:j (:kkkkkkkkkkkkkkk b)}]]))
(defn good2 [a]
(let [b (:b a)]
[:div
(into [:<>] (for [c (:c b)]
[:<>
[:<>
[g {:e (:ddddddddddddddd c)
:f 1}]
[g (:ddddddddddddddd c)]]]))
[g {:i 1
:j (:kkkkkkkkkkkkkk b)}]]))
Demonstration:
https://github.com/cursive-ide/cursive/assets/42678/668c0636-c4e2-4b1c-ba87-bcc4dbe6b32b
IntelliJ IDEA 2023.1.2 Cursive plugin 1.13.0-eap1-2023.1