Skip to content

Commit f6ab86d

Browse files
committed
zeros and ones with interface of similar (from #330)
1 parent a8b3d37 commit f6ab86d

File tree

3 files changed

+0
-27
lines changed

3 files changed

+0
-27
lines changed

README.md

-3
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,6 @@ Currently, the `@compat` macro supports the following syntaxes:
133133

134134
* The `isabstract`, `parameter_upper_bound`, `typename` reflection methods were added in Julia 0.6. This package re-exports these from the `Compat.TypeUtils` submodule. On earlier versions of julia, that module contains the same functions, but operating on the pre-0.6 type system representation.
135135

136-
* `zeros` and `ones` support an interface the same as `similar` ([#19635])
137-
138136
* `convert` can convert between different `Set` types on 0.5 and below. ([#18727])
139137

140138
* `isassigned(::RefValue)` is supported on 0.5 and below. ([#18082])
@@ -470,7 +468,6 @@ includes this fix. Find the minimum version from there.
470468
[#18629]: https://github.com/JuliaLang/julia/issues/18629
471469
[#18727]: https://github.com/JuliaLang/julia/issues/18727
472470
[#19449]: https://github.com/JuliaLang/julia/issues/19449
473-
[#19635]: https://github.com/JuliaLang/julia/issues/19635
474471
[#19784]: https://github.com/JuliaLang/julia/issues/19784
475472
[#20005]: https://github.com/JuliaLang/julia/issues/20005
476473
[#20974]: https://github.com/JuliaLang/julia/issues/20974

src/Compat.jl

-11
Original file line numberDiff line numberDiff line change
@@ -160,17 +160,6 @@ include("arraymacros.jl")
160160
# julia #18839
161161
import Base.Iterators # TODO deprecate, remove
162162

163-
if VERSION < v"0.6.0-dev.1653"
164-
for (fname, felt) in ((:zeros,:zero), (:ones,:one))
165-
@eval begin
166-
# allow signature of similar
167-
Base.$fname(a::AbstractArray, T::Type, dims::Tuple) = fill!(similar(a, T, dims), $felt(T))
168-
Base.$fname(a::AbstractArray, T::Type, dims...) = fill!(similar(a,T,dims...), $felt(T))
169-
Base.$fname(a::AbstractArray, T::Type=eltype(a)) = fill!(similar(a,T), $felt(T))
170-
end
171-
end
172-
end
173-
174163
# https://github.com/JuliaLang/julia/pull/25646
175164
@static if VERSION < v"0.7.0-DEV.3510"
176165
# not exported

test/runtests.jl

-13
Original file line numberDiff line numberDiff line change
@@ -121,19 +121,6 @@ let x = [1,2,3]
121121
@test f(x) == [1,4,9]
122122
end
123123

124-
if VERSION < v"0.6.0-dev.1653"
125-
for (A,val) in ((zeros(1:5, Float32, 3, 2), 0),
126-
(ones(1:5, Float32, 3, 2), 1),
127-
(zeros(1:5, Float32, (3, 2)), 0),
128-
(ones(1:5, Float32, (3, 2)), 1))
129-
@test isa(A, Matrix{Float32}) && size(A) == (3,2) && all(x->x==val, A)
130-
end
131-
for (A,val) in ((zeros(1:5, Float32), 0),
132-
(ones(1:5, Float32), 1))
133-
@test isa(A, Vector{Float32}) && size(A) == (5,) && all(x->x==val, A)
134-
end
135-
end
136-
137124
# PR 20203
138125
@test Compat.readline(IOBuffer("Hello, World!\n")) == "Hello, World!"
139126
@test Compat.readline(IOBuffer("x\n"), keep=false) == "x"

0 commit comments

Comments
 (0)