Fork me on GitHub
#cider
<
2021-07-26
>
zimablue09:07:34

hey guys, I think someone identified a bug based on an error I was getting, where cider-nrepl overrides print-method because there's a variation on what this command displays, seen in this picture by @vemv. The issue is that it creates an invalid symbol with three slashes which blows up edn serialization of metadata. The original thread was here: https://app.slack.com/client/T03RZGPFR/C0617A8PQ/thread/C03S1KBA2-1627233840.296600

vemv09:07:13

Good summary of the issue. I think you meant two slashes though It seems good to me to create an issue in the adequate repo, sounds like it has a reasonably easy fix

Jim Newton18:07:46

I have a macro which expands fine in the cider repl, and expands fine at the lein repl, But refuses to expand using cnt-c-RET.

Jim Newton18:07:34

I get a message in the *Messages* buffer: nrepl-send-sync-request: Sync nREPL request timed out (op macroexpand expander macroexpand-1 code

Jim Newton18:07:42

any ideas what that is trying to tell me?

Jim Newton18:07:49

other macros expand without problem.

Jim Newton18:07:08

Here is an example of the macro expansion, which may be a lot of code, but macroexpand finishes in half a second

(let* [or__5501__auto__ (and (member q sink-states) (not draw-sink))] (if or__5501__auto__ or__5501__auto__ (clojure.core/or (clojure-rte.cl-compat/cl-cond (:else (when (:accepting q) (cl-format *out* "   q~D [shape=doublecircle] ;~%" (:index q)) (cl-format *out* "   X~D [label=\"~A\", shape=rarrow]~%" (:index q) ((:exit-map dfa) (:index q))) (cl-format *out* "   q~D -> X~D ;~%" (:index q) (:index q))) (when (:initial q) (cl-format *out* "   H~D [label=\"\", style=invis, width=0]~%" (:index q)) (cl-format *out* "   H~D -> q~D;~%" (:index q) (:index q))) (doseq [[next-state transitions] (group-by second (:transitions q)) :let [type-desigs (map first transitions) labels (if abbrev (for [td type-desigs] (cl-format false "t~a" (abbrevs td))) type-desigs) label (str/join "," labels)]] (cl/cl-cond ((and (member (xym/state-by-index dfa next-state) sink-states) (not draw-sink))) (:else (cl-format *out* "   q~D -> q~D [label=\"~a\"];~%" (:index q) next-state label)))))))))

Jim Newton18:07:21

of course I can prepare a test case, but just wondering whether there's something obvious going wrong???

dpsutton18:07:59

nothing that i see. one debugging tool that helps is to turn on m-x nrepl-toggle-message-logging and try your action again. and then check the buffer that is created with all nrepl traffic in it

Jim Newton19:07:04

thanks. the message was very helpful.

Jim Newton19:07:55

(<--
  id            "80"
  session       "170ac8a8-6e7f-4f1c-8e25-072c26cc6753"
  time-stamp    "2021-07-26 21:53:05.597508000"
  err           "java.lang.Exception: No namespace: clojure-rte.dot found
 at..."
  ex            "class java.lang.Exception"
  pp-stacktrace ((dict "class" "java.lang.Exception" "message" "No namespace: clojure-rte.dot found" "stacktrace"
       ((dict "class" "clojure.core$the_ns" "file" "core.clj" "file-url" "jar:file:/Users/jnewton/.m2/repository/org/clojure/clojure/1.10.0/clojure-1.10.0.jar!/clojure/core.clj" "flags"
              ("clj")
              "fn" "the-ns" "line" 4162 "method" "invokeStatic" "name" "clojure.core$the_ns/invokeStatic" "ns" "clojure.core" "type" "clj" "var" "clojure.core/the-ns")
I was trying to macro expand in a buffer, but I'd never loaded the actual file into VM

dpsutton19:07:32

is that repeatable? IE, you never get an error message back?

dpsutton19:07:51

if so that's a good CIDER bug. Perhaps the error handling isn't hooked up to the macroexpand stuff?

Jim Newton19:07:55

once I loaded the code, the macro expansion works correctly.

dpsutton19:07:16

right. i'm interested in why you didn't get this error message immediately and could easily diagnose your problem. that is a CIDER bug

Jim Newton19:07:22

yes I'd expect a better error message reporting, indeed

dpsutton19:07:37

and you experienced nothing? it just would eventually say it timed out?

Jim Newton19:07:43

I guess the macro expansion created code with namespace notation such as clojure-rte.dot/some-function-name and then tried to read that back in in order to format or pretty-print the output. but reading failed because of missing namespace ?