Skip to content

Commit

Permalink
Fix Julia v0.6 xor, is deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
kmsquire committed Nov 15, 2016
1 parent f666641 commit 7d93b45
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 25 deletions.
2 changes: 1 addition & 1 deletion REQUIRE
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
julia 0.4
Compat 0.8.5
Compat 0.9.4
2 changes: 1 addition & 1 deletion src/classified_collections.jl
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ done(cc::ClassifiedCollections, state) = done(cc.map, state)

function push!{K, C}(cc::ClassifiedCollections{K, C}, key::K, e)
c = get(cc.map, key, nothing)
if is(c, nothing)
if c === nothing
c = _create_empty(C)
cc.map[key] = c
end
Expand Down
6 changes: 3 additions & 3 deletions src/deque.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ head_deque_block{T}(ty::Type{T}, n::Int) = DequeBlock{T}(n, n+1)
capacity(blk::DequeBlock) = blk.capa
length(blk::DequeBlock) = blk.back - blk.front + 1
isempty(blk::DequeBlock) = blk.back < blk.front
ishead(blk::DequeBlock) = is(blk.prev, blk)
isrear(blk::DequeBlock) = is(blk.next, blk)
ishead(blk::DequeBlock) = blk.prev === blk
isrear(blk::DequeBlock) = blk.next === blk


# reset the block to empty, and position
Expand Down Expand Up @@ -188,7 +188,7 @@ function dump(io::IO, q::Deque)
println(io)

cb_next::DequeBlock = cb.next
if !is(cb, cb_next)
if cb !== cb_next
cb = cb_next
i += 1
else
Expand Down
12 changes: 6 additions & 6 deletions src/int_set.jl
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# This file was a part of Julia. License is MIT: http://julialang.org/license

import Base: similar, copy, copy!, eltype, push!, pop!, delete!, shift!,
import Base: similar, copy, copy!, eltype, push!, pop!, delete!, shift!,
empty!, isempty, union, union!, intersect, intersect!,
setdiff, setdiff!, symdiff, symdiff!, in, start, next, done,
last, length, show, hash, issubset, ==, <=, <, unsafe_getindex,
last, length, show, hash, issubset, ==, <=, <, unsafe_getindex,
unsafe_setindex!, findnextnot, first
if !isdefined(Base, :complement)
export complement, complement!
Expand Down Expand Up @@ -153,13 +153,13 @@ symdiff(s::IntSet, ns) = symdiff!(copy(s), ns)
symdiff!(s::IntSet, ns) = (for n in ns; symdiff!(s, n); end; s)
function symdiff!(s::IntSet, n::Integer)
0 <= n < typemax(Int) || throw(ArgumentError(_intset_bounds_err_msg))
val = (n in s) $ !s.inverse
val = (n in s) !s.inverse
_setint!(s, n, val)
s
end
function symdiff!(s1::IntSet, s2::IntSet)
e = _matchlength!(s1.bits, length(s2.bits))
map!($, s1.bits, s1.bits, s2.bits)
map!(, s1.bits, s1.bits, s2.bits)
s2.inverse && (s1.inverse = !s1.inverse)
append!(s1.bits, e)
s1
Expand All @@ -177,7 +177,7 @@ end
# Use the next-set index as the state to prevent looking it up again in done
start(s::IntSet) = next(s, 0)[2]
function next(s::IntSet, i, invert=false)
if s.inverse $ invert
if s.inverse invert
# i+1 could rollover causing a BoundsError in findnext/findnextnot
nextidx = i == typemax(Int) ? 0 : findnextnot(s.bits, i+1)
# Extend indices beyond the length of the bits since it is inverted
Expand Down Expand Up @@ -248,7 +248,7 @@ function hash(s::IntSet, h::UInt)
# Only hash the bits array up to the last-set bit to prevent extra empty
# bits from changing the hash result
l = findprev(s.bits, length(s.bits))
hash(unsafe_getindex(s.bits, 1:l), h) $ hash(s.inverse) $ hashis_seed
hash(unsafe_getindex(s.bits, 1:l), h) hash(s.inverse) hashis_seed
end

