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

[Vanilla] Error when tracing/instrumenting core.match macro that references local bindings in :or pattern #56

Open
formsandlines opened this issue Nov 4, 2022 · 2 comments
Labels
bug Something isn't working minor Minor importance for bugs or enhancements

Comments

@formsandlines
Copy link

When I try to trace or instrument code that uses the core.match/match macro with a local let-binding inside of an :or pattern, like this:

(ns … (:require [clojure.core.match :refer [match]]))

#rtrace (let [foo "coffee"]
          (match ["coffee"]
            [(:or foo "bar")] :yes
            :else :no))

I get the following error: “No method in multimethod 'to-source' for dispatch value: null”.

It works just fine when I use the binding outside of :or, as in [foo].

I know this is a very specific issue. Any idea what could be causing it?

@jpmonettas
Copy link
Member

jpmonettas commented Nov 4, 2022

Thanks for reporting the issue @formsandlines.

The issue is related to that macro not working even with Clojure macroexpand :

(macroexpand-1 '(match ["coffee"] [(:or foo "bar")] :yes :else :no))

you get that exact same error Syntax error macroexpanding match at (*cider-repl my-projects/hansel:localhost:34779(clj)*:14:6). No method in multimethod 'to-source' for dispatch value: null

So I'll have to trace down that issue first, and maybe it can be hacked somehow 🤔

Or maybe we should report the issue to the core match project, but I'm not sure I would consider that a core.match issue.

@jpmonettas
Copy link
Member

This works fine in ClojureStorm which is the recommended way.

@jpmonettas jpmonettas added bug Something isn't working minor Minor importance for bugs or enhancements labels Jun 22, 2023
@jpmonettas jpmonettas changed the title Error when tracing/instrumenting core.match macro that references local bindings in :or pattern [Vanilla] Error when tracing/instrumenting core.match macro that references local bindings in :or pattern Jun 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working minor Minor importance for bugs or enhancements
Projects
None yet
Development

No branches or pull requests

2 participants