Documenter.jl icon indicating copy to clipboard operation
Documenter.jl copied to clipboard

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

Open tpapp opened this issue 6 years ago • 9 comments

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.

tpapp avatar May 07 '19 07:05 tpapp

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

mortenpi avatar May 07 '19 07:05 mortenpi

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.

tpapp avatar May 07 '19 08:05 tpapp

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

fredrikekre avatar May 07 '19 09:05 fredrikekre

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

tpapp avatar May 07 '19 09:05 tpapp

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 avatar May 07 '19 09:05 fredrikekre

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

fredrikekre avatar May 07 '19 09:05 fredrikekre

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

tpapp avatar May 07 '19 09:05 tpapp

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).

mortenpi avatar May 07 '19 10:05 mortenpi

It is possible that PR #2827 also fixes this issue -- but it's not clear to me what the issue was precisely. Of course @fredrikekre provides a code snippet that raises the error. But it is unclear to me where this code was placed when it caused the issue reported here: in @repl or @eval or @example block? In a jldoctest? Or was it a broken @ref after all, i.e. use of [`Future`](@ref) ? Something else?

fingolfin avatar Nov 07 '25 23:11 fingolfin