diff --git a/base/docs/Docs.jl b/base/docs/Docs.jl index 23753f86f2625..3894e2635d526 100644 --- a/base/docs/Docs.jl +++ b/base/docs/Docs.jl @@ -232,9 +232,9 @@ function doc!(b::Binding, str::DocStr, sig::ANY = Union{}) m = get!(meta(), b, MultiDoc()) if haskey(m.docs, sig) # We allow for docstrings to be updated, but print a warning since it is possible - # that over-writing a docstring *may* have been accidental. - s = "replacing docs for '$b :: $sig' in module '$(current_module())'." - isdefined(Base, :STDERR) ? warn(s) : ccall(:jl_, Void, (Any,), "WARNING: $s") + # that over-writing a docstring *may* have been accidental. The warning + # is suppressed for symbols in Main, for interactive use (#23011). + current_module() == Main || warn("replacing docs for '$b :: $sig' in module '$(current_module())'.") else # The ordering of docstrings for each Binding is defined by the order in which they # are initially added. Replacing a specific docstring does not change it's ordering. diff --git a/test/docs.jl b/test/docs.jl index 18e0a21617530..dcb91d974594d 100644 --- a/test/docs.jl +++ b/test/docs.jl @@ -1010,3 +1010,10 @@ end """ ) +# issue #23011 +@test_nowarn @eval Main begin + @doc "first" f23011() = 1 + @doc "second" f23011() = 2 +end +@test Main.f23011() == 2 +@test docstrings_equal(@doc(Main.f23011), doc"second")