Skip to content

Commit

Permalink
v0.7 deprecation fixes (#5)
Browse files Browse the repository at this point in the history
* v0.7 deprecation fixes

* allow test failures on nightly
  • Loading branch information
jrevels authored Jan 15, 2018
1 parent 02f7ebe commit d49bd6d
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ os:
julia:
- 0.6
- nightly
matrix:
allow_failures:
- julia: nightly
notifications:
email: false
git:
Expand Down
1 change: 1 addition & 0 deletions REQUIRE
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
julia 0.6
StaticArrays 0.5.0
Compat 0.45.0
5 changes: 3 additions & 2 deletions src/DiffResults.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ __precompile__()
module DiffResults

using StaticArrays
using Compat

#########
# Types #
Expand Down Expand Up @@ -156,7 +157,7 @@ instance will be created and returned, whereas if `r::MutableDiffResult`, then `
mutated in-place and returned. Thus, this function should be called as `r = value!(r, x)`.
"""
value!(r::MutableDiffResult, x::Number) = (r.value = x; return r)
value!(r::MutableDiffResult, x::AbstractArray) = (copy!(value(r), x); return r)
value!(r::MutableDiffResult, x::AbstractArray) = (copyto!(value(r), x); return r)
value!(r::ImmutableDiffResult{O,V}, x::Union{Number,AbstractArray}) where {O,V} = ImmutableDiffResult(convert(V, x), r.derivs)

"""
Expand Down Expand Up @@ -198,7 +199,7 @@ function derivative!(r::MutableDiffResult, x::Number, ::Type{Val{i}} = Val{1}) w
end

function derivative!(r::MutableDiffResult, x::AbstractArray, ::Type{Val{i}} = Val{1}) where {i}
copy!(derivative(r, Val{i}), x)
copyto!(derivative(r, Val{i}), x)
return r
end

Expand Down
3 changes: 2 additions & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using DiffResults, StaticArrays
using Base.Test
using Compat
using Compat.Test

using DiffResults: DiffResult, GradientResult, JacobianResult, HessianResult,
value, value!, derivative, derivative!, gradient, gradient!,
Expand Down

0 comments on commit d49bd6d

Please sign in to comment.