Add a fully typed Diagonal constructor from `AbstractMatrix`es (#52487)
The following works after this PR:
```julia
julia> oftype(Diagonal(Float32[1,2]), [1 0; 0 2])
2×2 Diagonal{Float32, Vector{Float32}}:
1.0 ⋅
⋅ 2.0
```
This changes the behavior of the constructor to copy the diagonal, so
now
```julia
julia> D = Diagonal([1,2]);
julia> typeof(D)(D).diag === D.diag
false
```
whereas this used to be `true` previously. This probably doesn't matter
much, as in most non-trivial cases it'd be copied anyway, and this
conversion is unusual in the trivial case.
---------
Co-authored-by: Daniel Karrasch <daniel.karrasch@posteo.de>