The stock `Base.Docs.Binding(m, v)` constructor keeps the local symbol
`v` while normalising the module via `binding_module(m, v)`. For renamed
imports such as `using X: y as z`, this produces a binding to a
non-existent `canonical_owner.z`, so `?` doc lookup fails:
julia> using Base: isvisible as iv
help?> iv
No documentation found.
Binding `Base.iv` does not exist.
Resolve the alias by walking the binding partition chain: for each
explicit by-name import (`PARTITION_KIND_EXPLICIT` /
`PARTITION_KIND_IMPORTED`), follow the partition's restriction to its
underlying `Core.Binding` and read the canonical `(mod, name)` from its
globalref. Iterate until a non-explicit-import partition is reached,
then defer to `binding_module` for any remaining implicit-import
normalisation.
The iterative walk is needed because neither primitive alone suffices
for chained re-exports: `partition_restriction` only walks one hop
(stopping at the intermediate module for a plain re-export of an
`as`-renamed binding), while `binding_module` walks all hops but drops
the name (losing the canonical symbol when an `as`-rename appears
anywhere in the chain).
The first reland attempt rewrote unconditionally on any explicit by-name
import, which broke the docs build for plain chained re-exports such as
`Libdl.DL_LOAD_PATH` (whose docstring lives one hop upstream of the
local import). See
https://buildkite.com/julialang/julia-master/builds/57392#019e4dd3-f9a5-42dc-984d-374451e1a32b
for the original failure.
Re-lands #61869, originally landed as #55119.
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>