JuliaDocs / Documenter.jl

A documentation generator for Julia.
https://documenter.juliadocs.org
MIT License
814 stars 479 forks source link

TypeError: in Tuple, in parameter, expected Type, got Module #1011

Open tpapp opened 5 years ago

tpapp commented 5 years ago

I am trying to get to the bottom of docs build errors with JuliaLang/julia/pull/31720. The stacktrace is

[ Info: SetupBuildDirectory: setting up build directory.
[ Info: ExpandTemplates: expanding markdown templates.
ERROR: Error while loading expression starting at /buildworker/worker/package_linux64/build/doc/make.jl:170
caused by [exception 1]
TypeError: in Tuple, in parameter, expected Type, got Module
Stacktrace:
 [1] top-level scope at /buildworker/worker/package_linux64/build/doc/make.jl:170
make[3]: *** [html] Error 1
make[2]: *** [docs] Error 2

and I can't figure out the cause. I am not implying this is a bug in Documenter, but it may be.

mortenpi commented 5 years ago

I haven't seen DocTestSetup = :(using Future) being used before. Does using a quote block change anything?

tpapp commented 5 years ago

I copied that from other module docs, so I think it should be fine, also, when I remove both meta blocks I still get the same error so I don't think it is related.

Will try to remove things line by line and isolate this, then report back here.

fredrikekre commented 5 years ago

Maybe this is a bad interaction between the module Future and the type Distributed.Future?

tpapp commented 5 years ago

I think it could be, since I can trigger this with an empty stdlib/Future/docs/src/index.md.

fredrikekre commented 5 years ago

Probably something like this happens:

julia> using Distributed

julia> using Future

julia> Vector{Future}()
ERROR: TypeError: in Type, in parameter, expected Type, got Module
Stacktrace:
 [1] top-level scope at REPL[3]:1

At least that gives the same error message.

fredrikekre commented 5 years ago

since I can trigger this with an empty

If that file exists it means we try to using it here: https://github.com/JuliaLang/julia/blob/a6c7c1bdd6211380422bc9d0ab2d8eaf7a7c0def/doc/make.jl#L149

tpapp commented 5 years ago

Is there a way to work around this? Eg make Documenter use a clean environment for each package?

mortenpi commented 5 years ago

Ok, the exact issue is that after the usings, the Future name in Main refers to the module. That means that the ::Futures in the type signatures in at-docs block of the Distributed page become nonsensical.

The solution is to replace all the ::Futures with ::Distributed.Futures. Also, a bunch of at-ref links need to be changed from [`Future`](@ref) to [`Future`](@ref Distributed.Future) (all on the src/manual/parallel-computing.md page it seems).

It's not really a Documenter bug, other than that the error could be more helpful here (so I'd leave this open).