Skip to content

Commit

Permalink
fix #38897, docstring for .op= (#38898)
Browse files Browse the repository at this point in the history
Also change "equivalent to" to a more rough "akin to" since `x .op y` isn't always identical to `broadcast(op, x, y)`.
  • Loading branch information
mbauman authored Dec 15, 2020
1 parent fa6077e commit 74a08fe
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions stdlib/REPL/src/docview.jl
Original file line number Diff line number Diff line change
Expand Up @@ -219,12 +219,14 @@ function lookup_doc(ex)
end
if isa(ex, Symbol) && Base.isoperator(ex)
str = string(ex)
isdotted = startswith(str, ".")
if endswith(str, "=") && Base.operator_precedence(ex) == Base.prec_assignment
op = str[1:end-1]
return Markdown.parse("`x $op= y` is a synonym for `x = x $op y`")
elseif startswith(str, ".")
eq = isdotted ? ".=" : "="
return Markdown.parse("`x $op= y` is a synonym for `x $eq x $op y`")
elseif isdotted
op = str[2:end]
return Markdown.parse("`x $ex y` is equivalent to `broadcast($op, x, y)`. See [`broadcast`](@ref).")
return Markdown.parse("`x $ex y` is akin to `broadcast($op, x, y)`. See [`broadcast`](@ref).")
end
end
binding = esc(bindingexpr(namify(ex)))
Expand Down

0 comments on commit 74a08fe

Please sign in to comment.