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

time macro fails to expand with macroexpand-all when nested #1143

Closed
ikappaki opened this issue Nov 25, 2024 · 1 comment
Closed

time macro fails to expand with macroexpand-all when nested #1143

ikappaki opened this issue Nov 25, 2024 · 1 comment

Comments

@ikappaki
Copy link
Contributor

Hi,

the basilisp.core/time macro uses a straight start let binding referenced in a try-catch block and as such is susceptible to errors when expanded by macroexpand-all (see #1142)

To reproduce

  • In the REPL create use time in a new macro definition and try to expand it with macroexpand-all, an error is thrown complaining about the start binding:
basilisp.user=> (require '[basilisp.walk :refer [macroexpand-all]])
nil
basilisp.user=> (defmacro abc [] `(time 5))
#'basilisp.user/abc
basilisp.user=> (macroexpand-all '(abc))

  exception: <class 'basilisp.lang.compiler.exception.CompilerException'>
      phase: :analyzing
    message: unable to resolve symbol 'basilisp.core/start' in this context
       form: basilisp.core/start
   location: <Macroexpand>:NO_SOURCE_LINE

I believe the intention here was to use an auto-gensym all along.

Patch to follow.

Thanks

chrisrink10 pushed a commit that referenced this issue Nov 25, 2024
Hi,

could you please consider patch to use an auto-gensym for the let
binding in the `time` macro. It addresses #1143.

I assumed here that a straight let binding was used inadvertently rather
than an auto-gensym.

No tests were included due to the simplicity of the fix.

Thanks

Co-authored-by: ikappaki <ikappaki@users.noreply.github.com>
@chrisrink10
Copy link
Member

Fixed in #1144

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

No branches or pull requests

2 participants