julia> foo(ones(2,2))
1
Yet according to @which this shouldn't happen:
julia> @which foo(ones(2,2))
foo{T}(a::Union(Array{T,2},Transpose{T,Array{T,2}})) at none:1
I've also found that I can kind-of cheat by switch the parameter order in the alias:
typealias NormTrans{S,T} Union(S,Transpose{T,S})This now works for Matrix types, but not Transposes:
julia> foo(ones(2,2))
2
julia> foo(Transpose{Float64,Matrix{Float64}}(ones(2,2)))
1
(and yes, I know I could get around this by defining foo(::Matrix) and foo(::Transpose) methods, but this can cause a combinatorial explosion when there are multiple arguments)