issubset(a::IntSet, b::IntSet) = isequal(a, intersect(a,b))
Expand Down
2 changes: 1 addition & 1 deletion src/list.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ tail(x::Cons) = x.tail

function show{T}(io::IO, l::LinkedList{T})
if isa(l,Nil)
if is(T,Any)
if T === Any
print(io, "nil()")
else
print(io, "nil(", T, ")")
Expand Down
6 changes: 3 additions & 3 deletions src/multi_dict.jl
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,13 @@ end
function in{K,V}(pr::(Tuple{Any,Any}), d::MultiDict{K,V})
k = convert(K, pr[1])
v = get(d,k,Base.secret_table_token)
!is(v, Base.secret_table_token) && (isa(pr[2], AbstractArray) ? v == pr[2] : pr[2] in v)
(v !== Base.secret_table_token) && (isa(pr[2], AbstractArray) ? v == pr[2] : pr[2] in v)
end

function pop!(d::MultiDict, key, default)
vs = get(d, key, Base.secret_table_token)
if is(vs, Base.secret_table_token)
if !is(default, Base.secret_table_token)
if vs === Base.secret_table_token
if default !== Base.secret_table_token
return default
else
throw(KeyError(key))
Expand Down
2 changes: 1 addition & 1 deletion test/test_int_set.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ data_out = collect(s)
@test length(data_out) == length(data_in)

# eltype, similar
@test is(eltype(IntSet()), Int)
@test eltype(IntSet()) === Int
@test isequal(similar(IntSet([1,2,3])), IntSet())

# show
Expand Down
6 changes: 3 additions & 3 deletions test/test_ordered_dict.jl
Original file line number Diff line number Diff line change
Expand Up @@ -307,12 +307,12 @@ end
# issue 9295
let
d = OrderedDict()
@test is(push!(d, 'a'=> 1), d)
@test push!(d, 'a'=> 1) === d
@test d['a'] == 1
@test is(push!(d, 'b' => 2, 'c' => 3), d)
@test push!(d, 'b' => 2, 'c' => 3) === d
@test d['b'] == 2
@test d['c'] == 3
@test is(push!(d, 'd' => 4, 'e' => 5, 'f' => 6), d)
@test push!(d, 'd' => 4, 'e' => 5, 'f' => 6) === d
@test d['d'] == 4
@test d['e'] == 5
@test d['f'] == 6
Expand Down
12 changes: 6 additions & 6 deletions test/test_ordered_set.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ data_in = (1, "banana", ())
s = OrderedSet(data_in)
data_out = collect(s)
@test isa(data_out, Array{Any,1})
@test is(tuple(data_out...), data_in)
@test is(tuple(data_in...), tuple(s...))
@test tuple(data_out...) === data_in
@test tuple(data_in...) === tuple(s...)
@test length(data_out) == length(data_in)

# hash
Expand Down Expand Up @@ -47,10 +47,10 @@ s3 = OrderedSet{Compat.ASCIIString}(["baz"])
# eltype, similar
s1 = similar(OrderedSet([1,"hello"]))
@test isequal(s1, OrderedSet())
@test is(eltype(s1), Any)
@test eltype(s1) === Any
s2 = similar(OrderedSet{Float32}([2.0f0,3.0f0,4.0f0]))
@test isequal(s2, OrderedSet())
@test is(eltype(s2), Float32)
@test eltype(s2) === Float32

# show
@test endswith(sprint(show, OrderedSet()), "OrderedSet{Any}()")
Expand Down Expand Up @@ -108,10 +108,10 @@ for data_in in ((7,8,4,5),

t = tuple(s...)

@test is(t, data_in)
@test t === data_in
@test length(t) == length(s)
for (e,f) in zip(t,s)
@test is(e,f)
@test e === f
end
end

Expand Down

0 comments on commit 7d93b45

Please sign in to comment.