-
Notifications
You must be signed in to change notification settings - Fork 29
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
@contract between @doc and def inhibits ExDoc, ExUnit.DocTest #80
Comments
Hmm...I've been wondering if we should look at using the |
on_definition is definitely interesting. I believe it’s used to annotate but not _change_ each definition, but it still might be useful.
So the current approach is for each function to essentially define 2 functions, the inner one (the actual one) and the outer one that ensures the contract and calls super to invoke the inner one. I guess yet another approach is to not introduce separate function but rewrite the _body_ of the function to ensure the contract. That might compose better with other features of the language after all.
… On 24 May 2020, at 17:03, Chris Keathley ***@***.***> wrote:
Hmm...I've been wondering if we should look at using the @on_definition hook for contracts. I think that would solve both of these problems. We'd be able to check to see if we have a contract attribute (or attributes) set, and we'd still be able to include all of the relevant docs and whatnot. Its probably more work to do it that way but it might result in less surprises for the user. @wojtekmach <https://github.com/wojtekmach> would probably no more than me since he's spent more time with that code.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub <#80 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AAASSJ2BAEPIKRFLQAWWCRDRTEZMHANCNFSM4NFUD46Q>.
|
REVERT ME once elixir-toniq#80 is fixed.
There are two problems with using
An alternative might be to override |
a_contract_between_doc_and_def/0
below won't get tested or documented, without any warning to that effect:Strikes me the suppression might not be fixable without help from both, but you might well be in a position to see the
@doc
above@contract
and give warning. Failing that, let me know and I'll raise a PR to document the problem so people don't have to find it in the issues.The text was updated successfully, but these errors were encountered: