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

SIGNATURES randomly generated #102

Closed
amontoison opened this issue Sep 1, 2020 · 6 comments · Fixed by #141
Closed

SIGNATURES randomly generated #102

amontoison opened this issue Sep 1, 2020 · 6 comments · Fixed by #141

Comments

@amontoison
Copy link

I tried to use DocStringExtensions.jl with the package Krylov.jl but I encountered some problems. When I build the docs, the signature of only two random Krylov solvers is generated. Do you have an idea where the problem comes from?
JuliaSmoothOptimizers/Krylov.jl#208

examples

@MichaelHatherly
Copy link
Member

What kind of output are you getting when using ? mode in the REPL? Are the templates showing up there?

@amontoison
Copy link
Author

Yes, but only for one solver. The signature is only given for the first method when using ? after using Krylov.

krylov

@exaexa
Copy link
Contributor

exaexa commented Dec 7, 2022

Hi! Reviving this issue-- I see the same problem with TYPEDSIGNATURES in PikaParser package here. Missing signatures can be seen e.g. here:
https://lcsb-biocore.github.io/PikaParser.jl/dev/reference/#PikaParser.followed_by-Tuple{G}%20where%20G
and here
https://lcsb-biocore.github.io/PikaParser.jl/dev/reference/#PikaParser.parse_lex-Union{Tuple{I},%20Tuple{T},%20Tuple{G},%20Tuple{PikaParser.Grammar{G,%20T},%20I}}%20where%20{G,%20T,%20I}

Quite surprisingly, a different set of signatures is missing (lex instead of parse_lex) when I build the same docs from the same source locally.

Regarding this:

What kind of output are you getting when using ? mode in the REPL? Are the templates showing up there?

No, the missing signatures are not present even in REPL.

@exaexa
Copy link
Contributor

exaexa commented Dec 7, 2022

...turns out methodgroups might be to blame, this is from a quick debug:

┌ Info: in format(::TypedMethodSignatures, ...)
│   binding = PikaParser.some
│   typesig = Tuple{G} where G
│   modname = PikaParser
│   func = some (generic function with 1 method)
└   groups = Vector{Method}[]

🙄

@exaexa
Copy link
Contributor

exaexa commented Dec 7, 2022

looks like in some cases the unionall is missing in typesigs in methodgroups, which breaks the in typesigs check:

┌ Info: in methodgroups
│   typesigs =
│    1-element Vector{Any}:
└     Tuple{G}
┌ Info: in methodgroups filter
│   m = some(x::G) where G in PikaParser at /home/exa/work/PikaParser.jl/src/frontend.jl:134
│   ismod = true
│   m.sig = Tuple{typeof(PikaParser.some), G} where G
└   Base.rewrap_unionall(Base.tuple_type_tail(m.sig), m.sig) = Tuple{G} where G
┌ Info: in format(::TypedMethodSignatures, ...)
│   binding = PikaParser.some
│   typesig = Tuple{G} where G
│   modname = PikaParser
│   func = some (generic function with 1 method)
└   groups = Vector{Method}[]

@exaexa
Copy link
Contributor

exaexa commented Dec 7, 2022

Ok I probably found the problem, looks like a sneaky broadcast:

julia> sig = (Tuple{G} where G)
Tuple{G} where G

julia> Base.rewrap_unionall.(DocStringExtensions.uniontypes(Base.unwrap_unionall(sig)), sig)
1-element Vector{DataType}:
 Tuple{G}

julia> Base.rewrap_unionall.(DocStringExtensions.uniontypes(Base.unwrap_unionall(sig)), Ref(sig))
1-element Vector{UnionAll}:
 Tuple{G} where G

I'll check how much this breaks all the other stuff and send a patch. :]

exaexa added a commit to exaexa/DocStringExtensions.jl that referenced this issue Dec 7, 2022
For me this fixes JuliaDocs#102

Problematic use-case is roughly as follows:
```
julia> sig = (Tuple{G} where G)
Tuple{G} where G

julia> Base.rewrap_unionall.(DocStringExtensions.uniontypes(Base.unwrap_unionall(sig)), sig)
1-element Vector{DataType}:
 Tuple{G}

julia> Base.rewrap_unionall.(DocStringExtensions.uniontypes(Base.unwrap_unionall(sig)), Ref(sig))
1-element Vector{UnionAll}:
 Tuple{G} where G
```
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

Successfully merging a pull request may close this issue.

3 participants