incorrect method sorting with union in typevar bound #8915
Closed
Description
The documentation states that methods are selected based off which is the most specific. While not explicitly stated, this generally also seems to be true of constructors. However on 0.4, the following seems to be functioning off the order the constructors are declared in, rather then which is most specific:
type A{O <: Union(Float64,String)}
A(a) = println("A(a)")
A(a::Int) = println("A(a::Int)")
end
type B{O <: Union(Float64,String)}
B(a::Int) = println("B(a::Int)")
B(a) = println("B(a)")
end
A{Float64}(1)
B{Float64}(1)
Which produces the following output:
A(a)
B(a::Int)
I can't reproduce this on 0.3, only 0.4. I've also only been able to reproduce this when parameterizing the type with a Union.