diff --git a/.travis.yml b/.travis.yml index 5cfb21f..a5e96fd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,6 +5,7 @@ os: - osx julia: - 0.6 + - 0.7 - nightly notifications: email: false diff --git a/src/derivative.jl b/src/derivative.jl index 5d663da..9cf862a 100644 --- a/src/derivative.jl +++ b/src/derivative.jl @@ -13,6 +13,7 @@ derivative(f, dtype::Symbol = :central) = derivative(f, :scalar, dtype) gradient(f, x::Union{T, Vector{T}}, dtype::Symbol = :central) where {T <: Number} = finite_difference(f, float(x), dtype) gradient(f, dtype::Symbol = :central) = derivative(f, :vector, dtype) +@static if isdefined(Compat.LinearAlgebra, :gradient) function Compat.LinearAlgebra.gradient(f, x::Union{T, Vector{T}}, dtype::Symbol = :central) where T <: Number Base.depwarn("The finite difference methods from Calculus.jl no longer extend " * "Base.gradient and should be called as Calculus.gradient instead. " * @@ -26,6 +27,7 @@ function Compat.LinearAlgebra.gradient(f, dtype::Symbol = :central) "This usage is deprecated.", :gradient) Calculus.gradient(f,dtype) end +end if isdefined(Base, :adjoint) Base.adjoint(f::Function) = derivative(f) diff --git a/src/symbolic.jl b/src/symbolic.jl index c5578ae..b887eac 100644 --- a/src/symbolic.jl +++ b/src/symbolic.jl @@ -93,7 +93,7 @@ function simplify(ex::Expr) return ex end if all(isnumber, ex.args[2:end]) && length(ex.args) > 1 - return eval(@__MODULE__, ex) + return (@static (VERSION < v"0.7.0-DEV.5149") ? eval : Core.eval)(@__MODULE__, ex) end new_ex = simplify(SymbolParameter(ex.args[1]), ex.args[2:end]) while !(isequal(new_ex, ex))