Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,10 @@ Currently, the `@compat` macro supports the following syntaxes:

* `indmin` and `indmax` are now `argmin` and `argmax`, respectively ([#25654]).

* `Compat.indexin` accepts any iterable as first argument, returns `nothing` (rather than `0`)
for entries with no match and gives the index of the first (rather than the last) match
([#25662], [#25998]).

* `isabstract` and `isleaftype` are now `isabstracttype` and `isconcretetype`, respectively
([#23666], [#25496]).

Expand Down Expand Up @@ -576,6 +580,7 @@ includes this fix. Find the minimum version from there.
[#25646]: https://github.com/JuliaLang/julia/issues/25646
[#25647]: https://github.com/JuliaLang/julia/issues/25647
[#25654]: https://github.com/JuliaLang/julia/issues/25654
[#25662]: https://github.com/JuliaLang/julia/issues/25662
[#25705]: https://github.com/JuliaLang/julia/issues/25705
[#25706]: https://github.com/JuliaLang/julia/issues/25706
[#25738]: https://github.com/JuliaLang/julia/issues/25738
Expand All @@ -585,6 +590,7 @@ includes this fix. Find the minimum version from there.
[#25896]: https://github.com/JuliaLang/julia/issues/25896
[#25959]: https://github.com/JuliaLang/julia/issues/25959
[#25990]: https://github.com/JuliaLang/julia/issues/25990
[#25998]: https://github.com/JuliaLang/julia/issues/25998
[#26069]: https://github.com/JuliaLang/julia/issues/26069
[#26089]: https://github.com/JuliaLang/julia/issues/26089
[#26149]: https://github.com/JuliaLang/julia/issues/26149
Expand Down
15 changes: 15 additions & 0 deletions src/Compat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1666,6 +1666,21 @@ end
Base.mv(src, dst; remove_destination = force)
end

if VERSION < v"0.7.0-DEV.3972"
function indexin(a, b::AbstractArray)
inds = keys(b)
bdict = Dict{eltype(b),eltype(inds)}()
for (val, ind) in zip(b, inds)
get!(bdict, val, ind)
end
return Union{eltype(inds), Nothing}[
get(bdict, i, nothing) for i in a
]
end
else
const indexin = Base.indexin
end

include("deprecated.jl")

end # module Compat
3 changes: 3 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1488,4 +1488,7 @@ mktempdir(@__DIR__) do dir
@test readdir(dir) == ["dest.jl"]
end

# 0.7.0-DEV.3972
@test Compat.indexin([1, 2], [1, 0, 1]) == [1, nothing]

nothing