Skip to content

Commit fc6af82

Browse files
omustimholy
authored andcommitted
Support isassigned(::RefValue) (#345)
1 parent 92fd097 commit fc6af82

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

README.md

+3
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,8 @@ Currently, the `@compat` macro supports the following syntaxes:
157157

158158
* `convert` can convert between different `Set` types on 0.5 and below. ([#18727])
159159

160+
* `isassigned(::RefValue)` is supported on 0.5 and below. ([#18082])
161+
160162
* `unsafe_trunc(::Type{<:Integer}, ::Integer)` is supported on 0.5. ([#18629])
161163

162164
## Renamed functions
@@ -335,6 +337,7 @@ includes this fix. Find the minimum version from there.
335337
[#17323]: https://github.com/JuliaLang/julia/issues/17323
336338
[#17510]: https://github.com/JuliaLang/julia/issues/17510
337339
[#17623]: https://github.com/JuliaLang/julia/issues/17623
340+
[#18086]: https://github.com/JuliaLang/julia/issues/18086
338341
[#18380]: https://github.com/JuliaLang/julia/issues/18380
339342
[#18484]: https://github.com/JuliaLang/julia/issues/18484
340343
[#18510]: https://github.com/JuliaLang/julia/issues/18510

src/Compat.jl

+5
Original file line numberDiff line numberDiff line change
@@ -1450,6 +1450,11 @@ if VERSION < v"0.6.0-dev.838"
14501450
Base.convert{T}(::Type{Set{T}}, s::Set) = Set{T}(s)
14511451
end
14521452

1453+
# https://github.com/JuliaLang/julia/pull/18082
1454+
if VERSION < v"0.6.0-dev.2347"
1455+
Base.isassigned(x::Base.RefValue) = isdefined(x, :x)
1456+
end
1457+
14531458
if VERSION < v"0.6.0-dev.735"
14541459
Base.unsafe_trunc{T<:Integer}(::Type{T}, x::Integer) = rem(x, T)
14551460
end

test/runtests.jl

+4
Original file line numberDiff line numberDiff line change
@@ -1805,6 +1805,10 @@ let
18051805
@test cssset == Set(["foo", "bar"])
18061806
end
18071807

1808+
# PR 18082
1809+
@test !isassigned(Ref{String}())
1810+
@test isassigned(Ref{String}("Test"))
1811+
18081812
@test unsafe_trunc(Int8, 128) === Int8(-128)
18091813
@test_throws InexactError trunc(Int8, 128)
18101814

0 commit comments

Comments
 (0)