Skip to content

Commit

Permalink
add bool to promote_to_concrete
Browse files Browse the repository at this point in the history
  • Loading branch information
Brad Carman committed Sep 13, 2023
1 parent 6e70763 commit d53907e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -660,6 +660,7 @@ function promote_to_concrete(vs; tofloat = true, use_union = true)
I = Int8
has_int = false
has_array = false
has_bool = false
array_T = nothing
for v in vs
if v isa AbstractArray
Expand All @@ -672,6 +673,9 @@ function promote_to_concrete(vs; tofloat = true, use_union = true)
has_int = true
I = promote_type(I, E)
end
if E <: Bool
has_bool = true
end
end
if tofloat && !has_array
C = float(C)
Expand All @@ -682,6 +686,9 @@ function promote_to_concrete(vs; tofloat = true, use_union = true)
if has_int
C = Union{C, I}
end
if has_bool
C = Union{C, Bool}
end
return copyto!(similar(vs, C), vs)
end
convert.(C, vs)
Expand Down

0 comments on commit d53907e

Please sign in to comment.