# Array promotion: too eager?

**URL:** https://discourse.julialang.org/t/array-promotion-too-eager/86422
**Category:** General Usage
**Created:** [August 27, 2022, 8:52am UTC](https://discourse.julialang.org/t/array-promotion-too-eager/86422 "2022-08-27T08:52:37Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![aplavin](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/aplavin/32/222056_2.png) [@aplavin](https://discourse.julialang.org/u/aplavin)
#### Post date: [August 27, 2022, 8:52am UTC](https://discourse.julialang.org/t/array-promotion-too-eager/86422/1 "2022-08-27T08:52:37Z")

</div>

I’ve noticed that recent 1.9 nightlies became more eager in converting array elements to a common type. This seems unambiguously breaking, and not sure about the motivation: what were the reasons for such a change?  
For example, 1.8 properly keeps both original values as-is:

```julia
julia> using StructArrays

julia> A = [StructArray([1+2im]), [3]];

julia> A[1]
1-element StructArray(::Vector{Int64}, ::Vector{Int64}) with eltype Complex{Int64}:
 1 + 2im

julia> A[2]
1-element Vector{Int64}:
 3

```

While nightly Julia changes types of both elements:

```julia
julia> A = [StructArray([1+2im]), [3]];

julia> A[1]
1-element Vector{Complex{Int64}}:
 1 + 2im

julia> A[2]
1-element Vector{Complex{Int64}}:
 3 + 0im

```

This changes the meaning of perfectly fine and working code.

---

<div class="post-metadata">

### Author: ![jakobnissen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jakobnissen/32/13477_2.png) [@jakobnissen](https://discourse.julialang.org/u/jakobnissen)
#### Post date: [August 27, 2022, 9:05am UTC](https://discourse.julialang.org/t/array-promotion-too-eager/86422/2 "2022-08-27T09:05:02Z")

</div>

This might be the same as [Change in `AbstractArray` promotion · Issue #45511 · JuliaLang/julia · GitHub](https://github.com/JuliaLang/julia/issues/45511) which indeed was .a mistake, and will be fixed before the 1.9 release.
