Skip to content
This repository has been archived by the owner on Oct 2, 2020. It is now read-only.

Play nice with core.typed / :refer type aliases #70

Closed
seancorfield opened this issue Mar 21, 2014 · 3 comments
Closed

Play nice with core.typed / :refer type aliases #70

seancorfield opened this issue Mar 21, 2014 · 3 comments

Comments

@seancorfield
Copy link
Contributor

We refer certain type aliases in from core.typed:

[clojure.core.typed :refer [ann def-alias for> loop> Map Option Vec]]

Then we have create a type alias:

(def-alias SBWResult (HMap :mandatory {:result String
                                       :errors (Vec String)}))

Slamhound barfs on the use of Vec:

Failed to reconstruct: #<File src/worldsingles/payment/sbw.clj>
Internal Error (slamhound.sandbox__1222__auto__:<NO LINE>) Cannot resolve type: Vec
Hint: Is Vec in scope?
Hint: Has Vec's annotation been found via check-ns, cf or typed-deps?

Note, as with the previous core.typed / Slamhound issue, it tries to run core.typed after failing to reconstruct the namespace (the Internal Error is from core.typed). Slamhound doesn't explain why it can't reconstruct the namespace.

@guns
Copy link
Collaborator

guns commented Mar 21, 2014

Both of these issues appear to stem from the fact that in an effort to provide user friendly messages, core.typed macros catch the Exceptions that Slamhound uses to identify unknown references.

ATM I think we will probably need to add explicit support for core.typed (since it is a contrib library). In the long term I hope to move Slamhound to use the new static analyzers; if this is possible this kind of workaround won't be necessary.

Thanks a ton!

guns added a commit that referenced this issue Mar 22, 2014
The core.typed `ann` macro generates its own failure messages.

Addresses #69 and #70
@guns
Copy link
Collaborator

guns commented Mar 22, 2014

I think this addresses both core.typed issues. Thanks again for the feedback!

@seancorfield
Copy link
Contributor Author

This seems to have solved my problems - thank you for such a swift fix!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants