Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix deprecations #23440

Merged
merged 1 commit into from
Aug 29, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions base/boot.jl
Original file line number Diff line number Diff line change
Expand Up @@ -331,17 +331,17 @@ VecElement(arg::T) where {T} = VecElement{T}(arg)
# used by lowering of splicing unquote
splicedexpr(hd::Symbol, args::Array{Any,1}) = (e=Expr(hd); e.args=args; e)

_new(typ::Symbol, argty::Symbol) = eval(Core, :((::Type{$typ})(@nospecialize n::$argty) = $(Expr(:new, typ, :n))))
_new(typ::Symbol, argty::Symbol) = eval(Core, :($typ(@nospecialize n::$argty) = $(Expr(:new, typ, :n))))
_new(:LabelNode, :Int)
_new(:GotoNode, :Int)
_new(:NewvarNode, :SlotNumber)
_new(:QuoteNode, :Any)
_new(:SSAValue, :Int)
eval(Core, :((::Type{LineNumberNode})(l::Int) = $(Expr(:new, :LineNumberNode, :l, nothing))))
eval(Core, :((::Type{LineNumberNode})(l::Int, @nospecialize(f)) = $(Expr(:new, :LineNumberNode, :l, :f))))
eval(Core, :((::Type{GlobalRef})(m::Module, s::Symbol) = $(Expr(:new, :GlobalRef, :m, :s))))
eval(Core, :((::Type{SlotNumber})(n::Int) = $(Expr(:new, :SlotNumber, :n))))
eval(Core, :((::Type{TypedSlot})(n::Int, @nospecialize(t)) = $(Expr(:new, :TypedSlot, :n, :t))))
eval(Core, :(LineNumberNode(l::Int) = $(Expr(:new, :LineNumberNode, :l, nothing))))
eval(Core, :(LineNumberNode(l::Int, @nospecialize(f)) = $(Expr(:new, :LineNumberNode, :l, :f))))
eval(Core, :(GlobalRef(m::Module, s::Symbol) = $(Expr(:new, :GlobalRef, :m, :s))))
eval(Core, :(SlotNumber(n::Int) = $(Expr(:new, :SlotNumber, :n))))
eval(Core, :(TypedSlot(n::Int, @nospecialize(t)) = $(Expr(:new, :TypedSlot, :n, :t))))

Module(name::Symbol=:anonymous, std_imports::Bool=true) = ccall(:jl_f_new_module, Ref{Module}, (Any, Bool), name, std_imports)

