Skip to content

Commit 8b0b33f

Browse files
authored
Merge pull request #22 from yuyichao/0.6
Fix depwarns on 0.6
2 parents c7ffd1b + 14984c8 commit 8b0b33f

File tree

3 files changed

+12
-17
lines changed

3 files changed

+12
-17
lines changed

REQUIRE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
julia 0.5
2+
Compat 0.18.0

src/OffsetArrays.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@ module OffsetArrays
55
Base.@deprecate_binding (..) Colon()
66

77
using Base: Indices, LinearSlow, LinearFast, tail
8+
using Compat
89

910
export OffsetArray, @unsafe
1011

1112
immutable OffsetArray{T,N,AA<:AbstractArray} <: AbstractArray{T,N}
1213
parent::AA
1314
offsets::NTuple{N,Int}
1415
end
15-
typealias OffsetVector{T,AA<:AbstractArray} OffsetArray{T,1,AA}
16+
@compat OffsetVector{T,AA<:AbstractArray} = OffsetArray{T,1,AA}
1617

1718
OffsetArray{T,N}(A::AbstractArray{T,N}, offsets::NTuple{N,Int}) =
1819
OffsetArray{T,N,typeof(A)}(A, offsets)
@@ -200,7 +201,7 @@ end
200201
@inline unsafe_setindex!(a::OffsetArray, val, I...) = unsafe_setindex!(a, val, Base.IteratorsMD.flatten(I)...)
201202

202203
# Indexing a SubArray which has OffsetArray indices
203-
typealias OffsetSubArray{T,N,P,I<:Tuple{OffsetArray,Vararg{OffsetArray}}} SubArray{T,N,P,I,false}
204+
@compat OffsetSubArray{T,N,P,I<:Tuple{OffsetArray,Vararg{OffsetArray}}} = SubArray{T,N,P,I,false}
204205
@inline function unsafe_getindex{T,N}(a::OffsetSubArray{T,N}, I::Vararg{Int,N})
205206
J = map(unsafe_getindex, a.indexes, I)
206207
unsafe_getindex(parent(a), J...)

test/runtests.jl

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using Base.Test
22
using OffsetArrays
3+
using Compat
34

45
ambs = detect_ambiguities(Base, Core) # in case these have ambiguities of their own
56
@test isempty(setdiff(detect_ambiguities(OffsetArrays, Base, Core), ambs))
@@ -128,28 +129,20 @@ for (a,d) in zip(A, A0)
128129
end
129130

130131
# show
131-
io = IOBuffer()
132-
show(io, A)
133-
str = takebuf_string(io)
134-
@test str == "[1 3; 2 4]"
135-
show(io, S)
136-
str = takebuf_string(io)
137-
@test str == "[1 3; 2 4]"
138-
show(io, MIME("text/plain"), A)
139-
strs = split(strip(takebuf_string(io)), '\n')
132+
@test sprint(show, A) == "[1 3; 2 4]"
133+
@test sprint(show, S) == "[1 3; 2 4]"
134+
strs = split(strip(sprint(show, MIME("text/plain"), A)), '\n')
140135
@test strs[2] == " 1 3"
141136
@test strs[3] == " 2 4"
142137
v = OffsetArray(rand(3), (-2,))
143-
show(io, v)
144-
str = takebuf_string(io)
145-
show(io, parent(v))
146-
@test str == takebuf_string(io)
138+
@test sprint(show, v) == sprint(show, parent(v))
139+
io = IOBuffer()
147140
function cmp_showf(printfunc, io, A)
148141
ioc = IOContext(io, limit=true, compact=true)
149142
printfunc(ioc, A)
150-
str1 = takebuf_string(io)
143+
str1 = String(take!(io))
151144
printfunc(ioc, parent(A))
152-
str2 = takebuf_string(io)
145+
str2 = String(take!(io))
153146
@test str1 == str2
154147
end
155148
cmp_showf(Base.print_matrix, io, OffsetArray(rand(5,5), (10,-9))) # rows&cols fit

0 commit comments

Comments
 (0)