Skip to content

Commit a1d6ed9

Browse files
committed
Remove compat code undef from #417 and #514
1 parent ae4edc6 commit a1d6ed9

File tree

4 files changed

+12
-43
lines changed

4 files changed

+12
-43
lines changed

README.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,6 @@ Currently, the `@compat` macro supports the following syntaxes:
8181

8282
* `isnothing` for testing if a variable is equal to `nothing` ([#29674]).
8383

84-
* `UndefInitializer` and `undef` with corresponding `Array` constructors ([#24652], [#26316]).
85-
86-
* `BitArray` constructors for `undef` ([#24785], [#26316]).
87-
8884
* `@compat finalizer(func, obj)` with the finalizer to run as the first argument and the object to be finalized
8985
as the second ([#24605]).
9086

src/Compat.jl

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -37,33 +37,6 @@ import Base64
3737

3838
include("compatmacro.jl")
3939

40-
# 0.7.0-DEV.4527
41-
@static if !isdefined(Base, :UndefInitializer)
42-
import Base: Array, Matrix, Vector
43-
@static if isdefined(Base, :Uninitialized)
44-
useuninit(args) = (Base.uninitialized, args...)
45-
else
46-
useuninit(args) = args
47-
end
48-
struct UndefInitializer end
49-
const undef = UndefInitializer()
50-
export undef, UndefInitializer
51-
Base.show(io::IO, ::UndefInitializer) =
52-
print(io, "array initializer with undefined values")
53-
Array{T}(::UndefInitializer, args...) where {T} = Array{T}(useuninit(args)...)
54-
Array{T,N}(::UndefInitializer, args...) where {T,N} = Array{T,N}(useuninit(args)...)
55-
Vector(::UndefInitializer, args...) = Vector(useuninit(args)...)
56-
Matrix(::UndefInitializer, args...) = Matrix(useuninit(args)...)
57-
58-
BitArray{N}(::UndefInitializer, args...) where {N} = BitArray{N}(useuninit(args)...)
59-
BitArray(::UndefInitializer, args...) = BitArray(useuninit(args)...)
60-
end
61-
@static if VERSION < v"0.7.0-DEV.2581"
62-
export uninitialized, Uninitialized
63-
const uninitialized = undef
64-
const Uninitialized = UndefInitializer
65-
end
66-
6740
# 0.7.0-DEV.1499
6841
if VERSION < v"0.7.0-DEV.1499"
6942
function Base.get(f::Base.Callable, ::Base.EnvHash, k::AbstractString)

test/old.jl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -520,3 +520,15 @@ end
520520
# 0.7.0-DEV.1472
521521
@test get(IOContext(IOBuffer(), :arg1=>true, :arg2=>true, :arg3=>true), :arg3, false)
522522
@test get(IOContext(IOBuffer(), :arg1=>true, :arg2=>true), :arg2, false)
523+
524+
# 0.7.0-DEV.2581, 0.7.0-DEV.4527
525+
@test isa(Vector(undef, 2), Vector{Any})
526+
@test isa(Vector{Float64}(undef, 2), Vector{Float64})
527+
@test isa(Matrix(undef, 2, 2), Matrix{Any})
528+
@test isa(Matrix{Float64}(undef, 2, 2), Matrix{Float64})
529+
@test isa(Array{Float64}(undef, 2, 2), Matrix{Float64})
530+
@test isa(Array{Float64,3}(undef, 2, 2, 2), Array{Float64,3})
531+
532+
# 0.7.0-DEV.2687, 0.7.0-DEV.4527
533+
@test isa(BitVector(undef, 2), BitVector)
534+
@test isa(BitArray(undef, 2, 2), BitMatrix)

test/runtests.jl

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -76,18 +76,6 @@ end
7676
@test textwidth("A") == 1
7777
@test textwidth('A') == 1
7878

79-
# 0.7.0-DEV.2581, 0.7.0-DEV.4527
80-
@test isa(Vector(undef, 2), Vector{Any})
81-
@test isa(Vector{Float64}(undef, 2), Vector{Float64})
82-
@test isa(Matrix(undef, 2, 2), Matrix{Any})
83-
@test isa(Matrix{Float64}(undef, 2, 2), Matrix{Float64})
84-
@test isa(Array{Float64}(undef, 2, 2), Matrix{Float64})
85-
@test isa(Array{Float64,3}(undef, 2, 2, 2), Array{Float64,3})
86-
87-
# 0.7.0-DEV.2687, 0.7.0-DEV.4527
88-
@test isa(BitVector(undef, 2), BitVector)
89-
@test isa(BitArray(undef, 2, 2), BitMatrix)
90-
9179
# 0.7
9280
let A = [1]
9381
local x = 0

0 commit comments

Comments
 (0)