Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docstrings for inner constructors are ignored #16730

Closed
stevengj opened this issue Jun 3, 2016 · 6 comments
Closed

docstrings for inner constructors are ignored #16730

stevengj opened this issue Jun 3, 2016 · 6 comments
Labels
docsystem The documentation building system duplicate Indicates similar issues or pull requests

Comments

@stevengj
Copy link
Member

stevengj commented Jun 3, 2016

julia> type Foo
       """some docs"""
       Foo() = new()
       end

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

  No documentation found.

  Summary:

  type Foo <: Any

cc @MichaelHatherly

@MichaelHatherly
Copy link
Member

Dup of #14962 since the docstring isn't toplevel and so needs to use @doc directly:

julia> type Foo
           @doc """some docs""" ->
           Foo() = new()
       end

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

  some docs

Perhaps we should consider extending where @doc is added automatically since this does come up quite often.

@iagobaapellaniz
Copy link
Contributor

Would be nice to have it automatically on the inner constructors. They are indeed methods on the global scope.

@tkoolen
Copy link
Contributor

tkoolen commented Oct 30, 2018

It seems the -> is still necessary in order to attach the docstring to an inner constructor. However, that syntax is now deprecated:

┌ Warning: Deprecated syntax `@doc call with ->`.
│ Use `a line break` instead.
└ @ none:24

Could this issue be fixed before removing the deprecated method?

@tpapp
Copy link
Contributor

tpapp commented Nov 9, 2018

At the moment, in v1.0

struct Foo
    @doc "best inner constructor ever"
    Foo() = new()
end

works fine.

bors bot pushed a commit to TuringLang/DynamicPPL.jl that referenced this issue Jul 15, 2021
Currently the help for `Model` doesn't show the documentation for the inner constructor `Model{Missing}`, due to JuliaLang/julia#16730 .

This PR fixes it using the `@doc` workaround mentioned in that issue.

With this PR, the `Model{Missing}` doc shows up at the top, before the `struct Model` doc. I hope it's not a problem.

Co-authored-by: Hong Ge <hg344@cam.ac.uk>
bors bot pushed a commit to TuringLang/DynamicPPL.jl that referenced this issue Jul 15, 2021
Currently the help for `Model` doesn't show the documentation for the inner constructor `Model{Missing}`, due to JuliaLang/julia#16730 .

This PR fixes it using the `@doc` workaround mentioned in that issue.

With this PR, the `Model{Missing}` doc shows up at the top, before the `struct Model` doc. I hope it's not a problem.

Co-authored-by: Hong Ge <hg344@cam.ac.uk>
@cossio
Copy link
Contributor

cossio commented Jan 31, 2022

This is still an issue in Julia v1.7

@LilithHafner LilithHafner added duplicate Indicates similar issues or pull requests and removed duplicate Indicates similar issues or pull requests labels May 14, 2023
@LilithHafner
Copy link
Member

I believe this is still an issue as of 1.9 and should be fixed. Closing as duplicate of #14962.

@LilithHafner LilithHafner closed this as not planned Won't fix, can't repro, duplicate, stale May 14, 2023
@LilithHafner LilithHafner added the duplicate Indicates similar issues or pull requests label May 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docsystem The documentation building system duplicate Indicates similar issues or pull requests
Projects
None yet
Development

No branches or pull requests

7 participants