-
Notifications
You must be signed in to change notification settings - Fork 479
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
Refactor getdocs
code
#1842
Refactor getdocs
code
#1842
Conversation
So, just to make sure I understand, the problem we currently have is that if I ask for the docs of
rather than the same as in
? If that's the intent, then I agree, we indeed shouldn't relax the constraint. However, it looks like it doesn't return the correct thing right now?
Either way, would you mind adding some tests to |
Yes, the problem is that due to the previous implementation, asking for the docs of Now I have extracted the main part of
Strange, for me it correctly gives julia> Documenter.DocSystem.getdocs(Docs.Binding(Main, :B))
1-element Vector{Base.Docs.DocStr}:
Base.Docs.DocStr(svec("A"), nothing, Dict{Symbol, Any}(:typesig => Union{}, :module => Main, :linenumber => 1, :binding => A, :path => "REPL[1]", :fields => Dict{Symbol, Any}()))
julia> Documenter.DocSystem.getdocs(Docs.Binding(Main, :B), Union{})
1-element Vector{Base.Docs.DocStr}:
Base.Docs.DocStr(svec("A"), nothing, Dict{Symbol, Any}(:typesig => Union{}, :module => Main, :linenumber => 1, :binding => A, :path => "REPL[1]", :fields => Dict{Symbol, Any}()))
julia> Documenter.DocSystem.getdocs(Docs.Binding(Main, :B), Tuple{Any})
1-element Vector{Base.Docs.DocStr}:
Base.Docs.DocStr(svec("A(x)"), nothing, Dict{Symbol, Any}(:typesig => Tuple{Any}, :module => Main, :linenumber => 1, :binding => A, :path => "REPL[2]"))
Right, I should have done this. Now there is one. |
* stick to Documenter's binding, for consistency (at-var is not documented) * Be explicit about the type signature * Add, rather than replace tests * Add separate test with the example from PR (also, covers the case of types)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I am not sure why I got the output that I did yesterday.. I tested the old commit again, and it was fine now. My Julia session must have been in some weird state.
I took the liberty of rearranging the tests a bit and also adding the CHANGELOG. As far as I can tell, this only change behaviour when aliases are involved, and in that case we're currently doing the wrong thing. So I think we can have this as a bugfix in a patch release.
If the updates look good to you as well, then I think this is now good to go.
I'll go ahead and merge this. Thanks @mgkurtz! |
Thanks a lot for your additions and for merging 😊 |
The current implementation of
DocSystem.getdocs
means, that in the case ofif I ask for the docs of
B
as inI get both "A" and "A(x)". Also see the second paragraph here. This PR makes the fallback search order for docs more explicit and would in this example give "A" only.