Expand Down
6 changes: 3 additions & 3 deletions base/deprecated.jl
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,7 @@ function gen_broadcast_function_sparse(genbody::Function, f::Function, is_first_
body = genbody(f, is_first_sparse)
@eval let
local _F_
function _F_{Tv,Ti}(B::SparseMatrixCSC{Tv,Ti}, A_1, A_2)
function _F_(B::SparseMatrixCSC{Tv,Ti}, A_1, A_2) where {Tv,Ti}
$body
end
_F_
Expand Down Expand Up @@ -1263,11 +1263,11 @@ end

@noinline zero_arg_matrix_constructor(prefix::String) =
depwarn("$prefix() is deprecated, use $prefix(0, 0) instead.", :zero_arg_matrix_constructor)
function (::Type{Matrix{T}})() where T
function Matrix{T}() where T
zero_arg_matrix_constructor("Matrix{T}")
return Matrix{T}(0, 0)
end
function (::Type{Matrix})()
function Matrix()
zero_arg_matrix_constructor("Matrix")
return Matrix(0, 0)
end
Expand Down
2 changes: 1 addition & 1 deletion base/gmp.jl
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ function convert(::Type{T}, x::BigInt) where T<:Signed
end


(::Type{Float64})(n::BigInt, ::RoundingMode{:ToZero}) = MPZ.get_d(n)
Float64(n::BigInt, ::RoundingMode{:ToZero}) = MPZ.get_d(n)

function (::Type{T})(n::BigInt, ::RoundingMode{:ToZero}) where T<:Union{Float16,Float32}
T(Float64(n,RoundToZero),RoundToZero)
Expand Down
254 changes: 127 additions & 127 deletions base/linalg/blas.jl

Large diffs are not rendered by default.

1,230 changes: 615 additions & 615 deletions base/linalg/lapack.jl

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions base/random/generation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -73,17 +73,17 @@ function rand(rng::AbstractRNG, gen::BigFloatRandGenerator, ::CloseOpen{BigFloat
z.exp = 0
randbool &&
ccall((:mpfr_sub_d, :libmpfr), Int32,
(Ptr{BigFloat}, Ptr{BigFloat}, Cdouble, Int32),
&z, &z, 0.5, Base.MPFR.ROUNDING_MODE[])
(Ref{BigFloat}, Ref{BigFloat}, Cdouble, Int32),
z, z, 0.5, Base.MPFR.ROUNDING_MODE[])
z
end

# alternative, with 1 bit less of precision
# TODO: make an API for requesting full or not-full precision
function rand(rng::AbstractRNG, gen::BigFloatRandGenerator, ::CloseOpen{BigFloat}, ::Void)
z = rand(rng, Close1Open2(BigFloat), gen)
ccall((:mpfr_sub_ui, :libmpfr), Int32, (Ptr{BigFloat}, Ptr{BigFloat}, Culong, Int32),
&z, &z, 1, Base.MPFR.ROUNDING_MODE[])
ccall((:mpfr_sub_ui, :libmpfr), Int32, (Ref{BigFloat}, Ref{BigFloat}, Culong, Int32),
z, z, 1, Base.MPFR.ROUNDING_MODE[])
z
end

Expand Down
2 changes: 1 addition & 1 deletion base/sparse/cholmod.jl
Original file line number Diff line number Diff line change
Expand Up @@ -993,7 +993,7 @@ end

convert(::Type{Sparse}, A::Dense) = dense_to_sparse(A, SuiteSparse_long)
convert(::Type{Sparse}, L::Factor) = factor_to_sparse!(copy(L))
function (::Type{Sparse})(filename::String)
function Sparse(filename::String)
open(filename) do f
return read_sparse(f, SuiteSparse_long)
end
Expand Down
8 changes: 4 additions & 4 deletions base/sparse/umfpack.jl
Original file line number Diff line number Diff line change
Expand Up @@ -337,11 +337,11 @@ for itype in UmfpackIndexTypes
(Ptr{$itype},Ptr{$itype},Ptr{Float64},
Ptr{$itype},Ptr{$itype},Ptr{Float64},
Ptr{$itype},Ptr{$itype},Ptr{Void},
Ptr{$itype},Ptr{Float64},Ptr{Void}),
Ref{$itype},Ptr{Float64},Ptr{Void}),
Lp,Lj,Lx,
Up,Ui,Ux,
P, Q, C_NULL,
&0, Rs, lu.numeric)
0, Rs, lu.numeric)
(transpose(SparseMatrixCSC(min(n_row, n_col), n_row, increment!(Lp), increment!(Lj), Lx)),
SparseMatrixCSC(min(n_row, n_col), n_col, increment!(Up), increment!(Ui), Ux),
increment!(P), increment!(Q), Rs)
Expand All @@ -364,11 +364,11 @@ for itype in UmfpackIndexTypes
(Ptr{$itype},Ptr{$itype},Ptr{Float64},Ptr{Float64},
Ptr{$itype},Ptr{$itype},Ptr{Float64},Ptr{Float64},
Ptr{$itype},Ptr{$itype},Ptr{Void}, Ptr{Void},
Ptr{$itype},Ptr{Float64},Ptr{Void}),
Ref{$itype},Ptr{Float64},Ptr{Void}),
Lp,Lj,Lx,Lz,
Up,Ui,Ux,Uz,
P, Q, C_NULL, C_NULL,
&0, Rs, lu.numeric)
0, Rs, lu.numeric)
(transpose(SparseMatrixCSC(min(n_row, n_col), n_row, increment!(Lp), increment!(Lj), complex.(Lx, Lz))),
SparseMatrixCSC(min(n_row, n_col), n_col, increment!(Up), increment!(Ui), complex.(Ux, Uz)),
increment!(P), increment!(Q), Rs)
Expand Down
4 changes: 2 additions & 2 deletions doc/src/manual/calling-c-and-fortran-code.md
Original file line number Diff line number Diff line change
Expand Up @@ -687,8 +687,8 @@ function compute_dot(DX::Vector{Float64}, DY::Vector{Float64})
incx = incy = 1
product = ccall((:ddot_, "libLAPACK"),
Float64,
(Ptr{Int32}, Ptr{Float64}, Ptr{Int32}, Ptr{Float64}, Ptr{Int32}),
&n, DX, &incx, DY, &incy)
(Ref{Int32}, Ptr{Float64}, Ref{Int32}, Ptr{Float64}, Ref{Int32}),
n, DX, incx, DY, incy)
return product
end
```
Expand Down
10 changes: 5 additions & 5 deletions doc/src/manual/methods.md
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ Here is the correct code template for returning the element-type `T`
of any arbitrary subtype of `AbstractArray`:

```julia
abstract AbstractArray{T, N}
abstract type AbstractArray{T, N} end
eltype(::Type{<:AbstractArray{T}}) where {T} = T
```
using so-called triangular dispatch. Note that if `T` is a `UnionAll`
Expand All @@ -540,11 +540,11 @@ Another way, which used to be the only correct way before the advent of
triangular dispatch in Julia v0.6, is:

```julia
abstract AbstractArray{T, N}
abstract type AbstractArray{T, N} end
eltype(::Type{AbstractArray}) = Any
eltype{T}(::Type{AbstractArray{T}}) = T
eltype{T, N}(::Type{AbstractArray{T, N}}) = T
eltype{A<:AbstractArray}(::Type{A}) = eltype(supertype(A))
eltype(::Type{AbstractArray{T}}) where {T} = T
eltype(::Type{AbstractArray{T, N}}) where {T, N} = T
eltype(::Type{A}) where {A<:AbstractArray} = eltype(supertype(A))
```

Another possibility is the following, which could useful to adapt
Expand Down
4 changes: 2 additions & 2 deletions test/TestHelpers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ OffsetVector{T,AA<:AbstractArray} = OffsetArray{T,1,AA}
OffsetArray(A::AbstractArray{T,N}, offsets::NTuple{N,Int}) where {T,N} = OffsetArray{T,N,typeof(A)}(A, offsets)
OffsetArray(A::AbstractArray{T,N}, offsets::Vararg{Int,N}) where {T,N} = OffsetArray(A, offsets)

(::Type{OffsetArray{T,N}})(inds::Indices{N}) where {T,N} = OffsetArray{T,N,Array{T,N}}(Array{T,N}(map(length, inds)), map(indsoffset, inds))
(::Type{OffsetArray{T}})(inds::Indices{N}) where {T,N} = OffsetArray{T,N}(inds)
OffsetArray{T,N}(inds::Indices{N}) where {T,N} = OffsetArray{T,N,Array{T,N}}(Array{T,N}(map(length, inds)), map(indsoffset, inds))
OffsetArray{T}(inds::Indices{N}) where {T,N} = OffsetArray{T,N}(inds)

Base.IndexStyle(::Type{T}) where {T<:OffsetArray} = Base.IndexStyle(parenttype(T))
parenttype(::Type{OffsetArray{T,N,AA}}) where {T,N,AA} = AA
Expand Down
2 changes: 1 addition & 1 deletion test/ccall.jl
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ let a, ci_ary, x
@test x == a + 1 - 2im
@test a == 20 + 51im

x = ccall((:cptest_static, libccalltest), Ptr{Complex{Int}}, (Ptr{Complex{Int}},), &a)
x = ccall((:cptest_static, libccalltest), Ptr{Complex{Int}}, (Ref{Complex{Int}},), a)
@test unsafe_load(x) == a
Libc.free(convert(Ptr{Void}, x))
end
Expand Down
2 changes: 1 addition & 1 deletion test/dimensionful.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ struct Furlong{p,T<:Number} <: Number
end
Furlong(x::T) where {T<:Number} = Furlong{1,T}(x)
(::Type{T})(x::Furlong{p,T}) where {p,T} = x.val
(::Type{Furlong{p}})(v::Number) where {p} = Furlong{p,typeof(v)}(v)
Furlong{p}(v::Number) where {p} = Furlong{p,typeof(v)}(v)
Base.convert(::Type{Furlong{p,T}}, x::Furlong{p,S}) where {T,p,S} = Furlong{p,T}(convert(T,x.val))
Base.convert(::Type{Furlong{0,T}}, x::Furlong{0}) where {T} = Furlong{0,T}(convert(T, x.val))
Base.convert(::Type{T}, x::Furlong{0}) where {T<:Number} = convert(T, x.val)
Expand Down
2 changes: 1 addition & 1 deletion test/inference.jl
Original file line number Diff line number Diff line change
Expand Up @@ -817,7 +817,7 @@ end
struct NArray_17003{T,N} <: AArray_17003{Nable_17003{T},N}
end

(::Type{NArray_17003})(::Array{T,N}) where {T,N} = NArray_17003{T,N}()
NArray_17003(::Array{T,N}) where {T,N} = NArray_17003{T,N}()

gl_17003 = [1, 2, 3]

Expand Down
10 changes: 5 additions & 5 deletions test/perf/array/indexing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ end
struct ArrayLSLS{T,N} <: MyArray{T,N} # IndexCartesian with IndexCartesian similar
data::Array{T,N}
end
Base.similar{T}(A::ArrayLSLS, ::Type{T}, dims::Tuple{Vararg{Int}}) = ArrayLSLS(similar(A.data, T, dims))
Base.similar(A::ArrayLSLS, ::Type{T}, dims::Tuple{Vararg{Int}}) where {T} = ArrayLSLS(similar(A.data, T, dims))
@inline Base.setindex!(A::ArrayLSLS, v, I::Int...) = A.data[I...] = v
@inline Base.unsafe_setindex!(A::ArrayLSLS, v, I::Int...) = Base.unsafe_setindex!(A.data, v, I...)
Base.first(A::ArrayLSLS) = first(A.data)
Expand Down Expand Up @@ -140,15 +140,15 @@ Base.size(A::MyArray) = size(A.data)
@inline Base.unsafe_getindex(A::ArrayLF, indx::Int) = unsafe_getindex(A.data, indx)
@inline Base.unsafe_getindex(A::Union{ArrayLS, ArrayLSLS}, i::Int, j::Int) = unsafe_getindex(A.data, i, j)

@inline Base.getindex{T}(A::ArrayStrides{T,2}, i::Real, j::Real) = getindex(A.data, 1+A.strides[1]*(i-1)+A.strides[2]*(j-1))
@inline Base.getindex(A::ArrayStrides{T,2}, i::Real, j::Real) where {T} = getindex(A.data, 1+A.strides[1]*(i-1)+A.strides[2]*(j-1))
@inline Base.getindex(A::ArrayStrides1, i::Real, j::Real) = getindex(A.data, i + A.stride1*(j-1))
@inline Base.unsafe_getindex{T}(A::ArrayStrides{T,2}, i::Real, j::Real) = unsafe_getindex(A.data, 1+A.strides[1]*(i-1)+A.strides[2]*(j-1))
@inline Base.unsafe_getindex(A::ArrayStrides{T,2}, i::Real, j::Real) where {T} = unsafe_getindex(A.data, 1+A.strides[1]*(i-1)+A.strides[2]*(j-1))
@inline Base.unsafe_getindex(A::ArrayStrides1, i::Real, j::Real) = unsafe_getindex(A.data, i + A.stride1*(j-1))

# Using the qualified Base.IndexLinear() in the IndexStyle definition
# requires looking up the symbol in the module on each call.
import Base: IndexLinear
Base.IndexStyle{T<:ArrayLF}(::Type{T}) = IndexLinear()
Base.IndexStyle(::Type{T}) where {T<:ArrayLF} = IndexLinear()

if !applicable(unsafe_getindex, [1 2], 1:1, 2)
@inline Base.unsafe_getindex(A::Array, I...) = @inbounds return A[I...]
Expand All @@ -157,7 +157,7 @@ if !applicable(unsafe_getindex, [1 2], 1:1, 2)
@inline Base.unsafe_getindex(A::BitArray, I1::BitArray, I2::Int) = unsafe_getindex(A, Base.to_index(I1), I2)
end

function makearrays{T}(::Type{T}, sz)
function makearrays(::Type{T}, sz) where T
L = prod(sz)
A = reshape(convert(Vector{T}, [1:L;]), sz)
AS = ArrayLS(A)
Expand Down
2 changes: 1 addition & 1 deletion test/reflection.jl
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,7 @@ end

mutable struct A18434
end
(::Type{A18434})(x; y=1) = 1
A18434(x; y=1) = 1

global counter18434 = 0
function get_A18434()
Expand Down
2 changes: 1 addition & 1 deletion test/replutil.jl
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ Base.Symbol() = throw(ErrorException("1"))
EightBitType() = throw(ErrorException("3"))
(::EightBitType)() = throw(ErrorException("4"))
EightBitTypeT() = throw(ErrorException("5"))
(::Type{EightBitTypeT{T}})() where {T} = throw(ErrorException("6"))
EightBitTypeT{T}() where {T} = throw(ErrorException("6"))
(::EightBitTypeT)() = throw(ErrorException("7"))
(::FunctionLike)() = throw(ErrorException("8"))

Expand Down