-
-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove old deprecations, deprecate obsolete stuff (#646)
* Drop deprecations * Deprecate `Compat.StringVector` * Deprecate `at-dep_vectorize_[12]ag` * Deprecate `round` and friends with `digits` as positional argument * Remove README entry for `at-dep_vectorize_[12]ag` * Deprecate `range(start, stop)` (with neither `length` nor `step` given) * Deprecate `at-dotcompat` * Remove tests of deprecated functionality * Deprecate `Random.uuid1`, `uuid4`, `uuid_version` to `UUIDs.*`
- Loading branch information
1 parent
c55e812
commit 9406b80
Showing
5 changed files
with
95 additions
and
202 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,84 @@ | ||
function depwarn_ex(msg, name) | ||
return quote | ||
Base.depwarn($msg, Symbol($name)) | ||
Base.@deprecate_binding StringVector Base.StringVector false | ||
|
||
# PR #17302 | ||
# Provide a non-deprecated version of `@vectorize_(1|2)arg` macro which defines | ||
# deprecated version of the function so that the depwarns can be fixed without | ||
# breaking users. | ||
# Packages are expected to use this to maintain the old API until all users | ||
# of the deprecated vectorized function have migrated. | ||
# These macros should be dropped when the support for `0.6` is dropped from `Compat`. | ||
# Modified based on the version copied from 0.6 Base. | ||
if VERSION < v"0.7.0-DEV.1211" | ||
macro dep_vectorize_1arg(S, f) | ||
S = esc(S) | ||
f = esc(f) | ||
T = esc(:T) | ||
x = esc(:x) | ||
AbsArr = esc(:AbstractArray) | ||
Base.depwarn("Implicit vectorized function is deprecated in favor of compact broadcast syntax.", | ||
Symbol("@dep_vectorize_1arg")) | ||
:(@deprecate $f{$T<:$S}($x::$AbsArr{$T}) @compat($f.($x))) | ||
end | ||
end | ||
|
||
primarytype(@nospecialize(t)) = t.name.wrapper | ||
macro dep_vectorize_2arg(S, f) | ||
S = esc(S) | ||
f = esc(f) | ||
T1 = esc(:T1) | ||
T2 = esc(:T2) | ||
x = esc(:x) | ||
y = esc(:y) | ||
AbsArr = esc(:AbstractArray) | ||
Base.depwarn("Implicit vectorized function is deprecated in favor of compact broadcast syntax.", | ||
Symbol("@dep_vectorize_2arg")) | ||
quote | ||
@deprecate $f{$T1<:$S}($x::$S, $y::$AbsArr{$T1}) @compat($f.($x,$y)) | ||
@deprecate $f{$T1<:$S}($x::$AbsArr{$T1}, $y::$S) @compat($f.($x,$y)) | ||
@deprecate $f{$T1<:$S,$T2<:$S}($x::$AbsArr{$T1}, $y::$AbsArr{$T2}) @compat($f.($x,$y)) | ||
end | ||
end | ||
else | ||
macro dep_vectorize_1arg(S, f) | ||
AbstractArray = GlobalRef(Base, :AbstractArray) | ||
Base.depwarn("Implicit vectorized function is deprecated in favor of compact broadcast syntax.", | ||
Symbol("@dep_vectorize_1arg")) | ||
return esc(:(@deprecate $f(x::$AbstractArray{T}) where {T<:$S} $f.(x))) | ||
end | ||
|
||
export @functorize | ||
macro functorize(f) | ||
code = f === :scalarmax ? :(Base.scalarmax) : | ||
f === :scalarmin ? :(Base.scalarmin) : | ||
f === :centralizedabs2fun ? :(primarytype(typeof(Base.centralizedabs2fun(0)))) : | ||
f | ||
warning = depwarn_ex("@functorize is deprecated as functor objects are no longer supported in julia", "@functorize") | ||
return quote | ||
$warning | ||
$code | ||
macro dep_vectorize_2arg(S, f) | ||
AbstractArray = GlobalRef(Base, :AbstractArray) | ||
Base.depwarn("Implicit vectorized function is deprecated in favor of compact broadcast syntax.", | ||
Symbol("@dep_vectorize_2arg")) | ||
return esc(quote | ||
@deprecate $f(x::$S, y::$AbstractArray{T1}) where {T1<:$S} $f.(x, y) | ||
@deprecate $f(x::$AbstractArray{T1}, y::$S) where {T1<:$S} $f.(x, y) | ||
@deprecate $f(x::$AbstractArray{T1}, y::$AbstractArray{T2}) where {T1<:$S, T2<:$S} $f.(x, y) | ||
end) | ||
end | ||
end | ||
|
||
Base.@deprecate_binding KERNEL Sys.KERNEL | ||
Base.@deprecate_binding UTF8String Core.String | ||
Base.@deprecate_binding ASCIIString Core.String | ||
Base.@deprecate_binding unsafe_convert Base.unsafe_convert | ||
Base.@deprecate_binding remote_do Distributed.remote_do | ||
Base.@deprecate_binding Filesystem Base.Filesystem | ||
Base.@deprecate_binding AsyncCondition Base.AsyncCondition | ||
Base.@deprecate_binding promote_eltype_op Base.promote_eltype_op | ||
@eval Base.@deprecate_binding $(Symbol("@irrational")) Base.$(Symbol("@irrational")) | ||
@eval Base.@deprecate_binding $(Symbol("@blasfunc")) Compat.LinearAlgebra.BLAS.$(Symbol("@blasfunc")) | ||
# compatibility with https://github.com/JuliaLang/julia/pull/26156 | ||
Base.@deprecate trunc(x, digits; base = 10) Compat.trunc(x, digits = digits, base = base) false | ||
Base.@deprecate floor(x, digits; base = 10) Compat.floor(x, digits = digits, base = base) false | ||
Base.@deprecate ceil(x, digits; base = 10) Compat.ceil(x, digits = digits, base = base) false | ||
Base.@deprecate round(x, digits; base = 10) Compat.round(x, digits = digits, base = base) false | ||
Base.@deprecate signif(x, digits; base = 10) Compat.round(x, sigdigits = digits, base = base) false | ||
|
||
# to be deprecated: | ||
if VERSION >= v"1.1.0-DEV.506" | ||
# deprecation of range(start, stop) for earlier versions is done in Compat.jl | ||
# This method is restricted to Number, since we don't | ||
# want to overwrite the (::Any, ::Any) method in Base. | ||
function range(start::Number, stop::Number; kwargs...) | ||
rangedepwarn(;kwargs...) | ||
range(start; stop=stop, kwargs...) | ||
end | ||
end | ||
|
||
# this was defined for use with Julia versions prior to 0.5 | ||
# (see https://github.com/JuliaLang/Compat.jl/pull/316) | ||
macro dotcompat(x) | ||
Base.depwarn("`@dotcompat x` is deprecated, use `@compat @. x` instead.", Symbol("@dotcompat")) | ||
esc(:(Compat.@compat @. $x)) | ||
end | ||
export @dotcompat | ||
|
||
# * `range(start, stop)` (without either `length` nor `step` given) | ||
# * Compat.Random.uuid1, uuid4, uuid_version (in favour of Compat.UUIDs.*) | ||
# Compat.Random.uuid1, uuid4, uuid_version are deprecated in Compat.jl |
Oops, something went wrong.