Skip to content

Commit 854a4b8

Browse files
authoredFeb 2, 2021
Merge pull request #114 from SciML/generatedfuncslast
Get tests to pass when running Julia with `--compiled-modules=no`.
2 parents de8f865 + 44b06f2 commit 854a4b8

File tree

4 files changed

+32
-32
lines changed

4 files changed

+32
-32
lines changed
 

‎Project.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "ArrayInterface"
22
uuid = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9"
3-
version = "3.0.0"
3+
version = "3.0.1"
44

55
[deps]
66
IfElse = "615f187c-cbe4-4ef1-ba3b-2fcf58d6d173"

‎src/ArrayInterface.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -744,8 +744,8 @@ end
744744

745745
include("static.jl")
746746
include("ranges.jl")
747-
include("dimensions.jl")
748747
include("indexing.jl")
748+
include("dimensions.jl")
749749
include("stridelayout.jl")
750750

751751
function __init__()

‎src/dimensions.jl

+30-10
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,27 @@ end
246246
@inline function axes_types(::Type{T}) where {P,I,T<:SubArray{<:Any,<:Any,P,I}}
247247
return _sub_axes_types(Val(ArrayStyle(T)), I, axes_types(P))
248248
end
249+
@inline function axes_types(::Type{T}) where {T<:Base.ReinterpretArray}
250+
return _reinterpret_axes_types(
251+
axes_types(parent_type(T)),
252+
eltype(T),
253+
eltype(parent_type(T)),
254+
)
255+
end
256+
function axes_types(::Type{T}) where {N,T<:Base.ReshapedArray{<:Any,N}}
257+
return Tuple{Vararg{OptionallyStaticUnitRange{One,Int},N}}
258+
end
259+
260+
# These methods help handle identifying axes that don't directly propagate from the
261+
# parent array axes. They may be worth making a formal part of the API, as they provide
262+
# a low traffic spot to change what axes_types produces.
263+
@inline function sub_axis_type(::Type{A}, ::Type{I}) where {A,I}
264+
if known_length(I) === nothing
265+
return OptionallyStaticUnitRange{One,Int}
266+
else
267+
return OptionallyStaticUnitRange{One,StaticInt{known_length(I)}}
268+
end
269+
end
249270
@generated function _sub_axes_types(
250271
::Val{S},
251272
::Type{I},
@@ -264,13 +285,15 @@ end
264285
end
265286
Expr(:block, Expr(:meta, :inline), out)
266287
end
267-
268-
@inline function axes_types(::Type{T}) where {T<:Base.ReinterpretArray}
269-
return _reinterpret_axes_types(
270-
axes_types(parent_type(T)),
271-
eltype(T),
272-
eltype(parent_type(T)),
273-
)
288+
@inline function reinterpret_axis_type(::Type{A}, ::Type{T}, ::Type{S}) where {A,T,S}
289+
if known_length(A) === nothing
290+
return OptionallyStaticUnitRange{One,Int}
291+
else
292+
return OptionallyStaticUnitRange{
293+
One,
294+
StaticInt{Int(known_length(A) / (sizeof(T) / sizeof(S)))},
295+
}
296+
end
274297
end
275298
@generated function _reinterpret_axes_types(
276299
::Type{I},
@@ -288,9 +311,6 @@ end
288311
Expr(:block, Expr(:meta, :inline), out)
289312
end
290313

291-
function axes_types(::Type{T}) where {N,T<:Base.ReshapedArray{<:Any,N}}
292-
return Tuple{Vararg{OptionallyStaticUnitRange{One,Int},N}}
293-
end
294314

295315

296316
"""

‎src/stridelayout.jl

-20
Original file line numberDiff line numberDiff line change
@@ -313,27 +313,7 @@ end
313313
_known_length(::Nothing, _, __) = nothing
314314
@inline _known_length(L::Integer, ::Type{T}, ::Type{P}) where {T,P} = L * sizeof(P) ÷ sizeof(T)
315315

316-
# These methods help handle identifying axes that dont' directly propagate from the
317-
# parent array axes. They may be worth making a formal part of the API, as they provide
318-
# a low traffic spot to change what axes_types produces.
319-
@inline function sub_axis_type(::Type{A}, ::Type{I}) where {A,I}
320-
if known_length(I) === nothing
321-
return OptionallyStaticUnitRange{One,Int}
322-
else
323-
return OptionallyStaticUnitRange{One,StaticInt{known_length(I)}}
324-
end
325-
end
326316

327-
@inline function reinterpret_axis_type(::Type{A}, ::Type{T}, ::Type{S}) where {A,T,S}
328-
if known_length(A) === nothing
329-
return OptionallyStaticUnitRange{One,Int}
330-
else
331-
return OptionallyStaticUnitRange{
332-
One,
333-
StaticInt{Int(known_length(A) / (sizeof(T) / sizeof(S)))},
334-
}
335-
end
336-
end
337317

338318
"""
339319
known_offsets(::Type{T}[, d]) -> Tuple

2 commit comments

Comments
 (2)

chriselrod commented on Feb 2, 2021

@chriselrod
CollaboratorAuthor

JuliaRegistrator commented on Feb 2, 2021

@JuliaRegistrator

Registration pull request created: JuliaRegistries/General/29206

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v3.0.1 -m "<description of version>" 854a4b81f306d1f668ae8c9ab12160f0a1dbd923
git push origin v3.0.1
Please sign in to comment.