Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Macroexpansion with lazy seqs occurs in the wrong ns #886

Closed
yuhan0 opened this issue Jul 13, 2024 · 2 comments
Closed

Macroexpansion with lazy seqs occurs in the wrong ns #886

yuhan0 opened this issue Jul 13, 2024 · 2 comments

Comments

@yuhan0
Copy link
Contributor

yuhan0 commented Jul 13, 2024

Expected behavior

Cider-nrepl's macroexpansion op should produce the same output as manually calling macroexpand.

Actual behavior

If the macro definition contains lazily evaluated seqs, their contents will be evaluated with the wrong dynamic ns bindings (in the user ns), which can result in incorrect / misleading expansions.

Steps to reproduce the problem

(ns repro)

(defmacro lazy []
  (cons (ns-name *ns*)
        (lazy-seq [(ns-name *ns*)])))

(macroexpand '(lazy))
;; => (repro repro)

(lazy) ;; <- M-x cider-macroexpand: (repro user)

Environment & Version information

cider-nrepl version

0.49.1

Java version

21.0.1

Operating system

MacOS 14

@yuhan0
Copy link
Contributor Author

yuhan0 commented Jul 13, 2024

Note: working on the fix, will submit a PR soon

@alexander-yakushev
Copy link
Member

Fixed in #894.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants