From ea9e8af0a4fbd97cbc52d173b567a9a4a6666916 Mon Sep 17 00:00:00 2001 From: Matt Bauman Date: Tue, 15 Dec 2020 13:32:26 -0500 Subject: [PATCH] fix #38897, docstring for .op= Also change "equivalent to" to a more rough "akin to" since `x .op y` isn't always identical to `broadcast(op, x, y)`. --- stdlib/REPL/src/docview.jl | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/stdlib/REPL/src/docview.jl b/stdlib/REPL/src/docview.jl index 033b04edd7caf..677c06e8ce1a7 100644 --- a/stdlib/REPL/src/docview.jl +++ b/stdlib/REPL/src/docview.jl @@ -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)))