Skip to content

Commit

Permalink
Make StridedArray display as StridedArray
Browse files Browse the repository at this point in the history
Instead of a huge union.  This is just a special-casing for this particular union instead of pursuing the general (and hard\!) typealias search.  But given the ubiquity of StridedArray in method lists, I find this special case to be warranted and hugely beneficial. Here is a sampling from `methods(*)`:

```julia
[242] *(A::LinearAlgebra.AbstractQ, b::StridedArray{T, 1} where T) in LinearAlgebra at /home/mbauman/julia/usr/share/julia/stdlib/v1.2/LinearAlgebra/src/qr.jl:556
[243] *(A::LinearAlgebra.AbstractQ, B::StridedArray{T, 2} where T) in LinearAlgebra at /home/mbauman/julia/usr/share/julia/stdlib/v1.2/LinearAlgebra/src/qr.jl:568
[244] *(Q::LinearAlgebra.AbstractQ, adjB::LinearAlgebra.Adjoint{#s614,#s613} where #s613<:(StridedArray{T, 1} where T) where #s614) in LinearAlgebra at /home/mbauman/julia/usr/share/julia/stdlib/v1.2/LinearAlgebra/src/qr.jl:623
[245] *(A::StridedArray{T, 2} where T, Q::LinearAlgebra.AbstractQ) in LinearAlgebra at /home/mbauman/julia/usr/share/julia/stdlib/v1.2/LinearAlgebra/src/qr.jl:668
[246] *(A::StridedArray{T, 2} where T, adjB::LinearAlgebra.Adjoint{#s614,#s613} where #s613<:LinearAlgebra.AbstractQ where #s614) in LinearAlgebra at /home/mbauman/julia/usr/share/julia/stdlib/v1.2/LinearAlgebra/src/qr.jl:708
[247] *(A::LinearAlgebra.LQPackedQ, B::StridedArray{T, 1} where T) in LinearAlgebra at /home/mbauman/julia/usr/share/julia/stdlib/v1.2/LinearAlgebra/src/lq.jl:153
[248] *(A::LinearAlgebra.LQPackedQ, adjB::LinearAlgebra.Adjoint{#s614,#s613} where #s613<:(StridedArray{T, 1} where T) where #s614) in LinearAlgebra at /home/mbauman/julia/usr/share/julia/stdlib/v1.2/LinearAlgebra/src/lq.jl:177
[249] *(A::StridedArray{T, 1} where T, adjQ::LinearAlgebra.Adjoint{#s614,#s613} where #s613<:LinearAlgebra.LQPackedQ where #s614) in LinearAlgebra at /home/mbauman/julia/usr/share/julia/stdlib/v1.2/LinearAlgebra/src/lq.jl:216
[250] *(A::StridedArray{T, 1} where T, Q::LinearAlgebra.LQPackedQ) in LinearAlgebra at /home/mbauman/julia/usr/share/julia/stdlib/v1.2/LinearAlgebra/src/lq.jl:240
```
  • Loading branch information
mbauman committed Feb 22, 2019
1 parent 07fcdcc commit 81d2c2f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions base/show.jl
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,11 @@ function show(io::IO, @nospecialize(x::Type))
show_datatype(io, x)
return
elseif x isa Union
if x <: StridedArray && x.a <: DenseArray
print(io, "StridedArray")
show_delim_array(io, x.a.parameters, '{', ',', '}', false)
return
end
print(io, "Union")
show_delim_array(io, uniontypes(x), '{', ',', '}', false)
return
Expand Down

0 comments on commit 81d2c2f

Please sign in to comment.