Skip to content

Commit 25184c8

Browse files
eltype promotion in varmap_tp_vars (#1469)
Co-authored-by: Christopher Rackauckas <[email protected]>
1 parent d0d2589 commit 25184c8

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

src/variables.jl

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,20 +72,15 @@ function _varmap_to_vars(varmap::Dict, varlist; defaults=Dict(), check=false, to
7272
varmap = merge(defaults, varmap) # prefers the `varmap`
7373
varmap = Dict(toterm(value(k))=>value(varmap[k]) for k in keys(varmap))
7474
# resolve symbolic parameter expressions
75-
example_val = nothing
7675
for (p, v) in pairs(varmap)
7776
val = varmap[p] = fixpoint_sub(v, varmap)
78-
if example_val === nothing && unwrap(val) isa Number
79-
example_val = val
80-
end
8177
end
8278
vs = values(varmap)
8379
T′ = eltype(vs)
8480
if Base.isconcretetype(T′)
8581
T = T′
8682
else
87-
example_val === nothing && throw_missingvars(varlist)
88-
T = float(typeof(example_val))
83+
T = foldl((t, elem)->promote_type(t, eltype(elem)), vs; init=typeof(first(vs)))
8984
end
9085
out = Vector{T}(undef, length(varlist))
9186
missingvars = setdiff(varlist, keys(varmap))

0 commit comments

Comments
 (0)