Skip to content

Commit

Permalink
fix doccing call overload without named argument (#28875)
Browse files Browse the repository at this point in the history
(cherry picked from commit 7e1f739)
  • Loading branch information
KristofferC committed Aug 25, 2018
1 parent 6ec8c21 commit 3276895
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion base/docs/Docs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ function astname(x::Expr, ismacro::Bool)
ismacro ? macroname(x) : x
# Call overloading, e.g. `(a::A)(b) = b` or `function (a::A)(b) b end` should document `A(b)`
elseif (isexpr(x, :function) || isexpr(x, :(=))) && isexpr(x.args[1], :call) && isexpr(x.args[1].args[1], :(::))
return astname(x.args[1].args[1].args[2], ismacro)
return astname(x.args[1].args[1].args[end], ismacro)
else
n = isexpr(x, (:module, :struct)) ? 2 : 1
astname(x.args[n], ismacro)
Expand Down
7 changes: 7 additions & 0 deletions test/docs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1121,6 +1121,13 @@ struct A_20087 end

@test docstrings_equal(@doc(A_20087()), doc"a")

struct B_20087 end

"""b"""
(::B_20087)() = a

@test docstrings_equal(@doc(B_20087()), doc"b")

# issue #27832

_last_atdoc = Core.atdoc
Expand Down

0 comments on commit 3276895

Please sign in to comment.