Skip to content

Warnings if a module implicitly imports a deprecated binding #2758

@devmotion

Description

@devmotion

A MWE: Start julia --depwarn=error and execute

julia> using Documenter

julia> module E
           module B
               struct C end
               export C
               Base.@deprecate_binding D C
           end
           using .B
           export C, D
       end
Main.E

julia> Documenter.submodules(E)
WARNING: using deprecated binding B.D in E.
, use C instead.
Set{Module} with 2 elements:
  Main.E.B
  Main.E

The problem is that isdefined (and isdeprecated) in

if Base.isidentifier(name) && isdefined(root, name) && !isdeprecated(root, name)
implicitly resolve the binding which triggers the deprecation warning. Changing the line to

        if Base.isidentifier(name) && Base.isbindingresolved(root, name) && isdefined(root, name) && !isdeprecated(root, name)

seems to fix the issue.


That being said, this problem is only present in Julia < 1.12 (the MWE works successfully in e.g. 1.12.0-rc1). In February, Keno removed the need for Base.isbindingresolved (it's deprecated in 1.12 and just unconditionally returns true) in JuliaLang/julia#57253, and in the same PR also remove these patterns isbindingresolved(...) && isdefined(...) and isbindingresolved(...) && !isdeprecated(...) in base julia. Since the current LTS is 1.10 one might argue that it's still worth fixing this issue in Documenter on Julia 1.10 and 1.11.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions