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

FIELDS / TYPEDFIELDS fail on const fields of mutable struct #155

Open
i9e1 opened this issue Aug 22, 2023 · 1 comment
Open

FIELDS / TYPEDFIELDS fail on const fields of mutable struct #155

i9e1 opened this issue Aug 22, 2023 · 1 comment

Comments

@i9e1
Copy link

i9e1 commented Aug 22, 2023

Since v"1.8.0" its possible to annotate a mutable struct's field with the const keyword.

If you do, DocStringExtensions FIELDS, TYPEDFIELDS fail: docstrings are only parsed for mutable fields.
Here is a MWE tested with julia v"1.9.2" and DocStringExtenions v"0.9.3".

julia> """Minimal Working Example to demonstrate `const` keyword on mutable struct with fields $(FIELDS) and typed $(TYPEDFIELDS)"""
       mutable struct MWE
           "This is not shown"
           const a::Real
           "This works as it should"
           b::Real
       end;

julia>

help?> MWE
search: MWE

  Minimal Working Example to demonstrate const keyword on mutable struct with fields

    •  a

    •  b: This works as it should

  and typed

    •  a::Real

    •  b::Real: This works as it should
@i9e1 i9e1 changed the title FIELDS / TYPEDFIELDS fail on const fields of immutable structs FIELDS / TYPEDFIELDS fail on const fields of mutable struct Aug 22, 2023
@MichaelHatherly
Copy link
Member

This is an upstream issue from what I can tell:

julia> """Minimal Working Example to demonstrate `const` keyword on mutable struct with fields"""
              mutable struct MWE
                  "This is not shown"
                  const a::Real
                  "This works as it should"
                  b::Real
              end;

help?> MWE.a
  MWE has fields a, and b.

help?> MWE.b
  This works as it should

MWE.a should give the attached docs, just like MWE.b does. It doesn't. We can't fix anything in DocStringExtensions.jl until that issue is fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants