Skip to content

Commit ef1e4af

Browse files
fixup! refactor: use clock from SciMLBase, fix tests
1 parent 9a0ba96 commit ef1e4af

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

src/discretedomain.jl

+3-8
Original file line numberDiff line numberDiff line change
@@ -183,18 +183,18 @@ julia> x(k) # no shift
183183
x(t)
184184
185185
julia> x(k+1) # shift
186-
Shift(t, 1)(x(t))
186+
Shift(1)(x(t))
187187
```
188188
"""
189189
struct ShiftIndex
190190
clock::Union{InferredTimeDomain, TimeDomain, IntegerSequence}
191191
steps::Int
192192
function ShiftIndex(
193-
clock::Union{TimeDomain, InferredTimeDomain} = Inferred, steps::Int = 0)
193+
clock::Union{TimeDomain, InferredTimeDomain, IntegerSequence} = Inferred, steps::Int = 0)
194194
new(clock, steps)
195195
end
196196
ShiftIndex(dt::Real, steps::Int = 0) = new(Clock(dt), steps)
197-
ShiftIndex(t::Num, steps::Int = 0) = new(IntegerSequence(), steps)
197+
ShiftIndex(::Num, steps::Int) = new(IntegerSequence(), steps)
198198
end
199199

200200
function (xn::Num)(k::ShiftIndex)
@@ -207,11 +207,6 @@ function (xn::Num)(k::ShiftIndex)
207207
args = Symbolics.arguments(vars[]) # args should be one element vector with the t in x(t)
208208
length(args) == 1 ||
209209
error("Cannot shift an expression with multiple independent variables $x.")
210-
t = args[]
211-
if hasfield(typeof(clock), :t)
212-
isequal(t, clock.t) ||
213-
error("Independent variable of $xn is not the same as that of the ShiftIndex $(k.t)")
214-
end
215210

216211
# d, _ = propagate_time_domain(xn)
217212
# if d != clock # this is only required if the variable has another clock

0 commit comments

Comments
 (0)