Skip to content

Commit

Permalink
Fix deprecation error for 2 arg airy
Browse files Browse the repository at this point in the history
  • Loading branch information
simonbyrne committed Dec 30, 2016
1 parent 6ad62c4 commit 0566973
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions base/deprecated.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1284,9 +1284,9 @@ function _airy(k::Integer, z::Complex128)
depwarn("`airy(k,x)` is deprecated, use `airyai(x)`, `airyaiprime(x)`, `airybi(x)` or `airybiprime(x)` instead.",:airy)
id = Int32(k==1 || k==3)
if k == 0 || k == 1
return _airy(z, id, Int32(1))
return Base.Math._airy(z, id, Int32(1))
elseif k == 2 || k == 3
return _biry(z, id, Int32(1))
return Base.Math._biry(z, id, Int32(1))
else
throw(ArgumentError("k must be between 0 and 3"))
end
Expand All @@ -1295,9 +1295,9 @@ function _airyx(k::Integer, z::Complex128)
depwarn("`airyx(k,x)` is deprecated, use `airyaix(x)`, `airyaiprimex(x)`, `airybix(x)` or `airybiprimex(x)` instead.",:airyx)
id = Int32(k==1 || k==3)
if k == 0 || k == 1
return _airy(z, id, Int32(2))
return Base.Math._airy(z, id, Int32(2))
elseif k == 2 || k == 3
return _biry(z, id, Int32(2))
return Base.Math._biry(z, id, Int32(2))
else
throw(ArgumentError("k must be between 0 and 3"))
end
Expand All @@ -1308,6 +1308,8 @@ for afn in (:airy,:airyx)
suf = string(afn)[5:end]
@eval begin
function $afn(k::Integer, z::Complex128)
afn = $(QuoteNode(afn))
suf = $(QuoteNode(suf))
depwarn("`$afn(k,x)` is deprecated, use `airyai$suf(x)`, `airyaiprime$suf(x)`, `airybi$suf(x)` or `airybiprime$suf(x)` instead.",$(QuoteNode(afn)))
$_afn(k,z)
end
Expand All @@ -1319,16 +1321,13 @@ for afn in (:airy,:airyx)
$afn(k::Integer, x::AbstractFloat) = real($afn(k, complex(x)))

function $afn{T<:Number}(k::Number, x::AbstractArray{T})
depwarn("`$afn(k::Number,x::AbstractArray)` is deprecated, use `airyai$suf.(x)`, `airyaiprime$suf.(x)`, `airybi$suf.(x)` or `airybiprime$suf.(x)` instead.",$(QuoteNode(afn)))
$_afn.(k,x)
$afn.(k,x)
end
function $afn{S<:Number}(k::AbstractArray{S}, x::Number)
depwarn("`$afn(k::AbstractArray,x::AbstractArray)` is deprecated, use `airyai$suf.(x)`, `airyaiprime$suf.(x)`, `airybi$suf.(x)` or `airybiprime$suf.(x)` instead.",$(QuoteNode(afn)))
$_afn.(k,x)
$afn.(k,x)
end
function $afn{S<:Number,T<:Number}(k::AbstractArray{S}, x::AbstractArray{T})
depwarn("`$afn(k::AbstractArray,x::AbstractArray)` is deprecated, use `airyai$suf.(x)`, `airyaiprime$suf.(x)`, `airybi$suf.(x)` or `airybiprime$suf.(x)` instead.",$(QuoteNode(afn)))
$_afn.(k,x)
$afn.(k,x)
end
end
end
Expand Down

0 comments on commit 0566973

Please sign in to comment.