Skip to content

Commit

Permalink
fix JuliaLang#17758, deprecate is
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffBezanson authored and fcard committed Feb 28, 2017
1 parent 59d3d85 commit 2bfac3d
Show file tree
Hide file tree
Showing 44 changed files with 242 additions and 244 deletions.
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ Deprecated or removed

* `isdefined(a::Array, i::Int)` has been deprecated in favor of `isassigned` ([#18346]).

* `is` has been deprecated in favor of `===` (which used to be an alias for `is`) ([#17758]).

Julia v0.5.0 Release Notes
==========================

Expand Down Expand Up @@ -673,6 +675,7 @@ Language tooling improvements
[#17510]: https://github.com/JuliaLang/julia/issues/17510
[#17546]: https://github.com/JuliaLang/julia/issues/17546
[#17668]: https://github.com/JuliaLang/julia/issues/17668
[#17758]: https://github.com/JuliaLang/julia/issues/17758
[#17785]: https://github.com/JuliaLang/julia/issues/17785
[#18330]: https://github.com/JuliaLang/julia/issues/18330
[#18339]: https://github.com/JuliaLang/julia/issues/18339
Expand Down
8 changes: 4 additions & 4 deletions base/array.jl
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ setindex!{T}(A::Array{T}, x, i1::Real, i2::Real, I::Real...) = arrayset(A, conve

# These are redundant with the abstract fallbacks but needed for bootstrap
function setindex!(A::Array, x, I::AbstractVector{Int})
is(A, I) && (I = copy(I))
A === I && (I = copy(I))
for i in I
A[i] = x
end
Expand All @@ -485,10 +485,10 @@ end
function setindex!(A::Array, X::AbstractArray, I::AbstractVector{Int})
setindex_shape_check(X, length(I))
count = 1
if is(X,A)
if X === A
X = copy(X)
is(I,A) && (I = X::typeof(I))
elseif is(I,A)
I===A && (I = X::typeof(I))
elseif I === A
I = copy(I)
end
for i in I
Expand Down
9 changes: 4 additions & 5 deletions base/associative.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ haskey(d::Associative, k) = in(k,keys(d))

function in(p::Pair, a::Associative, valcmp=(==))
v = get(a,p[1],secret_table_token)
if !is(v, secret_table_token)
if v !== secret_table_token
valcmp(v, p[2]) && return true
end
return false
Expand Down Expand Up @@ -57,8 +57,7 @@ function next(v::ValueIterator, state)
n[1][2], n[2]
end

in(k, v::KeyIterator) = !is(get(v.dict, k, secret_table_token),
secret_table_token)
in(k, v::KeyIterator) = get(v.dict, k, secret_table_token) !== secret_table_token


"""
Expand Down Expand Up @@ -259,7 +258,7 @@ end

function getindex(t::Associative, key)
v = get(t, key, secret_table_token)
if is(v, secret_table_token)
if v === secret_table_token
throw(KeyError(key))
end
return v
Expand Down Expand Up @@ -324,7 +323,7 @@ end

function pop!(t::ObjectIdDict, key::ANY)
val = pop!(t, key, secret_table_token)
!is(val,secret_table_token) ? val : throw(KeyError(key))
val !== secret_table_token ? val : throw(KeyError(key))
end

function delete!(t::ObjectIdDict, key::ANY)
Expand Down
6 changes: 2 additions & 4 deletions base/boot.jl
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ export
Expr, GotoNode, LabelNode, LineNumberNode, QuoteNode,
GlobalRef, NewvarNode, SSAValue, Slot, SlotNumber, TypedSlot,
# object model functions
fieldtype, getfield, setfield!, nfields, throw, tuple, is, ===, isdefined, eval,
fieldtype, getfield, setfield!, nfields, throw, tuple, ===, isdefined, eval,
# sizeof # not exported, to avoid conflicting with Base.sizeof
# type reflection
issubtype, typeof, isa, typeassert,
Expand All @@ -149,8 +149,6 @@ export
# constants
nothing, Main

const (===) = is

typealias AnyVector Array{Any,1}

abstract Number
Expand Down Expand Up @@ -178,7 +176,7 @@ bitstype 64 UInt64 <: Unsigned
bitstype 128 Int128 <: Signed
bitstype 128 UInt128 <: Unsigned

if is(Int,Int64)
if Int === Int64
typealias UInt UInt64
else
typealias UInt UInt32
Expand Down
4 changes: 2 additions & 2 deletions base/client.jl
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ function eval_user_input(ast::ANY, show_value)
ast = expand(ast)
value = eval(Main, ast)
eval(Main, Expr(:(=), :ans, Expr(:call, ()->value)))
if !is(value,nothing) && show_value
if value!==nothing && show_value
if have_color
print(answer_color())
end
Expand Down Expand Up @@ -167,7 +167,7 @@ function parse_input_line(s::String; filename::String="none")
# (ex, pos) = ccall(:jl_parse_string, Any,
# (Ptr{UInt8},Csize_t,Int32,Int32),
# s, sizeof(s), pos-1, 1)
# if !is(ex,())
# if ex!==()
# throw(ParseError("extra input after end of expression"))
# end
# expr
Expand Down
2 changes: 2 additions & 0 deletions base/deprecated.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1021,4 +1021,6 @@ end))

@deprecate ipermutedims(A::AbstractArray,p) permutedims(A, invperm(p))

@deprecate is (===)

# End deprecations scheduled for 0.6
2 changes: 1 addition & 1 deletion base/docs/basedocs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,7 @@ Introduce a new name for an already expressible type. For example, in `base/boot
`UInt` is type aliased to either `UInt64` or `UInt32` as appropriate for the size of
pointers on the system:
if is(Int,Int64)
if Int === Int64
typealias UInt UInt64
else
typealias UInt UInt32
Expand Down
4 changes: 2 additions & 2 deletions base/essentials.jl
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ cnvt_all(T, x, rest...) = tuple(convert(T,x), cnvt_all(T, rest...)...)

macro generated(f)
isa(f, Expr) || error("invalid syntax; @generated must be used with a function definition")
if is(f.head, :function) || (isdefined(:length) && is(f.head, :(=)) && length(f.args) == 2 && f.args[1].head == :call)
if f.head === :function || (isdefined(:length) && f.head === :(=) && length(f.args) == 2 && f.args[1].head == :call)
f.head = :stagedfunction
return Expr(:escape, f)
else
Expand Down Expand Up @@ -69,7 +69,7 @@ function tuple_type_cons{S,T<:Tuple}(::Type{S}, ::Type{T})
Tuple{S, T.parameters...}
end

isvarargtype(t::ANY) = isa(t, DataType) && is((t::DataType).name, Vararg.name)
isvarargtype(t::ANY) = isa(t, DataType) && (t::DataType).name === Vararg.name
isvatuple(t::DataType) = (n = length(t.parameters); n > 0 && isvarargtype(t.parameters[n]))
unwrapva(t::ANY) = isvarargtype(t) ? t.parameters[1] : t

Expand Down
2 changes: 1 addition & 1 deletion base/expr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ end

remove_linenums!(ex) = ex
function remove_linenums!(ex::Expr)
filter!(x->!((isa(x,Expr) && is(x.head,:line)) || isa(x,LineNumberNode)), ex.args)
filter!(x->!((isa(x,Expr) && x.head === :line) || isa(x,LineNumberNode)), ex.args)
for subex in ex.args
remove_linenums!(subex)
end
Expand Down
Loading

0 comments on commit 2bfac3d

Please sign in to comment.