File tree Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -481,20 +481,31 @@ function promote_to_concrete(vs; tofloat=true, use_union=false)
481
481
vs
482
482
else
483
483
C = typeof (first (vs))
484
- has_int = false
485
484
I = Int8
485
+ has_int = false
486
+ has_array = false
487
+ array_T = nothing
486
488
for v in vs
489
+ if v isa AbstractArray
490
+ has_array = true
491
+ array_T = typeof (v)
492
+ end
487
493
E = eltype (v)
488
494
C = promote_type (C, E)
489
495
if E <: Integer
490
496
has_int = true
491
497
I = promote_type (I, E)
492
498
end
493
499
end
494
- if tofloat
500
+ if tofloat && ! has_array
495
501
C = float (C)
496
- elseif use_union && has_int && C != = I
497
- C = Union{C, I}
502
+ elseif has_array || (use_union && has_int && C != = I)
503
+ if has_array
504
+ C = Union{C, array_T}
505
+ end
506
+ if has_int
507
+ C = Union{C, I}
508
+ end
498
509
return copyto! (similar (vs, C), vs)
499
510
end
500
511
convert .(C, vs)
You can’t perform that action at this time.
0 commit comments