We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b4f821e commit e62e3eeCopy full SHA for e62e3ee
src/utils.jl
@@ -670,23 +670,23 @@ function promote_to_concrete(vs; tofloat = true, use_union = true)
670
E = float(E)
671
end
672
673
+ if C === nothing
674
+ C = E
675
+ end
676
if use_union
- if C === nothing
- C = E
- else
677
- C = Union{C, E}
678
- end
+ C = Union{C, E}
679
else
+ @assert C == E "`promote_to_concrete` can't make type $E uniform with $C"
680
C = E
681
682
683
684
y = similar(vs, C)
685
for i in eachindex(vs)
686
if (vs[i] isa Number) & tofloat
687
- y[i] = float(vs[i])
+ y[i] = float(vs[i]) #needed because copyto! can't convert Int to Float automatically
688
689
- y[i] = vs[i]
+ y[i] = vs[i]
690
691
692
0 commit comments