Closed tomyun closed 4 years ago
Not sure if this is subject to type piracy, but quite puzzling when I first saw a Crayon popping out of nowhere.
Normal behavior of Base.merge() before Crayons got imported:
Base.merge()
julia> merge() ERROR: MethodError: no method matching merge() Closest candidates are: merge(::AbstractDict, ::AbstractDict...) at abstractdict.jl:286 merge(::Function, ::AbstractDict, ::AbstractDict...) at abstractdict.jl:316 merge(::NamedTuple{(),T} where T<:Tuple, ::NamedTuple) at namedtuple.jl:233 ... Stacktrace: [1] top-level scope at REPL[1]:1
After:
julia> import Crayons julia> merge() julia> ans |> typeof Crayons.Crayon
It comes from splatting Base.merge(toks::Crayon...). https://github.com/KristofferC/Crayons.jl/blob/5950d1d2eac171c06139d99e5f600a4d41ee5b9b/src/crayon.jl#L278
Base.merge(toks::Crayon...)
Thanks: https://github.com/KristofferC/Crayons.jl/pull/37.
Not sure if this is subject to type piracy, but quite puzzling when I first saw a Crayon popping out of nowhere.
Normal behavior of
Base.merge()
before Crayons got imported:After:
It comes from splatting
Base.merge(toks::Crayon...)
. https://github.com/KristofferC/Crayons.jl/blob/5950d1d2eac171c06139d99e5f600a4d41ee5b9b/src/crayon.jl#L278