Open
Description
I don't really see a pattern of when the REPL provides useful hints on this sort of field access and when it throws what appears to be an internal error:
julia> module M
struct T
"a field with a docstring"
my_field
end
const C = T
f() = T
end
WARNING: replacing module M.
Main.M
help?> M.T.field
Main.M.T has fields my_field.
help?> M.C.field
Main.M.T has fields my_field.
help?> M.f().field
ERROR: MethodError: no method matching Base.Docs.Binding(::Type{Main.M.T}, ::Symbol)
Closest candidates are:
Base.Docs.Binding(::Module, ::Symbol)
@ Base docs/bindings.jl:9
Stacktrace:
[1] top-level scope
@ none:1
help?> M.T(1).field
ERROR: MethodError: no method matching Base.Docs.Binding(::Main.M.T, ::Symbol)
Closest candidates are:
Base.Docs.Binding(::Module, ::Symbol)
@ Base docs/bindings.jl:9
Stacktrace:
[1] top-level scope
@ none:1
help?> M.T(1).my_field
ERROR: MethodError: no method matching Base.Docs.Binding(::Main.M.T, ::Symbol)
Closest candidates are:
Base.Docs.Binding(::Module, ::Symbol)
@ Base docs/bindings.jl:9
Stacktrace:
[1] top-level scope
@ none:1
julia> x = M.T(1)
Main.M.T(1)
help?> x.field
ERROR: MethodError: no method matching Base.Docs.Binding(::Main.M.T, ::Symbol)
Closest candidates are:
Base.Docs.Binding(::Module, ::Symbol)
@ Base docs/bindings.jl:9
Stacktrace:
[1] top-level scope
@ ~/.julia/juliaup/julia-1.10.0-beta2+0.aarch64.apple.darwin14/share/julia/stdlib/v1.10/REPL/src/docview.jl:558
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment