It's very helpful to note what your expected result is when asking a
question like this--I'm not clear what isn't working as expected, here. As
far as I can tell all the inferred types are correct, though the second one
and the final one could be narrower.
On Wednesday, April 1, 2015 at 10:02:37 AM UTC-5, Michael Francis wrote:
>
> If I run the following, I get the results show to the right (in comments),
> it appears array construction fails to raise to the common
> parent type under certain conditions, is there a way round
> this? Alternatively where is this code implemented ?
>
> abstract Foo{K}
> type Wow{K,V} <: Foo{K} end
> type Bar{K,V} <: Foo{K} end
>
> a = Wow{Int64, Int64}()
> b = Wow{Int64, Float64}()
> c = Bar{Int64, Int64}()
> d = Bar{Int64, String}()
>
> println( "******" )
> println( typeof( [ a ])) #Array{Wow{Int64,Int64},1}
> println( typeof( [ a, b ])) #Array{Wow{K,V},1}
> println( typeof( [ a, c ])) #Array{Foo{Int64},1}
> println( typeof( [ a, b, c ])) #Array{Foo{Int64},1}
> println( typeof( [ a, c, b ])) #Array{Foo{Int64},1}
> println( typeof( [ a, b, c, d ])) #Array{Foo{K},1}
>