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

fishy gen* call in your Spec protocol #136

Closed
darwin opened this issue Oct 10, 2018 · 1 comment
Closed

fishy gen* call in your Spec protocol #136

darwin opened this issue Oct 10, 2018 · 1 comment

Comments

@darwin
Copy link

darwin commented Oct 10, 2018

I think I hit something which is expected to work and is broken.

Please consider this gist:
https://gist.github.com/darwin/e7748419304915f75633666b906f23f8

You can repro it on your machine with:

clojure -Srepro -Sdeps '{:deps {issue {:git/url "https://gist.github.com/darwin/e7748419304915f75633666b906f23f8" :sha "af929e906525703509a4f86ba371d74f8338dc71"}}}' -m main

The problem is that generating metosin-spec throws and it should work out-of-the-box in my opinion. I was able to track it down to this line, which seems to be problematic. It looks to me that you are trying to implement gen* by doing the work yourself and if that's not possible falling back to standard implementation. The problem is that you are passing your naked spec data structure which was provided by user. It looks like standard gen* implementation expects massaged spec by first applying specize on it. The difference is subtle but it breaks because of it in my case.

Please look at gensub helper which is doing that before calling gen* protocol:
https://github.com/clojure/spec.alpha/blob/11d21c5f055f49b6a84554837b80c91be831c058/src/main/clojure/clojure/spec/alpha.clj#L275

I'm not saying this is the exact issue. I'm new to spec and don't have deep understanding here. Maybe @puredanger could shed some light.

@ikitommi
Copy link
Member

Thanks for reporting. I think it's fixed now, see #138.

ikitommi added a commit that referenced this issue Oct 15, 2018
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