Skip to content

Commit 61d986c

Browse files
committed
refactor: avoid type parameters in IndexCache
1 parent 5454834 commit 61d986c

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

src/systems/index_cache.jl

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const UnknownIndexMap = Dict{
3939
const TunableIndexMap = Dict{BasicSymbolic,
4040
Union{Int, UnitRange{Int}, Base.ReshapedArray{Int, N, UnitRange{Int}} where {N}}}
4141

42-
struct IndexCache{D}
42+
struct IndexCache
4343
unknown_idx::UnknownIndexMap
4444
# sym => (bufferidx, idx_in_buffer)
4545
discrete_idx::Dict{BasicSymbolic, DiscreteIndex}
@@ -49,7 +49,7 @@ struct IndexCache{D}
4949
constant_idx::ParamIndexMap
5050
nonnumeric_idx::NonnumericMap
5151
observed_syms::Set{BasicSymbolic}
52-
dependent_pars::Set{D}
52+
dependent_pars::Set{Union{BasicSymbolic, CallWithMetadata}}
5353
discrete_buffer_sizes::Vector{Vector{BufferTemplate}}
5454
tunable_buffer_size::BufferTemplate
5555
constant_buffer_sizes::Vector{BufferTemplate}
@@ -275,14 +275,7 @@ function IndexCache(sys::AbstractSystem)
275275
end
276276
end
277277

278-
pdeps = parameter_dependencies(sys)
279-
280-
D = if isempty(pdeps)
281-
BasicSymbolic
282-
else
283-
mapreduce(typeof, promote_type, getproperty.(pdeps, :lhs))
284-
end
285-
dependent_pars = Set{D}()
278+
dependent_pars = Set{Union{BasicSymbolic, CallWithMetadata}}()
286279

287280
for eq in parameter_dependencies(sys)
288281
sym = eq.lhs
@@ -297,7 +290,7 @@ function IndexCache(sys::AbstractSystem)
297290
end
298291
end
299292

300-
return IndexCache{D}(
293+
return IndexCache(
301294
unk_idxs,
302295
disc_idxs,
303296
callback_to_clocks,

0 commit comments

Comments
 (0)