Skip to content

Commit 9d8e5d5

Browse files
committed
Switch from macro to type alias for FwdExtrapSpec
Julia seems to have difficult tracking coverage for macros -> Switch to using a type alias to avoid this JuliaLang/julia#36283 Still not having coverage issues, but they go away if we disable inlining -> julia --inline=no ...
1 parent 0f0f929 commit 9d8e5d5

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

src/iterate.jl

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
# Similar to ExtrapDimSpec but for only a single dimension
22
const ExtrapSpec = Union{BoundaryCondition,Tuple{BoundaryCondition,BoundaryCondition}}
33

4-
# Macro to get create ExtrapSpec for checking if a KnotIterator has a given BC
5-
# for forward iteration
6-
macro FwdExtrapSpec(bc)
7-
:( Union{$bc,Tuple{BoundaryCondition,$bc}} )
8-
end
4+
# Type Alias to get Boundary Condition or forward boundary conditions if
5+
# directional
6+
const FwdExtrapSpec{FwdBC} = Union{FwdBC, Tuple{BoundaryCondition, FwdBC}}
97

108
"""
119
KnotIterator{T,ET}(k::AbstractArray{T}, bc::ET)
@@ -132,12 +130,12 @@ iterate(iter::KnotIterator) = iterate(iter, 1)
132130
iterate(iter::KnotIterator, idx::Integer) = idx <= iter.nknots ? (iter.knots[idx], idx+1) : nothing
133131

134132
# For repeating knots state is the knot index + offset value
135-
function iterate(iter::KnotIterator{T,ET}) where {T,ET <: @FwdExtrapSpec(RepeatKnots)}
133+
function iterate(iter::KnotIterator{T,ET}) where {T,ET <: FwdExtrapSpec{RepeatKnots}}
136134
iterate(iter, (1, zero(T)))
137135
end
138136

139137
# Periodic: Iterate over knots, updating the offset each cycle
140-
function iterate(iter::KnotIterator{T,ET}, state::Tuple) where {T, ET <: @FwdExtrapSpec(Periodic)}
138+
function iterate(iter::KnotIterator{T,ET}, state::Tuple) where {T, ET <: FwdExtrapSpec{Periodic}}
141139
state === nothing && return nothing
142140
curidx, offset = state[1], state[2]
143141

@@ -156,7 +154,7 @@ end
156154

157155
# Reflect: Iterate over knots, updating the offset after a forward and backwards
158156
# cycle
159-
function iterate(iter::KnotIterator{T, ET}, state) where {T, ET <: @FwdExtrapSpec(Reflect)}
157+
function iterate(iter::KnotIterator{T, ET}, state) where {T, ET <: FwdExtrapSpec{Reflect}}
160158
state === nothing && return nothing
161159
curidx, offset = state[1], state[2]
162160

0 commit comments

Comments
 (0)