clojerl / clojerl

Clojure for the Erlang VM (unofficial)

Home Page:http://try.clojerl.online/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Macro is resolved even when local binding exists

jfacorro opened this issue · comments

Describe the bug
When there is a local binding (e.g. function argument) that has the same name as an existing macro, the macro is used when compiling instead of the local.

To Reproduce
Evaluate the following expressions:

(defmacro m [_] (throw :error))
(defn f [m] (m 1))

Expected behavior
There is nothing printed when the function f is compiled (i.e. the macro x is not called).

clje.user=> (defmacro m [_] (throw :error))
#'clje.user/x
clje.user=> (defn f [m] (m 1))
#'clje.user/f
clje.user=>

Actual behavior
The symbol x in the function f is resolved as a macro during compilation instead as a binding.

clje.user=> (defmacro m [_] (throw :error))
#'clje.user/x
clje.user=> (defn f [m] (m 1))
#error {
 :type clojerl.Error
 :message clje.user=> NO_SOURCE_FILE:1:13: :error}

Context

  • clojerl version (tag/sha): 0.7.1-60-ge29f330