Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add ismutable to Compat for Julia PR 34652 #686

Merged
merged 10 commits into from
Feb 9, 2020
3 changes: 2 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name = "Compat"
uuid = "34da2185-b29b-5c13-b0c7-acf172513d20"
version = "3.3.1"

martinholters marked this conversation as resolved.
Show resolved Hide resolved
version = "3.4.0"

[deps]
Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ Please check the list below for the specific syntax you need.

## Supported features

* `ismutable` return `true` iff value `v` is mutable ([#34652]). (since Compat 3.4.0)

* `uuid5` generates a version 5 universally unique identifier (UUID), as specified by RFC 4122 ([#28761]). (since Compat 3.3.0)

* `dot` now has a 3-argument method `dot(x, A, y)` without storing the intermediate result `A*y` ([#32739]). (since Compat 3.2.0)
Expand Down Expand Up @@ -72,6 +74,7 @@ Please check the list below for the specific syntax you need.

* `range` supporting `stop` as positional argument ([#28708]). (since Compat 1.3.0)


## Developer tips

One of the most important rules for `Compat.jl` is to avoid breaking user code
Expand Down Expand Up @@ -115,3 +118,4 @@ Note that you should specify the correct minimum version for `Compat` in the
[#33736]: http://github.com/JuliaLang/julia/pull/33736
[#32968]: https://github.com/JuliaLang/julia/pull/32968
[#28761]: https://github.com/JuliaLang/julia/pull/28761
[#34652]: https://github.com/JuliaLang/julia/pull/34652
6 changes: 6 additions & 0 deletions src/Compat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,12 @@ if VERSION < v"1.4.0-DEV.551"
Base.filter(f, t::Base.Any16) = Tuple(filter(f, collect(t)))
end

# https://github.com/JuliaLang/julia/pull/34652
if VERSION < v"1.5.0-DEV.236"
martinholters marked this conversation as resolved.
Show resolved Hide resolved
export ismutable
ismutable(@nospecialize(x)) = (Base.@_pure_meta; typeof(x).mutable)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could use @pure (no bootstrapping issues in Compat.jl), but doesn't really matter.

end

# https://github.com/JuliaLang/julia/pull/28761
export uuid5
if VERSION < v"1.1.0-DEV.326"
Expand Down
6 changes: 6 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,12 @@ end
@test filter(x -> x<2, (longtuple..., 1.5)) === (1, 1.5)
end

# https://github.com/JuliaLang/julia/pull/34652
@testset "ismutable" begin
@test ismutable(1) == false
@test ismutable([]) == true
end

# https://github.com/JuliaLang/julia/pull/28761
@testset "uuid5" begin
u1 = uuid1()
Expand Down