Skip to content

Commit 247071b

Browse files
authored
info and eldoc ops: fix regression for the special form .. (#817)
1 parent d39c735 commit 247071b

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## master (unreleased)
44

5+
### Bugs Fixed
6+
7+
* `info` and `eldoc` ops: fix regression for the special form `..`.
8+
59
## 0.38.1 (2023-09-21)
610

711
* Bump `orchard` to [1.5.1](https://github.com/clojure-emacs/orchard/blob/v0.15.1/CHANGELOG.md#0151-2023-09-21).

src/cider/nrepl/middleware/info.clj

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,9 @@
8888
(symbol class))
8989
.getName))
9090
(not-empty class)
91-
(when (some-> sym (str/starts-with? "."))
91+
(when (and (some-> sym (str/starts-with? "."))
92+
;; .. cannot be a class member, so class inference doesn't make sense here:
93+
(not= sym ".."))
9294
(extract-class-from-compliment ns context)))
9395
(catch Exception e
9496
nil))

test/clj/cider/nrepl/middleware/info_test.clj

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,17 @@
9696
(testing "A `:context` can disambiguate input, reducing the `:candidates` to just one"
9797
(let [base {:ns (str *ns*)
9898
:symbol ".codePointCount"}
99+
base-with-context (assoc base :context "(let [v \"\"] \n (__prefix__ v))")
99100
response-without-context (info/info base)
100-
response-with-context (info/info (assoc base :context "(let [v \"\"] \n (__prefix__ v))"))]
101+
response-with-context (info/info base-with-context)]
101102
(is (= '[java.lang.String java.lang.StringBuffer java.lang.Character java.lang.StringBuilder]
102103
(-> response-without-context :candidates keys)))
103104
(is (not (:candidates response-with-context)))
104105
(is (= `String
105-
(:class response-with-context))))))
106+
(:class response-with-context)))
107+
(is (= {:added "1.0", :ns 'clojure.core, :name '.., :file "clojure/core.clj"}
108+
(-> base-with-context (assoc :symbol "..") info/info (select-keys [:class :added :ns :name :file])))
109+
"The context is ignored for the special form `..`"))))
106110

107111
;; Used below in an integration test
108112
(def ^{:protocol #'clojure.data/Diff} junk-protocol-client nil)

0 commit comments

Comments
 (0)