Skip to content

Commit

Permalink
Fix deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
davidanthoff committed Aug 10, 2018
1 parent 5406169 commit f514811
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
7 changes: 3 additions & 4 deletions src/scalar/core.jl
Expand Up @@ -84,7 +84,7 @@ Base.getindex(x::DataValue) = isna(x) ? throw(DataValueException()) : x.value
Base.get(x::DataValue{Union{}}) = throw(DataValueException())
Base.get(x::DataValue{Union{}}, y) = y

Base.unsafe_get(x::DataValue) = x.value
unsafe_get(x::DataValue) = x.value

isna(x) = false
isna(x::DataValue) = !x.hasvalue
Expand Down Expand Up @@ -124,10 +124,9 @@ Base.zero(x::DataValues.DataValue{T}) where {T<:Dates.Period}= DataValue{T}(zero

# Strings

for op in (:lowercase,:uppercase,:reverse,:ucfirst,:lcfirst,:chop,:chomp)
for op in (:lowercase,:uppercase,:reverse,:uppercasefirst,:lowercasefirst,:chop,:chomp)
@eval begin
import Base.$(op)
function $op(x::DataValue{T}) where {T <: AbstractString}
function Base.$op(x::DataValue{T}) where {T <: AbstractString}
if isna(x)
return DataValue{T}()
else
Expand Down
3 changes: 1 addition & 2 deletions src/scalar/operations.jl
Expand Up @@ -36,8 +36,7 @@ for f in (:(Base.acos), :(Base.acosh), :(Base.asin), :(Base.asinh),
:(Base.atan), :(Base.atanh), :(Base.sin), :(Base.sinh), :(Base.cos),
:(Base.cosh), :(Base.tan), :(Base.tanh), :(Base.exp), :(Base.exp2),
:(Base.expm1), :(Base.log), :(Base.log10), :(Base.log1p),
:(Base.log2), :(Base.exponent), :(Base.sqrt), :(Base.gamma),
:(Base.lgamma), :(Dates.value))
:(Base.log2), :(Base.exponent), :(Base.sqrt), :(Dates.value))
@eval begin
function $f(a::DataValue{T}) where {T}
if isna(a)
Expand Down
2 changes: 1 addition & 1 deletion test/scalar/test_core.jl
Expand Up @@ -31,7 +31,7 @@ end
@test get(DataValue("test"), "default") == "test"
@test get(DataValue{String}(), "default") == "default"

@test unsafe_get(DataValue(3)) == 3
@test DataValues.unsafe_get(DataValue(3)) == 3

end

Expand Down

0 comments on commit f514811

Please sign in to comment.