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

Issue documenting splat methods #12701

Closed
MikeInnes opened this issue Aug 19, 2015 · 7 comments
Closed

Issue documenting splat methods #12701

MikeInnes opened this issue Aug 19, 2015 · 7 comments
Labels
docsystem The documentation building system

Comments

@MikeInnes
Copy link
Member

julia> "foo"
       f() = 1
f (generic function with 1 method)

julia> "bar"
       f(x...) = 1
f (generic function with 2 methods)

help?> f
search: f fd for fma fld fft full find filt fill fft! fdio frexp foldr foldl

  bar

@MichaelHatherly you changed this recently so you might have some ideas. which is working correctly:

julia> which(f, ())
f() at none:2

julia> which(f, (Vararg{Any},))
f(x...) at none:2
@MikeInnes
Copy link
Member Author

Ok, looks like this is due to documenting the first element of this array:

julia> methods(f, (Vararg{Any},))
2-element Array{Any,1}:
 f() at none:2    
 f(x...) at none:2

@MichaelHatherly
Copy link
Member

It's due to this line where the first method from methods is taken as the correct one.

julia> methods(f, Tuple{})
1-element Array{Any,1}:
 f() at none:2

julia> methods(f, Tuple{Vararg{Any}})
2-element Array{Any,1}:
 f() at none:2    
 f(x...) at none:2

@MikeInnes
Copy link
Member Author

Is it safe to change that to which?

@MichaelHatherly
Copy link
Member

Related: #12518

@MichaelHatherly
Copy link
Member

Is it safe to change that to which?

The issue linked there gives an example where it isn't.

@MikeInnes
Copy link
Member Author

Using end instead of 1 fixes this case and doesn't break the tests. I'm going to go with that for now we'll leave this open as well, just in case it crops up again.

@MichaelHatherly
Copy link
Member

👍, sounds fine to me.

@kshyatt kshyatt added the docsystem The documentation building system label Aug 20, 2015
MichaelHatherly added a commit to MichaelHatherly/julia that referenced this issue Sep 27, 2015
Combines the `doc(::Function)` and `doc(::DataType)` methods since they
were nearly identical.

Enables searching for docstrings attached to specific constructors in the
same manner as is currently allowed for normal methods. Prior to this it
resulted in a no method error.

Fixes JuliaLang#12701 where splatted method docs were shadowing others. Although not
the original cause of the issue, with the change to storing signatures
as `Tuple{...}` (in JuliaLang#12835) this meant that `f(x...)` was stored as
`Tuple{Vararg{Any}}` which is equal to `Tuple`. Since the default value of
`sig` was `Tuple` not all matching docs were returned in the example
provided in JuliaLang#12701.
tkelman pushed a commit that referenced this issue Sep 28, 2015
Combines the `doc(::Function)` and `doc(::DataType)` methods since they
were nearly identical.

Enables searching for docstrings attached to specific constructors in the
same manner as is currently allowed for normal methods. Prior to this it
resulted in a no method error.

Fixes #12701 where splatted method docs were shadowing others. Although not
the original cause of the issue, with the change to storing signatures
as `Tuple{...}` (in #12835) this meant that `f(x...)` was stored as
`Tuple{Vararg{Any}}` which is equal to `Tuple`. Since the default value of
`sig` was `Tuple` not all matching docs were returned in the example
provided in #12701.

(cherry picked from commit 1b1e6c6)
ref #13330
skumagai pushed a commit to skumagai/julia that referenced this issue Oct 9, 2015
Combines the `doc(::Function)` and `doc(::DataType)` methods since they
were nearly identical.

Enables searching for docstrings attached to specific constructors in the
same manner as is currently allowed for normal methods. Prior to this it
resulted in a no method error.

Fixes JuliaLang#12701 where splatted method docs were shadowing others. Although not
the original cause of the issue, with the change to storing signatures
as `Tuple{...}` (in JuliaLang#12835) this meant that `f(x...)` was stored as
`Tuple{Vararg{Any}}` which is equal to `Tuple`. Since the default value of
`sig` was `Tuple` not all matching docs were returned in the example
provided in JuliaLang#12701.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docsystem The documentation building system
Projects
None yet
Development

No branches or pull requests

3 participants