-
Notifications
You must be signed in to change notification settings - Fork 33
Fix test failures for Julia 1.8 #125
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
Fix test failures for Julia 1.8 #125
Conversation
215a45c to
fe0fbd9
Compare
|
This is ready for review / ready to be merged. |
fe0fbd9 to
9c41355
Compare
MichaelHatherly
left a comment
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.
Just one comment/question on this inline. Thanks for sorting it out!
9c41355 to
91b1db5
Compare
|
There's one printing that I currently don't like but don't know how to fix. Given this type: I thought this would do it but it just constructs the original type again: |
4f7b316 to
0fd456f
Compare
|
Previously, it was printing this: k_7(x::Union{Nothing, T<:Integer}, y::Integer) -> Union{Nothing, T} where T<:IntegerNow, it'll print this: k_7(x::Union{Nothing, T} where T<:Integer, y::Integer) -> Union{Nothing, T} where T<:IntegerThanks to @pfitzseb for answering questions about this. |
|
The only thing that remains now is the # test.jl
using DocStringExtensions
const DSE = DocStringExtensions
using Test
import Base.Docs: meta, @var, DocStr, parsedoc
module M end
function find_function_name_symbol(e::Expr)
if e.head != :call
return find_function_name_symbol(e.args[1])
else
return e.args[1]
end
end
function get_doc_ext_signature(sym, typesig)
doc = Docs.DocStr(Core.svec(), nothing, Dict())
buf = IOBuffer()
doc.data = Dict(
:binding => Docs.Binding(M, sym),
:typesig => eval(typesig),
:module => M,
)
# @show doc.data
DSE.format(DSE.TYPEDSIGNATURES, buf, doc)
str = String(take!(buf))
str = replace(str, "```julia" => "")
str = replace(str, "```" => "")
str = strip(str)
return split(str, "\n")
end
function test()
exprs = [
:(
k_7(x::T) where T = x
)
]
for expr in exprs
println("# $(expr.args[1])")
println()
docs_sig = Base.Docs.signature(expr)
Base.eval(M, expr)
f = find_function_name_symbol(expr)
docs_ext_sig = get_doc_ext_signature(f, docs_sig)
@show first(docs_ext_sig)
println()
end
end
test()If I add I get this output, which is what the test is using. So I'm very puzzled as to what is going on here. |
|
I'll try and investigate that one when I next get a chance, not sure what's happening with it either. |
|
The three |
2ff2b30 to
a50daf4
Compare
|
I'm not sure exactly why this happens, but when I comment the other tests out or if I move the test to the beginning of the testset, the broken tests pass. I put some prints in the code to see where the difference was and it happens at this line: DocStringExtensions.jl/src/abbreviations.jl Line 375 in 8cac180
When the test is at the end of the testset, this function returns an empty Vector. When it is at the beginning, it returns the expected Vector of method groups. In fact, anywhere before the test for |
|
Thanks for tracking that down further. Very weird behavior, if things are all working now and you're happy with the implementation then we can merge as is. |
|
Yup! I am happy with it! |
|
Thanks again for sorting that one out! |
|
Thanks for pinging me! Feel free to do so again if something else comes up with this. |
Fixes #124