Skip to content

case test constants not considered in a macro if they are in a sequence #1148

@ikappaki

Description

@ikappaki

Hi,

there's an issue when trying to construct a case form inside a macro with the test constants being in a sequence, the test constants are not considered
ValueError: No case clause matches :5

To reproduce,
Open up the REPL and write a macro that uses a sequence as a matching test constant and call it, it throws the above error

basilisp.user=> (defmacro issue [] `(case :5 ~(seq [:5]) 6))
#'basilisp.user/issue

basilisp.user=> (issue)
Traceback (most recent call last):
  File "C:\src\basilisp\src\basilisp\cli.py", line 583, in repl
    result = eval_str(lsrc, ctx, ns, eof)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\src\basilisp\src\basilisp\cli.py", line 54, in eval_str
    last = compiler.compile_and_exec_form(form, ctx, ns)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\src\basilisp\src\basilisp\lang\compiler\__init__.py", line 189, in compile_and_exec_form
    exec(bytecode, ns.module.__dict__)  # pylint: disable=exec-used  # nosec 6102
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<REPL Input>", line 1, in <module>
ValueError: No case clause matches :5

The same works in Clojure

user=> (defmacro issue [] `(case :5 ~(seq [:5]) 6))
#'user/issue
user=> (issue)
6

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions