Skip to content

cider-macroexpand errors when a macro expansion has an invalid for binding #3554

@rileylev

Description

@rileylev
(defmacro ohno []
  `(do ~(for [name 'a] nil)))
(ohno)

Calling cider-macroexpand-1 on `(ohno)' results in a middleware error.

Here's my emacs version:

GNU Emacs 29.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.38, cairo version 1.17.8)

and my cider version (apologies it's not quite the latest) :

;; CIDER 1.7.0-snapshot (package: 1.7.0-snapshot), nREPL 1.0.0
;; Clojure 1.11.1, Java 21
;; ;;  Startup: /usr/bin/lein update-in :dependencies conj \[nrepl/nrepl\ \"1.0.0\"\] -- update-in :dependencies conj \[refactor-nrepl/refactor-nrepl\ \"3.6.0\"\] -- update-in :plugins conj \[refactor-nrepl/refactor-nrepl\ \"3.6.0\"\] -- update-in :plugins conj \[cider/cider-nrepl\ \"0.30.0\"\] -- repl :headless :host localhost

Here's my backtrace

  Show: Project-Only All 
  Hide: Clojure Java REPL Tooling Duplicates  (41 frames hidden)

  This is an unexpected CIDER middleware error.
  Please submit a bug report via `M-x cider-report-bug`.

  If these stacktraces are occurring frequently, consider using the
  button(s) below to suppress these types of errors for the duration of
  your current CIDER session. The stacktrace buffer will still be
  generated, but it will "pop under" your current buffer instead of
  "popping over". The button toggles this behavior.

 Suppress macroexpand-error 

1. Unhandled java.lang.IllegalArgumentException
   Don't know how to create ISeq from: clojure.lang.Symbol

                   RT.java:  557  clojure.lang.RT/seqFrom
                   RT.java:  537  clojure.lang.RT/seq
                  core.clj:  139  clojure.core/seq
                  core.clj:  139  clojure.core/seq
                      REPL:    5  fux.bug/ohno/iter/fn
              LazySeq.java:   42  clojure.lang.LazySeq/sval
              LazySeq.java:   51  clojure.lang.LazySeq/seq
                   RT.java:  535  clojure.lang.RT/seq
                  core.clj:  139  clojure.core/seq
                  core.clj: 2763  clojure.core/map/fn
              LazySeq.java:   42  clojure.lang.LazySeq/sval
              LazySeq.java:   51  clojure.lang.LazySeq/seq
                   RT.java:  535  clojure.lang.RT/seq
                  core.clj:  139  clojure.core/seq
                  core.clj: 3134  clojure.core/dorun
                  core.clj: 3149  clojure.core/doall
                  walk.clj:   47  clojure.walk/walk
                  walk.clj:   65  clojure.walk/prewalk
                  walk.clj:   61  clojure.walk/prewalk
                  core.clj: 2641  clojure.core/partial/fn
                  core.clj: 2772  clojure.core/map/fn
              LazySeq.java:   42  clojure.lang.LazySeq/sval
              LazySeq.java:   51  clojure.lang.LazySeq/seq
                 Cons.java:   39  clojure.lang.Cons/next
                   RT.java:  713  clojure.lang.RT/next
                  core.clj:   64  clojure.core/next
                  core.clj: 3143  clojure.core/dorun
                  core.clj: 3149  clojure.core/doall
                  walk.clj:   47  clojure.walk/walk
                  walk.clj:   65  clojure.walk/prewalk
                  walk.clj:   61  clojure.walk/prewalk
           macroexpand.clj:  125  cider.nrepl.middleware.macroexpand/expand-clj/fn
                  AFn.java:  152  clojure.lang.AFn/applyToHelper
                  AFn.java:  144  clojure.lang.AFn/applyTo
                  core.clj:  667  clojure.core/apply
                  core.clj: 1990  clojure.core/with-bindings*
                  core.clj: 1990  clojure.core/with-bindings*
               RestFn.java:  425  clojure.lang.RestFn/invoke
           macroexpand.clj:  117  cider.nrepl.middleware.macroexpand/expand-clj
           macroexpand.clj:  111  cider.nrepl.middleware.macroexpand/expand-clj
           macroexpand.clj:  222  cider.nrepl.middleware.macroexpand/macroexpansion
           macroexpand.clj:  218  cider.nrepl.middleware.macroexpand/macroexpansion
           macroexpand.clj:  228  cider.nrepl.middleware.macroexpand/macroexpansion-reply
           macroexpand.clj:  227  cider.nrepl.middleware.macroexpand/macroexpansion-reply
        error_handling.clj:  160  cider.nrepl.middleware.util.error-handling/eval7372/fn
              MultiFn.java:  234  clojure.lang.MultiFn/invoke
           macroexpand.clj:  231  cider.nrepl.middleware.macroexpand/handle-macroexpand
           macroexpand.clj:  230  cider.nrepl.middleware.macroexpand/handle-macroexpand
                  Var.java:  388  clojure.lang.Var/invoke
                 nrepl.clj:  287  cider.nrepl/wrap-macroexpand/fn
            middleware.clj:   16  nrepl.middleware/wrap-conj-descriptor/fn
                 nrepl.clj:  480  cider.nrepl/wrap-test/fn
            middleware.clj:   16  nrepl.middleware/wrap-conj-descriptor/fn
                 nrepl.clj:  121  cider.nrepl/wrap-slurp/fn
            middleware.clj:   16  nrepl.middleware/wrap-conj-descriptor/fn
                 nrepl.clj:  531  cider.nrepl/wrap-undef/fn
            middleware.clj:   16  nrepl.middleware/wrap-conj-descriptor/fn
                 nrepl.clj:  520  cider.nrepl/wrap-tracker/fn
            middleware.clj:   16  nrepl.middleware/wrap-conj-descriptor/fn
                 print.clj:  234  nrepl.middleware.print/wrap-print/fn
            middleware.clj:   16  nrepl.middleware/wrap-conj-descriptor/fn
                 nrepl.clj:  542  cider.nrepl/wrap-version/fn
            middleware.clj:   16  nrepl.middleware/wrap-conj-descriptor/fn
                 nrepl.clj:  143  cider.nrepl/wrap-complete/fn
            middleware.clj:   16  nrepl.middleware/wrap-conj-descriptor/fn
            middleware.clj:  232  refactor-nrepl.middleware/wrap-refactor/fn
            middleware.clj:   16  nrepl.middleware/wrap-conj-descriptor/fn
                 nrepl.clj:  552  cider.nrepl/wrap-xref/fn
            middleware.clj:   16  nrepl.middleware/wrap-conj-descriptor/fn
                 nrepl.clj:  137  cider.nrepl/wrap-classpath/fn
            middleware.clj:   16  nrepl.middleware/wrap-conj-descriptor/fn
                 nrepl.clj:  406  cider.nrepl/wrap-resource/fn
            middleware.clj:   16  nrepl.middleware/wrap-conj-descriptor/fn
               session.clj:  325  nrepl.middleware.session/session/fn
            middleware.clj:   16  nrepl.middleware/wrap-conj-descriptor/fn
                server.clj:  141  nrepl.server/default-handler/fn
                server.clj:   24  nrepl.server/handle*
                server.clj:   21  nrepl.server/handle*
                server.clj:   41  nrepl.server/handle/fn
                  core.clj: 2047  clojure.core/binding-conveyor-fn/fn
                  AFn.java:   18  clojure.lang.AFn/call
           FutureTask.java:  317  java.util.concurrent.FutureTask/run
   ThreadPoolExecutor.java: 1144  java.util.concurrent.ThreadPoolExecutor/runWorker
   ThreadPoolExecutor.java:  642  java.util.concurrent.ThreadPoolExecutor$Worker/run
               Thread.java: 1583  java.lang.Thread/run

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions