julia icon indicating copy to clipboard operation
julia copied to clipboard

Documenting Fields of Parametric Type

Open JaredCrean2 opened this issue 7 years ago • 8 comments

From Discourse

Trying to get the documentation for Bar.x works, but not Foo.x or Foo{Float64}.x:

# file tmp4.jl
"""
  This is struct Foo
"""
struct Foo{T}
  """
    This is field x
  """
  x
end


"""
  This is struct Bar
"""
struct Bar
  """
    This is field x
  """
  x
end

In the repl:

julia> include("tmp4.jl")
Bar

help?> Foo
search: floor pointer_from_objref OverflowError RoundFromZero FileMonitor functionloc StackOverflowError

  This is struct Foo

help?> Foo{Float64}.x
ERROR: MethodError: no method matching Base.Docs.Binding(::Type{Foo{Float64}}, ::Symbol)
Closest candidates are:
  Base.Docs.Binding(::Module, ::Symbol) at docs/bindings.jl:12

help?> Foo.x
ERROR: MethodError: no method matching Base.Docs.Binding(::Type{Foo}, ::Symbol)
Closest candidates are:
  Base.Docs.Binding(::Module, ::Symbol) at docs/bindings.jl:12

help?> Bar
search: baremodule SubArray GlobalRef BitArray clipboard backtrace BitMatrix takebuf_array catch_backtrace

  This is struct Bar

help?> Bar.x
  This is field x

JaredCrean2 avatar Oct 02 '18 13:10 JaredCrean2

I'm having the same issue.

Oblynx avatar Mar 07 '20 15:03 Oblynx

Also running up against this issue

SBuercklin avatar Jun 12 '20 17:06 SBuercklin

Me too!

lwhitefox avatar Oct 27 '20 16:10 lwhitefox

Same here!

navidcy avatar Jan 26 '21 23:01 navidcy

More generally, we encounter that simple multi-dot expressions may run into this error:

help?> DataType.name.names
ERROR: MethodError: no method matching Base.Docs.Binding(::Core.TypeName, ::Symbol)
Closest candidates are:
  Base.Docs.Binding(::Module, ::Symbol) at docs/bindings.jl:9
Stacktrace:
 [1] top-level scope
   @ /data/vtjnash/julia/usr/share/julia/stdlib/v1.7/REPL/src/docview.jl:505

vtjnash avatar Mar 15 '21 19:03 vtjnash

Same. Any update on this?

ClaudMor avatar Oct 17 '21 13:10 ClaudMor

This was fixed by #59725

ffreyer avatar Dec 04 '25 15:12 ffreyer

This was fixed by #59725

Doesn't look like it, unfortunately. The difference here relative to the other issue is that we're specifying the type parameter. cc @KristofferC

julia> versioninfo()
Julia Version 1.14.0-DEV.1341
Commit f5133098fa9 (2025-12-05 00:12 UTC)
Build Info:
  Official https://julialang.org release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 16 × 12th Gen Intel(R) Core(TM) i7-1260P
  WORD_SIZE: 64
  LLVM: libLLVM-20.1.8 (ORCJIT, alderlake)
  GC: Built with stock GC
Threads: 1 default, 1 interactive, 1 GC (on 16 virtual cores)

help?> Foo{Float64}.x
ERROR: MethodError: no method matching Base.Docs.Binding(::Type{Foo{Float64}}, ::Symbol)
The type `Base.Docs.Binding` exists, but no method is defined for this combination of argument types when trying to construct it.

Closest candidates are:
  Base.Docs.Binding(::Module, ::Symbol)
   @ Base docs/bindings.jl:7

Stacktrace:
 [1] (::REPL.Logged{DataType})(::Type, ::Symbol)
   @ REPL ~/.julia/juliaup/julia-nightly/share/julia/stdlib/v1.14/REPL/src/docview.jl:180
 [2] top-level scope
   @ ~/.julia/juliaup/julia-nightly/share/julia/stdlib/v1.14/REPL/src/docview.jl:26

mortenpi avatar Dec 05 '25 07:12 mortenpi