Skip to content

Commit

Permalink
Merge pull request #23144 from JuliaLang/jb/emptyunion
Browse files Browse the repository at this point in the history
deprecate `union()`
  • Loading branch information
JeffBezanson authored Aug 5, 2017
2 parents 41a26ac + 75ba566 commit c9a1844
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,9 @@ Deprecated or removed
full path if you need access to executables or libraries in the `JULIA_HOME` directory, e.g.
`joinpath(JULIA_HOME, "7z.exe")` for `7z.exe` ([#21540]).

* Calling `union` with no arguments is deprecated; construct an empty set with an appropriate
element type using `Set{T}()` instead ([#23144]).

Julia v0.6.0 Release Notes
==========================

Expand Down
2 changes: 2 additions & 0 deletions base/deprecated.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1334,6 +1334,8 @@ end

@deprecate issubtype (<:)

@deprecate union() Set()

# 12807
start(::Union{Process, ProcessChain}) = 1
done(::Union{Process, ProcessChain}, i::Int) = (i == 3)
Expand Down
1 change: 0 additions & 1 deletion base/set.jl
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ done(s::Set, state) = done(s.dict, state)
# NOTE: manually optimized to take advantage of Dict representation
next(s::Set, i) = (s.dict.keys[i], skip_deleted(s.dict, i+1))

union() = Set()
union(s::Set) = copy(s)
function union(s::Set, sets...)
u = Set{join_eltype(s, sets...)}()
Expand Down
1 change: 0 additions & 1 deletion test/sets.jl
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ for data_in in ((7,8,4,5),
end

# union
@test isequal(union(),Set())
@test isequal(union(Set([1])),Set([1]))
s = (Set([1,2]), Set([3,4]))
@test isequal(s, Set([1,2,3,4]))
Expand Down

0 comments on commit c9a1844

Please sign in to comment.