Closed
Description
Hi,
there appears to be an issue when load`'ing certain macros from the REPL after the #986 update:
unable to resolve symbol 'basilisp.user/<symbol>' in this context
To reproduce,
- in latest Basilisp main branch, create a
src/issue.lpy
file with two macros, where one loads the other, and then call that macro:
(ns issue)
(defmacro xyz []
`(println :xyz))
(defmacro abc []
`(xyz))
(abc)
- Open up the REPL and
load
that file, an error is thrown
> poetry run basilisp repl
basilisp.user=> (load "/issue")
exception: <class 'basilisp.lang.compiler.exception.CompilerException'> from <class 'basilisp.lang.compiler.exception.CompilerException'>
phase: :macroexpansion
message: error occurred during macroexpansion: unable to resolve symbol 'basilisp.user/xyz' in this context
form: (abc)
location: C:\src\basilisp\src\issue.lpy:9
context:
5 |
6 | (defmacro abc []
7 | `(xyz))
8 |
9 > | (abc)
This issue was introduced by #986 update, specifically the addition of the read-all
fn, and the changes to the the load-reader
fn below (if I revert that change it magically works)
It is not obvious to me why this is happening. @mitch-kyle, could you take a look?
If I revert to the commit before that change, everything works fine
$ git checkout 3677319a5524966d13dcffa83b729b0370a5f8a6
Note: switching to '3677319a5524966d13dcffa83b729b0370a5f8a6'.
...
HEAD is now at 3677319 Add `basilisp.pprint` docs page (#985)
> poetry run basilisp repl
basilisp.user=> (load "/issue")
:xyz
nil
Thanks