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

Avoid throwing depwarn for zeros/ones methods defined in Base #13

Merged
merged 1 commit into from
Sep 11, 2016

Conversation

timholy
Copy link
Member

@timholy timholy commented Sep 11, 2016

These improve upon the deprecations added in #12, which are inadvertently triggered even for syntax classically supported by Base:

julia> zeros(1:5)
WARNING: zeros(inds::UnitRange...) is deprecated, use fill!(OffsetArray{Float64}(inds),0) instead.
 in depwarn(::String, ::Symbol) at deprecated.jl:64
 in zeros(::UnitRange{Int64}) at deprecated.jl:50
 in eval(::Module, ::Any) at boot.jl:234
 in eval_user_input(::Any, ::Base.REPL.REPLBackend) at REPL.jl:64
 in macro expansion at REPL.jl:95 [inlined]
 in (::Base.REPL.##3#4{Base.REPL.REPLBackend})() at event.jl:68
while loading no file, in expression starting on line 0
OffsetArrays.OffsetArray{Float64,1,Array{Float64,1}} with indices 1:5:
 0.0
 0.0
 0.0
 0.0
 0.0

@timholy
Copy link
Member Author

timholy commented Sep 11, 2016

I should clarify that on this branch:

julia> zeros(1:5)
5-element Array{Int64,1}:
 0
 0
 0
 0
 0

julia> zeros(1:5, -2:2)
WARNING: zeros(ind1::UnitRange,ind2::UnitRange,inds::UnitRange...) is deprecated, use fill!(OffsetArray{Float64}((ind1,ind2,inds...)),0) instead.
 in depwarn(::String, ::Symbol) at deprecated.jl:64
 in zeros(::UnitRange{Int64}, ::UnitRange{Int64}) at deprecated.jl:50
 in eval(::Module, ::Any) at boot.jl:234
 in eval_user_input(::Any, ::Base.REPL.REPLBackend) at REPL.jl:64
 in macro expansion at REPL.jl:95 [inlined]
 in (::Base.REPL.##3#4{Base.REPL.REPLBackend})() at event.jl:68
while loading no file, in expression starting on line 0
OffsetArrays.OffsetArray{Float64,2,Array{Float64,2}} with indices 1:5×-2:2:
 0.0  0.0  0.0  0.0  0.0
 0.0  0.0  0.0  0.0  0.0
 0.0  0.0  0.0  0.0  0.0
 0.0  0.0  0.0  0.0  0.0
 0.0  0.0  0.0  0.0  0.0

@alsam
Copy link
Member

alsam commented Sep 11, 2016

Thanks for the pull requests!

@alsam alsam merged commit e6a0138 into master Sep 11, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants