Skip to content

Commit e0d4285

Browse files
authored
Merge pull request #3 from timholy/teh/fix_0.5
Fix 0.5 deprecations and breakages
2 parents 03b6a65 + 711fd91 commit e0d4285

File tree

3 files changed

+14
-8
lines changed

3 files changed

+14
-8
lines changed

REQUIRE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Compat

src/SimpleTraits.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
module SimpleTraits
22
const curmod = module_name(current_module())
33

4+
using Compat
5+
46
# This is basically just adding a few convenience functions & macros
57
# around Holy Traits.
68

@@ -202,8 +204,8 @@ end
202204
type GenerateTypeVars{CASE}
203205
end
204206
Base.start(::GenerateTypeVars) = 1
205-
Base.next(::GenerateTypeVars{:upcase}, state) = (symbol("X$state"), state+1) # X1,..
206-
Base.next(::GenerateTypeVars{:lcase}, state) = (symbol("x$state"), state+1) # x1,...
207+
Base.next(::GenerateTypeVars{:upcase}, state) = (Symbol("X$state"), state+1) # X1,..
208+
Base.next(::GenerateTypeVars{:lcase}, state) = (Symbol("x$state"), state+1) # x1,...
207209
Base.done(::GenerateTypeVars, state) = false
208210

209211
####

test/base-traits.jl

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using SimpleTraits.BaseTraits
2+
using Compat: view
23

34
@test istrait(IsAnything{Any})
45
@test istrait(IsAnything{Union{}})
@@ -14,17 +15,19 @@ using SimpleTraits.BaseTraits
1415
@test istrait(IsImmutable{Float64})
1516
@test !istrait(IsImmutable{Vector{Int}})
1617

17-
@test !istrait(IsCallable{Float64})
1818
@test istrait(IsCallable{Function})
1919

2020
if VERSION>v"0.4-" # use @generated functions
21-
@test istrait(IsContiguous{SubArray{Int64,1,Array{Int64,1},Tuple{UnitRange{Int64}},1}})
22-
@test !istrait(IsContiguous{SubArray{Int64,1,Array{Int64,1},Tuple{StepRange{Int64,Int64}},1}})
21+
a = collect(1:5)
22+
b = view(a, 2:3)
23+
c = view(a, 1:2:5)
24+
@test istrait(IsContiguous{typeof(b)})
25+
@test !istrait(IsContiguous{typeof(c)})
2326

2427
@test istrait(IsFastLinearIndex{Vector})
2528
@test !istrait(IsFastLinearIndex{AbstractArray})
2629

27-
@test istrait(IsCallable{Base.AddFun})
30+
if VERSION < v"0.5.0-dev"
31+
@test istrait(IsCallable{Base.AddFun})
32+
end
2833
end
29-
30-

0 commit comments

Comments
 (0)