-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
Base.@doc
in macro doesn't work on master
#52986
Comments
This is a REPL-only feature. Packages should normally be using
|
This doesn't make sense to me... Why would the docsystem work differently if the REPL is loaded? Seems something should be moved back to Base. |
See also #52141. |
This also hit the Clang.jl tests. Here's a MWE: doc_expr = (@macroexpand @doc throw)
docstring = string(@doc throw)
@show Base.hasdoc(Main, :throw)
@show doc_expr
@show docstring And the output on v1.11 alpha $ julia +1.11 --startup-file=no mwe.jl
Base.hasdoc(Main, :throw) = true
doc_expr = nothing
docstring = "nothing" Vs 1.10.2 (without $ julia --startup-file=no mwe.jl
doc_expr = :((Base.Docs.doc)((Base.Docs.Binding)(Main, :throw)))
docstring = "```\nthrow(e)\n```\n\nThrow an object as an exception.\n\nSee also: [`rethrow`](@ref), [`error`](@ref).\n" It looks like the macro is returning a |
One issue with this is that |
I think we should have |
Base.@__doc__
in macro doesn't work on masterBase.@doc
in macro doesn't work on master
Noticed this a while back as well! See JuliaLang/Pkg.jl#3650. |
Could I ask what the intended return value of using Test
"my function"
function foo()
return 0
end
io = IOBuffer()
print(io, @doc foo)
docstr1 = String(take!(io))
using REPL
io = IOBuffer()
print(io, @doc foo)
docstr2 = String(take!(io))
println("docstr1 = ")
println(docstr1)
println("docstr2 = ")
println(docstr2)
@test docstr1 == docstr2 The resulting output is below:
As a result, docstring tests like the one in Gen.jl#3 are still failing, and will behave differently depending on whether the test suite is run in the REPL vs. during CI (when |
Having the return type change like this just because REPL is loaded or not doesn't seem great. Couldn't |
I agree and thus created #54664 to discuss further. |
As the title says this seems to be the case because in a PR on SumTypes.jl (https://github.com/MasonProtter/SumTypes.jl/pull/63/files) the doctest failing is only on nightly, while all the other works well, as you can see at https://github.com/MasonProtter/SumTypes.jl/actions/runs/7595253256/job/20687608559 the test fails with
while for all other Julia versions it returns
"This is a Foo.\n"
. Same is happening also on the CI of ProtoStructs.jl e.g. here https://github.com/BeastyBlacksmith/ProtoStructs.jl/actions/runs/7500520539/job/20419369109Unfortunately I wasn't able to find a MWE when I searched for it
The text was updated successfully, but these errors were encountered: