Skip to content

Commit 00e601a

Browse files
authored
add ismutable to Compat for Julia PR 34652 (#686)
* add to Compat for Julia PR 34652
1 parent e80306d commit 00e601a

File tree

4 files changed

+17
-1
lines changed

4 files changed

+17
-1
lines changed

Project.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "Compat"
22
uuid = "34da2185-b29b-5c13-b0c7-acf172513d20"
3-
version = "3.3.1"
3+
version = "3.4.0"
44

55
[deps]
66
Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"

README.md

+4
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ Please check the list below for the specific syntax you need.
4444

4545
## Supported features
4646

47+
* `ismutable` return `true` iff value `v` is mutable ([#34652]). (since Compat 3.4.0)
48+
4749
* `uuid5` generates a version 5 universally unique identifier (UUID), as specified by RFC 4122 ([#28761]). (since Compat 3.3.0)
4850

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

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

77+
7578
## Developer tips
7679

7780
One of the most important rules for `Compat.jl` is to avoid breaking user code
@@ -115,3 +118,4 @@ Note that you should specify the correct minimum version for `Compat` in the
115118
[#33736]: http://github.com/JuliaLang/julia/pull/33736
116119
[#32968]: https://github.com/JuliaLang/julia/pull/32968
117120
[#28761]: https://github.com/JuliaLang/julia/pull/28761
121+
[#34652]: https://github.com/JuliaLang/julia/pull/34652

src/Compat.jl

+6
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,12 @@ if VERSION < v"1.4.0-DEV.551"
199199
Base.filter(f, t::Base.Any16) = Tuple(filter(f, collect(t)))
200200
end
201201

202+
# https://github.com/JuliaLang/julia/pull/34652
203+
if VERSION < v"1.5.0-DEV.247"
204+
export ismutable
205+
ismutable(@nospecialize(x)) = (Base.@_pure_meta; typeof(x).mutable)
206+
end
207+
202208
# https://github.com/JuliaLang/julia/pull/28761
203209
export uuid5
204210
if VERSION < v"1.1.0-DEV.326"

test/runtests.jl

+6
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,12 @@ end
215215
@test filter(x -> x<2, (longtuple..., 1.5)) === (1, 1.5)
216216
end
217217

218+
# https://github.com/JuliaLang/julia/pull/34652
219+
@testset "ismutable" begin
220+
@test ismutable(1) == false
221+
@test ismutable([]) == true
222+
end
223+
218224
# https://github.com/JuliaLang/julia/pull/28761
219225
@testset "uuid5" begin
220226
u1 = uuid1()

0 commit comments

Comments
 (0)