Skip to content

Commit 63c86af

Browse files
authored
Use Compat.@constprop and Compat.@inline() (#205)
1 parent 84a3bce commit 63c86af

File tree

4 files changed

+9
-16
lines changed

4 files changed

+9
-16
lines changed

Project.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
name = "ArrayInterface"
22
uuid = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9"
3-
version = "3.1.32"
3+
version = "3.1.33"
44

55
[deps]
6+
Compat = "34da2185-b29b-5c13-b0c7-acf172513d20"
67
IfElse = "615f187c-cbe4-4ef1-ba3b-2fcf58d6d173"
78
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
89
Requires = "ae029012-a4dd-5104-9daa-d747884805df"
910
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
1011
Static = "aedffcd0-7271-4cad-89d0-dc628f76c6d3"
1112

1213
[compat]
14+
Compat = "3.37"
1315
IfElse = "0.1"
1416
Requires = "0.5, 1.0"
1517
Static = "0.3.3"

src/ArrayInterface.jl

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,11 @@ using Static
88
using Static: Zero, One, nstatic, _get_tuple, eq, ne, gt, ge, lt, le, eachop, eachop_tuple,
99
find_first_eq, permute, invariant_permutation
1010
using Base.Cartesian
11+
import Compat
1112

1213
using Base: @propagate_inbounds, tail, OneTo, LogicalIndex, Slice, ReinterpretArray,
1314
ReshapedArray, AbstractCartesianIndex
1415

15-
16-
## utilites for internal use only ##
17-
@static if isdefined(Base, Symbol("@constprop"))
18-
using Base: @constprop
19-
else
20-
macro constprop(_, ex)
21-
ex
22-
end
23-
end
24-
2516
const CanonicalInt = Union{Int,StaticInt}
2617

2718
@static if VERSION v"1.6.0-DEV.1581"

src/dimensions.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ function from_parent_dims(::Type{R}) where {T,N,S,A,R<:ReinterpretArray{T,N,S,A}
7373
end
7474

7575
from_parent_dims(x, dim) = from_parent_dims(typeof(x), dim)
76-
@constprop :aggressive function from_parent_dims(::Type{T}, dim::Int)::Int where {T}
76+
Compat.@constprop :aggressive function from_parent_dims(::Type{T}, dim::Int)::Int where {T}
7777
if dim > ndims(T)
7878
return static(ndims(parent_type(T)) + dim - ndims(T))
7979
elseif dim > 0
@@ -127,7 +127,7 @@ function to_parent_dims(::Type{R}) where {T,N,S,A,R<:ReinterpretArray{T,N,S,A}}
127127
end
128128

129129
to_parent_dims(x, dim) = to_parent_dims(typeof(x), dim)
130-
@constprop :aggressive function to_parent_dims(::Type{T}, dim::Int)::Int where {T}
130+
Compat.@constprop :aggressive function to_parent_dims(::Type{T}, dim::Int)::Int where {T}
131131
if dim > ndims(T)
132132
return static(ndims(parent_type(T)) + dim - ndims(T))
133133
elseif dim > 0
@@ -200,7 +200,7 @@ function to_dims(::Type{T}, dim::StaticSymbol) where {T}
200200
end
201201
return i
202202
end
203-
@constprop :aggressive function to_dims(::Type{T}, dim::Symbol) where {T}
203+
Compat.@constprop :aggressive function to_dims(::Type{T}, dim::Symbol) where {T}
204204
i = find_first_eq(dim, map(Symbol, dimnames(T)))
205205
if i === nothing
206206
throw_dim_error(T, dim)
@@ -227,7 +227,7 @@ order_named_inds(x::Tuple, ::NamedTuple{(),Tuple{}}) = ()
227227
function order_named_inds(x::Tuple, nd::NamedTuple{L}) where {L}
228228
return order_named_inds(x, static(Val(L)), Tuple(nd))
229229
end
230-
@constprop :aggressive function order_named_inds(
230+
Compat.@constprop :aggressive function order_named_inds(
231231
x::Tuple{Vararg{Any,N}},
232232
nd::Tuple,
233233
inds::Tuple

src/indexing.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ end
379379

380380
function _generate_unsafe_get_index!_body(N::Int)
381381
quote
382-
Base.@_inline_meta
382+
Compat.@inline()
383383
D = eachindex(dest)
384384
Dy = iterate(D)
385385
@inbounds Base.Cartesian.@nloops $N j d -> I[d] begin

0 commit comments

Comments
 (0)